akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

int main(){
	string str;
	cin >> str;
	long long int N = str.size();
	long long int ans = N * (N - 1) / 2 + 1;
	long long int count[26] = {};
	for(int i = 0; i < N; i++){
		count[str[i] - 'a']++;
	}
	for(int i = 0; i < 26; i++){
		ans -= count[i] * (count[i] - 1) / 2;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 640
#include"bits/stdc++.h"
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
const int inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<P,int>PP;
signed main() {
	int n; cin >> n;
	if (n & 1)cout << 0 << endl;
	else {
		int ans = 0;
		int n1 = n;
		while (n1) {
			ans += n1 / 5; n1 /= 5;
		}
		while (n) {
			ans -= (n + 5) / 10;
			n /= 5;
			}
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int submit[] = new int[31];
        int i;
        Arrays.fill(submit,0);
        
        for(i=1; i<=28; i++){
            submit[sc.nextInt()] = 1;
        }

        for(i=1; i<=30; i++){
            if(submit[i] == 0){
                System.out.println(i);
            }
        }

    }
}

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

#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define REP(i,a,b) for (int i = a; i <= b; i++)
using namespace std;
long long maxv = 1e9;

int main()
{
    int n;
    cin>>n;
    int a;
    int ans;
    cin>>ans;
    REP(i,1,n-1){
        cin>>a;
        ans=__gcd(ans,a);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3640
/*************************************************************************
> File Name: test.cpp
> Author: Akira 
> Mail: qaq.febr2.qaq@gmail.com 
************************************************************************/

#include<bits/stdc++.h>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
#define MST(a,b) memset(a,b,sizeof(a))
#define CLR(a) MST(a,0)
#define Sqr(a) ((a)*(a))
#define ALL(a) a.begin(), a.end()
#define mp make_pair
#define pb push_back
using namespace std;

#define MaxN 200005
#define MaxM MaxN*10
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626
const int mod = 1E9+7;
const double eps = 1e-6;
#define bug cout<<88888888<<endl;
#define debug(x) cout << #x" = " << x << endl;
template<typename T> T abs(T val){return val>0?val:-val;}
inline int max2(int a, int b) {return ((a > b)? a : b);}
inline int min2(int a, int b) {return ((a < b)? a : b);}
inline int max3(int a, int b, int c) {return max2(a, max2(b, c));}
inline int min3(int a, int b, int c) {return min2(a, min2(b, c));}
template <class T> inline void read(T &ret) {char c; ret=0;while((c=getchar())<'0'||c>'9');while(c>='0'&&c<='9') ret=ret*10+(c-'0'),c=getchar();}
template <class T> inline void out(T x) {if(x>9) out(x/10);putchar(x%10+'0');}

char str[MaxN];
int loc[MaxN][26], to[26], cost[MaxN];
void solve()
{
	int len = strlen(str);
	for(int i=0;i<26;i++) to[i] = len+1;
	for(int i=len;i>=0;i--)
	{
		memcpy(loc[i], to, sizeof(to));
		to[str[i-1]-'a'] = i;
	}
	for(int i=len;i>=0;i--)
	{
		cost[i] = len+10000;
		for(int j=0;j<26;j++)
		{
			cost[i] = min(cost[i], cost[loc[i][j]]+1);
	
		}
	}
	int u = 0,v;
	while(u!=len+1)
	{
		for(v=0;v<26;v++)
		{
			if(cost[u]==cost[loc[u][v]]+1) break;
		}
		printf("%c", v+'a');
		u = loc[u][v];
	}
	puts("");
}
int main()
{
    //std::ios::sync_with_stdio(false);
	while(~scanf("%s", &str))
	{
		solve();
	}
    //system("pause");
    //printf("%lld\n", ((x)%mod+mod)%mod );
    //printf("\n%.2lf sec \n", (double)clock() / CLOCKS_PER_SEC);
}


Measured memory_bytes: 21504
using System;
using static System.Console;
using static System.Math;
using System.Collections.Generic;


namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var s = ReadLine().Split(' ');
            long x = long.Parse(s[0]);
            long ans = MyMath.Lcm(360, x);
            ans /= x;


            WriteLine(ans);
            Out.Flush();
        }

    }

    public static class MyMath
    {
        public static long Factorical(long n)
        { return n <= 1 ? 1L : n * Factorical(n - 1); }
        public static long Permutation(long n, long m)
        { return m == 0 ? 1L : (m == n) ? Permutation(n, m - 1) : n * Permutation(n - 1, m - 1); }
        public static long Combination(long n, long m)
        { return n - m > m ? Permutation(n, m) / Factorical(m) : Permutation(n, n - m) / Factorical(n - m); }
        public static long Gcd(long n, long m)
        { return n % m == 0 ? m : Gcd(m, n % m); }
        public static long Lcm(long n, long m)
        { return n * m / Gcd(n, m); }
        public static long Pow(long n, long m)
        { return (m == 1 || m == 0) ? 1L : n * Pow(n, m - 1); }
    }
}

Measured memory_bytes: 27532
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  int N;
  ci(N);
  ll a = 1, b = pow(10, 9) + 7;
  repi(i, 1, N + 1){
    a = (a * i) % b;
  }
  co(a);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define int ll
#define MOD (ll)(1e9+7)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,d; cin>>n>>d;
	vector<vector<int>> v(n);
	for(auto &i:v)
	{
		i.resize(d);
		for(auto &j:i) cin>>j;
	}
	int cnt=0;
	For(i,0,n-2)
	{
		For(j,i+1,n-1)
		{
			int dis=0;
			For(k,0,d-1) dis+=pow(v[i][k]-v[j][k],2);
			if(pow(floor(sqrt(dis)),2)==dis) cnt++;
		}
	}
	cout<<cnt<<"\n";
	return 0;
}









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

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

    int l = 0, r = 0;
    rep(i, N) {
        if (S[i] == '(')
            l++;
        else
            l ? l-- : r++;
    }

    rep(i, r) cout << "(";
    cout << S;
    rep(i, l) cout << ")";
    cout << endl;

    return 0;
}

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

void Main()
{
	int N, K, X, Y; cin >> N >> K >> X >> Y;
	int res = min(N, K) * X + (N - K > 0 ? (N - K) * Y : 0);
	cout << res << endl;
}

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


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <utility>
#include <random>
#include <chrono>

using namespace std;

#define ll long long

int a, b, c, d;

int main()
{
    scanf("%d%d%d%d", &a, &b, &c, &d);
    while (1) {
        c -= b;
        if (c <= 0) {
            printf("Yes"); return 0;
        }
        a -= d;
        if (a <= 0) {
            printf("No"); return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3824
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
const int MAX_N = 100;
int A[19];
int B[19];

int bit[MAX_N + 1], n;

int sum(int i) {
    int s = 0;
    while (i > 0) {
        s += bit[i];
        i -= i & -i;
    }
    return s;
}

void add_to(int i, int x) {
    while (i <= n) {
        bit[i] += x;
        i += i & -i;
    }
}

int inversion(vector<int> &in) {
    fill(bit, bit + MAX_N, 0);
    int ret = 0;
    for (int j = 0; j < n ;j++) {
        ret += j - sum(in[j]);
        add_to(in[j], 1);
    }
    return ret;
}

signed main() {
    cin >> n;
    for (int i = 0; i< n; i++) cin >> A[i];
    for (int i = 0; i< n; i++) cin >> B[i];
    int ret = INF;

    // 奇数番目に置く場所のビットを立てる
    for (int mask = 0; mask < (1u << n); mask++) {
        if (__builtin_popcount(mask) != n/2) continue;

        vector<P> odds;
        vector<P> evens;
        for (int i = 0; i < n; i++) {
            if (mask & (1 << i)) odds.emplace_back(i % 2 == 0 ? B[i] : A[i], i);
            else evens.emplace_back(i % 2 == 0 ? A[i] : B[i], i);
        }

        sort(odds.begin(), odds.end());
        sort(evens.begin(), evens.end());

        vector<int> values(n);
        vector<int> idxs(n);
        int ii = 0;
        int jj = 0;
        for (int i = 0; i < n; i++) {
            if (i % 2 == 1) {
                values[i] = odds[ii].first;
                idxs[i] = odds[ii].second + 1;
                ii++;
            } else {
                values[i] = evens[jj].first;
                idxs[i] = evens[jj].second + 1;
                jj++;
            }
        }

        bool valid = true;
        for (int i = 0; i < n-1; i++) {
            if (values[i] > values[i+1]) {
                valid = false;
                break;
            }
        }
        if (!valid) continue;

        int tmp = inversion(idxs);
        ret = min(tmp, ret);
    }

    if (ret == INF) ret = -1;
    cout << ret << endl;
    return 0;
}

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

int main(){
	int x,y,w,h,r;
	while ( cin >> w >> h >> x >> y >> r){
		if ( r <= x && x <= (w-r)){
			if ( r <= y && y <= (h-r)){
				cout << "Yes\n";
			}
			else {
				cout << "No\n";
			}
		}
		else {
			cout << "No\n";
		}
	}
	return 0;
}


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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif

using namespace std;

enum { M = 1, L = 2 };
char output[] = {'I', 'M', 'L', 'U'};
int priority[128];

int parse(int l, int r, const string &expression, int p = 2) {
	for(int i = r - 1; i >= l; --i) {
		if(priority[expression[i]] == p) {
			switch(expression[i]) {
			case '+':
				return parse(l, i, expression, p) + parse(i + 1, r, expression, p);
			case '*':
				return parse(l, i, expression, p) * parse(i + 1, r, expression, p);
			default:
				assert(false);
			}
		}
	}

	return p > 1 ? parse(l, r, expression, p - 1) : stoi(expression.substr(l, r - l));
}

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

	int Bobs_answer;
	string expression;
	cin >> expression >> Bobs_answer;

	int ans = 0;

	priority['+'] = priority['*'] = 2;
	if(parse(0, expression.size(), expression) == Bobs_answer) ans |= L;

	priority['*'] = 1;
	if(parse(0, expression.size(), expression) == Bobs_answer) ans |= M;

	cout << output[ans] << endl;

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1212
#include<iostream>
#include<vector>
#include <cmath>
#include <string>
using namespace std;

int main(void){
    int N,K;
    cin>>N>>K;
    string S;
    cin>>S;
    
    if(S[K-1]=='A'){
         S[K-1]='a';
    }else if (S[K-1]=='B'){
         S[K-1]='b';
    }else{
         S[K-1]='c';

    }
    
    cout<<S<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int MOD = 1e9 + 7;
int main()
{
    ll x;
    cin>>x;
    ll n=0;
    ll p=100;
    while(p<x)
    {
        p=floor(1.01*p);
        n++;
    }
    cout<<n<<endl;
}

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

int main(){
  int N, K;
  
  cin >> N;
  cin >> K;
  
  int m = 1;
  
  for(int i = 0; i < N; i++){
    if(m > K){
      m += K;
    }
    else{
      m *= 2;
    }
  }
  
  cout << m << endl;
  
  return 0;
}

Measured memory_bytes: 256
<?php

$n = fgets(STDIN);
$list = explode(" ",fgets(STDIN));
$mod = 10**9+7;
$result;

for($i=$n-1;$i>0;$i--){
    $total+=$list[$i];
    $total%=$mod;

    $result+=$total*$list[$i-1];
    $result%=$mod;
}

echo $result."\n";


Measured memory_bytes: 32004
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int n;
int a[200000];

int main(int argc, char **argv) {
	cin >> n;
	REP(i, n) cin >> a[i];
	REP(i, n) {
		if (i != 0) cout << ' ';
		if (i < (n + 1) / 2) cout << a[n - 1 - i * 2];
		else cout << a[n % 2 + (i - (n + 1) / 2) * 2];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 2944
s=input()
def dfs(i, f, sum):
    if i == 3:
        if sum == 7:
            # 答えは1つ出力すれば良いので =7 になれば終了
            print(f + "=7")
            exit()
    else:
        # 式 f の末尾に符号と次の数字を追加し、その分 sum に加減する
        dfs(i+1,f+"-"+s[i+1], sum-int(s[i+1]))
        dfs(i+1,f+"+"+s[i+1], sum+int(s[i+1]))
dfs(0, s[0], int(s[0]))

Measured memory_bytes: 9196
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18


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

	vector<int> a(n);

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

	double bunsi = 0;
	for (int i = 0; i < n; i++) {
		bunsi += (double)1 / a[i];
	}

	cout << fixed << setprecision(10) << 1/bunsi << endl;

	return 0;
}

Measured memory_bytes: 256
a=input("")
lista=a.split()
lista2=[]
par=0
impar=-1
contador=0
for i in range (int(lista[0])):
  par+=2
  lista2.append(par)
for i in range (int(lista[1])):
  impar+=2
  lista2.append(impar)
longitud=len(lista2)-1

for i in range (0,len(lista2)):
  b=i
  while True:
    if b+1>longitud:
      break 
    else: 
      suma=lista2[i]+lista2[b+1]
      b=b+1
      if suma%2==0:
        contador+=1
      
print(contador)


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

int main(){
  int N;
  cin >> N;
  if(N/1000==(N%1000-N%100)/100&&(N%100-N%10)/10==(N%1000-N%100)/100){
    cout << "Yes" << endl;
  }
  else if((N%1000-N%100)/100==(N%100-N%10)/10&&(N%100-N%10)/10==N%10){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int a, b, c, x;
int ans=0;
int main() {
    cin >> x;
    for (int i=1; i<=x; i++) {
        for (int j=1; j<=x; j++) {
            for (int k=1; k<=x; k++) {
                ans+=gcd(i, gcd(j, k));
            }
        }
    }
    
    cout << ans;
}

Measured memory_bytes: 3612
#include <iostream>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL<<60;

const int MAX_N = 110;
const int MAX_V = 100100;

// 入力
int N;
long long W, weight[MAX_N], value[MAX_N]; // 品物の個数は 100 個なので少し余裕持たせてサイズ 110 に

// DPテーブル
long long dp[MAX_N][MAX_V];

int main() {
    cin >> N >> W;
    for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];
    
    // 初期化
    for (int i = 0; i < MAX_N; ++i) for (int j = 0; j < MAX_V; ++j) dp[i][j] = INF;
    
    // 初期条件
    dp[0][0] = 0;
    
    // DPループ
    for (int i = 0; i < N; ++i) {
        for (int sum_v = 0; sum_v < MAX_V; ++sum_v) {
            
            // i 番目の品物を選ぶ場合
            if (sum_v + value[i] < MAX_V) chmin(dp[i+1][sum_v + value[i]], dp[i][sum_v] + weight[i]);
            
            // i 番目の品物を選ばない場合
            chmin(dp[i+1][sum_v], dp[i][sum_v]);
        }
    }
    
    // 最適値の出力
    long long res = 0;
    for (int sum_v = 0; sum_v < MAX_V; ++sum_v) {
        if (dp[N][sum_v] <= W) res = sum_v;
    }
    cout << res << endl;
}

Measured memory_bytes: 86272
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define fi first
#define se second
const int N = 3e3+6;
const int mod = 1e9+7;
const int inf = 1e8;
void solve(){
    string s;
    cin>>s ;
    int n = s.size();
    int a= -1;
    int z = -1;
    for(int i=0;i<n;i++){
        if(s[i]=='A' and a==-1)a = i;
        if(s[i]=='Z')z = i;
    }
    cout<<z-a+1<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
//    cin>>t;
    while(t--)solve();
    return 0;
}


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

int main() {
    int A, B, C;
    cin >> A >> B >> C;

    int max = 0;

    if (max <= 10 * A + B + C) max = 10 * A + B + C;
    if (max <= A + 10 * B + C) max = A + 10 * B + C;
    if (max <= A + B + 10 * C) max = A + B + 10 * C;

    cout << max << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

typedef pair<int, int> Pi;

int main(){
  int N;
  cin >> N;
  vector<Pi> P(N);
  rep(i, N) {
    cin >> P[i].first;
    P[i].second = i;
  }
  sort(P.rbegin(), P.rend());
  ll ans = 0;
  multiset<ll> mst{-1, -1, P[0].second, N, N};
  for(int i=1; i<N; i++) {
    auto next = mst.lower_bound(P[i].second);
    auto nxnx = next; nxnx++;
    auto prev = next; prev--;
    auto prpr = prev; prpr--;
    ans += P[i].first*(((*nxnx)-(*next))*(P[i].second-(*prev))+((*prev)-(*prpr))*((*next)-P[i].second));
    mst.insert(P[i].second);
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  int K,X;
  cin>>K>>X;
  for(int i=X-K+1;i<=X+K-1;i++){
    cout<<i;
    if(i==X+K-1)
      cout<<endl;
    else
      cout<<' ';
  }
}

Measured memory_bytes: 256
W,N,v,w,i,m,*p;s(){scanf("%d,%d",&v,&w);}main(n){for(s();W=v;){int c[1001]={0};for(s(),n=v;s(p=c),n--;)for(m=i=W+1;i--;m-=*p++==*c)i<w||*p<p[w]+v&&(*p=p[w]+v);printf("Case %d:\n%d\n%d\n",++N,*c,m);}}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String[] Ss = S.split("");
		int count = 0;

		if(Ss.length == 1) {
			System.out.println(0);
		}else {
			for(int i = 0; i < Ss.length-1 ; i++) {
				if(Ss[i].equals(Ss[i+1])) {
					count++;
					if(Ss[i+1].equals("0")) {
						Ss[i+1] = "1";
					}else {
						Ss[i+1] = "0";
					}
				}
			}
			System.out.println(count);
		}

	}

}


Measured memory_bytes: 46644
n, k = list(map(int, input().split()))
a_list = list(map(int, input().split()))

print(
  n - \
    max(
      [a_2 - a_1 \
          for a_1, a_2 in \
          zip(
            a_list[:-1], 
            a_list[1:]
          )
      ] + \
      [n - a_list[-1] + a_list[0]]
    )
)

Measured memory_bytes: 25840
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;
    static CF_Reader in;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        in = new CF_Reader();

        int a = in.intNext(), b = in.intNext(), c = in.intNext(), k = in.intNext();
        int total = Math.min(a, k);
        if (k > a + b) total -= k - (a + b);
        out.println(total);
        
        out.close();
    }

    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        public int[] nextIntArray(final int n) throws IOException {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = intNext();
            return a;
        }

        public long[] nextLongArray(final int n) throws IOException {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = longNext();
            return a;
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}


Measured memory_bytes: 32932
#include"bits/stdc++.h"
using namespace std;
#define Max 24*60+60+1
int main() {
	int n, m, n2[101], m2[101];
	cin >> n;
	for (int i = 0; i < 100; i++)n2[i] = Max;
	for (int i = 0; i < n; i++) {
		int h, m;
		cin >> h >> m;
		n2[i] = h * 60 + m;
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		int k, g;
		cin >> k >> g;
		m2[i] = k * 60 + g;
	}
	for (int i = n; i < m + n; i++) {
		n2[i] = m2[i - n];
	}
	sort(n2, n2 + (m+n));
	int suu = 0;
	for (int i = 0; i < m + n; i++) {
		if (n2[i] == n2[i + 1]) {
			for (int j = i+1; n2[i] == n2[j] && n2[j] != Max; j++) {
				i++;
			}
		}
		if (i != m + n - 1) {
			printf("%d:%02d ", n2[i] / 60, n2[i] % 60);
		}
		else printf("%d:%02d\n", n2[i] / 60, n2[i] % 60);
	}
}

Measured memory_bytes: 3244
S = input()[::-1]
Tl = ["dream", 'dreamer', 'erase', 'eraser']
flg = 0

for i in range(len(Tl)):
    Tl[i] = Tl[i][::-1]
while True:
    Sl = len(S)
    for i in range(len(Tl)):
        if S.find(Tl[i]) == 0:
            S = S[len(Tl[i]):]
    if len(S) == 0:
        flg = 1
        break
    elif len(S) == Sl:
        break
    else:
        pass

if flg == 1:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3188
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream> // cout, endl, cin
#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

using namespace std;

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

	vector<int> X;
	
	while (N > 0) {
		long long Xi;
		Xi = N % 26;
		if (Xi == 0) X.push_back(26);
		else X.push_back(Xi);
		N = (N - 1) / 26;
	}
	reverse(X.begin(), X.end());

	for (auto i = 0; i < X.size(); i++) {
		char C = (char)('a' + X.at(i) - 1);
		cout << C;
	}
	cout << endl;
}

Measured memory_bytes: 3604
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""

# 最大公約数 と 最小公倍数
"""def gcd(a,b):
  if b == 0:
    return a
  return gcd(b, a % b)
def lcm(a,b):
  g = gcd(a,b)
  return (a * b) // g"""

# 二分探索
"""import bisect # 二分探索
print(A,bisect.bisect_left(A,4))
print(C,n - bisect.bisect_right(C,4))
print(sum(bisect.bisect_left(A,b) * (n-bisect.bisect_right(C,b)) for b in B))"""

# 円周率 pi
"""import math
pi_ = math.pi"""

# エラトステネスの篩
"""def Erato(n):
    prime = []
    is_prime = [True] * (n+1)
    p = 0
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,n+1):
      if is_prime[i] == True:
        prime.append(i)
        p += 1
        for j in range(2 * i,n+1,i):
          is_prime[j] = False
    return p"""

def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7
def main():
  n = int(input())
  s = input()
  t = s.count('R')*s.count('G')*s.count('B')
  for i in range(n):
    j = 1
    while i+j*2<n:
      # print(s[i],s[i+j],s[i+2*j])
      # R R G
	  # R G B こいつがあかん
      if s[i]!= s[i+j] and s[i+j]!=s[i+j*2] and s[i] != s[i+j*2]:
        t-=1
      j+=1
  print(t)

  

if __name__ == '__main__':
  main()


Measured memory_bytes: 9288
#include<iostream>
#include<math.h>
using namespace std;

int main() {
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) {
        int res=0;
        int m=sqrt(i)+1;
        for(int a=1;a<=m;a++)
        for(int b=1;b<=m;b++)
        for(int c=1;c<=m;c++)
        if(a*a+b*b+c*c+a*b+b*c+c*a==i) res++;
        printf("%d\n",res);
    }
    return 0;
}

Measured memory_bytes: 3228
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program {
    static void Main() {
        var x = NextInt();
        var y = NextInt();
        var ans = int.MaxValue;

        foreach (var i in Enumerable.Range(0, 4)) {
            ans = Math.Min(ans, solve(i, x, y));
        }
        WriteLine(ans);
    }

    static int solve(int i, int x, int y) {
        var t = 0;

        if (i % 2 > 0) {
            x *= -1;
            t++;
        }
        if (i / 2 > 0) {
            y *= -1;
            t++;
        }
        if (x <= y) {
            t += y - x;
            return t;
        }
        return int.MaxValue;
    }

    static int NextInt() {
        return int.Parse(NextString());
    }

    static string NextString() {
        var result = new List<char>();
        while (true) {
            int next = Read();
            if (next < 0)
                break;
            var nextChar = (char)next;
            if (!char.IsWhiteSpace(nextChar))
                result.Add(nextChar);
            else if (nextChar != '\r')
                break;
        }
        return string.Join("", result);
    }
}

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

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

    int hour, min, sec;
    hour = s / 60 / 60;
    min = (s - (hour*60*60)) / 60;
    sec = s - (hour*60*60) - (min*60);

    cout << hour << ":" << min << ":" << sec << endl;
}


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


int main()
{
  int N, T, A;
  
  cin >> N >> T >> A;
  
  int ans;
  double t = 1000;
  for (int i = 0; i < N; i++)
  {
    int x;
    cin >> x;

    if (t > abs(A - (T - x * 0.006)))
    {
      t = abs(A - (T - x * 0.006));
      ans = i+1;
    }
    
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var a, b, cnt int
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &a, &b)

	cnt = a * 4
	if b/a >= 2 && cnt >= b && b%2 == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1828
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1000000000000;

ll N, K;
vector<ll> a, b, c;
vector<vector<ll>> dp;

void solve() {
  dp.resize(N, vector<ll>(3, 0));
  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];
  for (int i = 1; i < N; i++) {
    dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]);
    dp[i][1] = max(dp[i - 1][0] + b[i], dp[i - 1][2] + b[i]);
    dp[i][2] = max(dp[i - 1][0] + c[i], dp[i - 1][1] + c[i]);
  }
  cout << max(dp[N - 1][0], max(dp[N - 1][1], dp[N - 1][2])) << "\n";
}

int main() {
  cin >> N;
  a.resize(N);
  b.resize(N);
  c.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  solve();
  return 0;
}

Measured memory_bytes: 8064
using System;

namespace AtCoderABC128C
{
    class Program
    {
        static void Main(string[] args)
        {
            int ans = 0;

            string[] s = Console.ReadLine().Split(' ');

            int N = int.Parse(s[0]); //Switch
            int M = int.Parse(s[1]); //Lamp

            int[][] X = new int[M][]; //Lamp毎のSwitch
            bool[] sw = new bool[N];  //Swichのオンオフ

            for (int i = 0; i < M; i++)
            {
                s = Console.ReadLine().Split(' ');

                X[i] = new int[int.Parse(s[0])];

                for (int j = 0; j < X[i].Length; j++)
                {
                    X[i][j] = int.Parse(s[j+1]) -1;
                }
            }

            s = Console.ReadLine().Split(' ');
            int[] lt = new int[M];

            for (int i = 0; i < M; i++)
            {
                lt[i] = int.Parse(s[i]);
            }

            do
            {
                bool temp = true;

                for (int i = 0; i < M; i++)
                {
                    int count = 0;

                    for (int j = 0; j < X[i].Length; j++)
                    {
                        if (sw[X[i][j]])
                            count++;
                    }

                    if (count % 2 != lt[i])
                    {
                        temp = false;
                        break;
                    }
                }

                if (temp)
                    ans++;

            } while ((sw = nextsw(sw)) != null);

            Console.WriteLine(ans.ToString());
        }

        static bool[] nextsw(bool[] sw)
        {
            for (int i = 0; i < sw.Length; i++)
            {
                if (!sw[i])
                {
                    sw[i] = true;
                    for (int j = 0; j < i; j++)
                    {
                        sw[j] = false;
                    }

                    return sw;
                }
            }

            return null;
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <stdio.h>
using namespace std;


void insertionSort(int a[], int n) // 
{
	int i, j;
	for(i = 1; i<n ; i++){
		int temp= a[i];
		j=i-1;
		while ( j>= 0 &&  a[j] > temp){
			a[j+1] = a[j];
			j--;			//j??????1????????????
		}
		a[j+1] = temp;
		for(int i=0; i< n ; i++){
		    cout << a[i];
		    if(i < (n-1)){
			    cout<<" ";
		    }
    	}
	cout << endl;   
	}
}
	
	
int main(void)
{
	int n;
	int a[1000]={0};

	cin >> n ;
	for(int i=0; i<n ; i++){
		cin >> a[i];
	}
	for(int i=0; i< n ; i++){
		cout << a[i];
		if(i < (n-1)){
			cout<<" ";
		}
	}
	printf("\n");
	
	insertionSort(a,n);

	
	return 0;
}

Measured memory_bytes: 1168
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
    int n;
    while(scanf("%d", &n) != EOF){
        int cnt = 0;
        for(int i=0; i<10; i++){
            for(int j=0; j<10; j++){
                for(int k=0; k<10; k++){
                    for(int l=0; l<10; l++){
                        if(i+j+k+l == n) cnt++;
                    }
                }
            }
        }
    cout << cnt <<endl;
    }
}

Measured memory_bytes: 1208
n,q = map(int,input().split())
pro = []
for _ in range(n):
    x = input().split()
    pro.append([x[0],int(x[1])])
curti = 0

while len(pro)>0:
    curpro = pro.pop(0)
    if curpro[1]>q:
        curpro[1] -= q
        curti += q
        pro.append(curpro)
    else:
        curti += curpro[1]
        print(curpro[0],curti)


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

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pi;
typedef long double ld;
typedef pair<long double, long double> pld;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll i, j, k;

    ll N;
    cin >> N;
    vll A(N);
    for(auto &e : A)
        cin >> e;

    ll ans = 0;
    for(i = 1; i < N; i++) {
        if(A[i - 1] > A[i]) {
            ans += A[i - 1] - A[i];
            A[i] = A[i - 1];
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
    int n, m, i, j, k, l, f = 0;
    cin >> n >> m;
    char a[n][n], b[m][m];
    for(i=0; i<n; i++){
        for(j=0; j<n; j++){
            cin >> a[i][j];
        }
    }
    for(i=0; i<m; i++){
        for(j=0; j<m; j++){
            cin >> b[i][j];
        }
    }
    for(i=0; i<n-m+1; i++){
        for(j=0; j<n-m+1; j++){
            f = 0;
            for(k=0; k<m; k++){
                for(l=0; l<m; l++){
                    if(a[i+k][j+l] != b[k][l]){
                        f = 1;
                        break;
                    }
                    if(k == m-1 && l == m-1){
                        cout << "Yes";
                        return 0;
                    }
                }
                if(f == 1) break;
            }
        }
    }
    cout << "No";
    return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int N, M, C;
    cin >> N >> M >> C;
    int B[25];
    REP(i,M) cin >> B[i];
    int S[25];
    int count = 0;
    REP(i,N){
        S[i] = C;
        REP(j,M){
            int a;
            cin >> a;
            S[i] += a * B[j];
        }
        if(S[i] > 0) count++;
    } 
    cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,d;
    cin>>n>>d;
    int count=0;
    for(int i=0;i<n;i++)
    {
        long long x,y;
        cin>>x>>y;
        double temp=(double)sqrt((x*x)+(y*y));
        if(temp<=d)
           count++;
    }
    cout<<count<<"\n";
    return 0;
}

Measured memory_bytes: 3568
import math
N, K = map(int, input().split())
A = sorted(map(int, input().split()))
F = sorted(map(int, input().split()), reverse=True)

def count(mid):
    res = 0
    for a, f in zip(A, F):
        t = (a*f - mid)
        if t < 0: continue
        res += int(math.ceil(t/f))
    return res
  
start, end = 0, max(a*f for a, f in zip(A, F))
while start + 1 < end:
    mid = (start + end)//2
    if count(mid) <= K:
        end = mid
    else:
        start = mid
if count(start) <= K:
    print(start)
else:
    print(end)

Measured memory_bytes: 119628
# https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_c
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    k, a, b = input_int_list()
    if b - a <= 2:  # 2ターン 使って、作れるビスケットが2個以下だと最大化しない。
        ans = k + 1
    else:
        exchange, mod = divmod((k - (a - 1)), 2)
        ans = a
        ans += exchange * (b - a)
        ans += mod
    print(ans)

    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 61676
#pragma GCC optimize(2) //O2优化？

#include<bits/stdc++.h>
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define BINF 0x7fffffff
#define INF 0x3f3f3f3f
#define LINF 9223372036854775807
#define END(s) {cout<<s;return 0;}
#define CON(s) {cout<<s;continue;}
#define BRE(s) {cout<<s;break;}
#define pb push_back
#define All(a) a.begin(),a.end()  //with A in CAPITAL!!!
#define sz(a) (int)a.size()
#define F first
#define S second
#define LOCAL_JUDGE 1 //remember to change
using namespace std;

int row,col;
char in[15][15],c[15];
bool g[15][15];
bool gr[15][15];
string s[15];
int a[15];
bool dfs2(int now,int mask){
	if(now==-1){
		return true;
	}
	int u=col-1-now;
	if(u==now){
		for(int i=0;i<col;i++)
			if(dfs2(now-1,mask|(1<<i))) return true;
	}else{
		int t=0;
		while(mask&(1<<t)) t++;
		mask|=1<<t;
		for(int j=0;j<col;j++)
			if((mask&(1<<j))==0 && g[t][j]){
				if(dfs2(now-1,mask|(1<<j)))
					return true;
			}
	}
	return false;
}
bool dfs(int now,int mask){
	if(now==-1){
		rep(i,col)
			rep(j,col){
				bool flag=true;
				rep(k,row) 
					if(in[a[k]][i]!=in[a[row-k-1]][j]){
						flag=false;
						break;
					}
				g[i][j]=flag;
			}
		return dfs2((col-1)/2,0);
	}
	int u=row-1-now;
	if(now==u){
		rep(i,row){
			a[now]=i;
			if(dfs(now-1,mask|(1<<i))) return true;
		}
	}else{
		int t=0;
		while(mask&(1<<t)) t++;
		a[now]=t;
		mask|=1<<t;
		rep(i,row)
			if((mask&(1<<i))==0 && gr[t][i]){
				a[u]=i;
				if(dfs(now-1,mask|(1<<i)))
					return true;
			}
	}
	return false;
}
int main(){
	//ios::sync_with_stdio(false);
	cin>>row>>col;
	rep(i,row)
		scanf("%s",in[i]);
	rep(i,row){
		rep(j,col) c[j]=in[i][j];
		sort(c,c+col);
		s[i]="";
		rep(j,col) s[i]+=c[j];
	}
	rep(i,row) rep(j,row) gr[i][j]=(s[i]==s[j]);
	if(dfs((row-1)/2,0)) END("YES\n")
	cout<<"NO\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
void solve()
{
int n,d;
  cin>>n>>d;
  int a[n][d];
  for(int i=0; i<n; i++){
  for(int j=0; j<d; j++){
  cin>>a[i][j];
  }
  }
int total=0;
  float ans;
  for(int i1=0; i1<n; i1++){
  for(int i2=i1+1; i2<n; i2++){
    ans=0;
    for(int j1=0; j1<d; j1++){
  ans+=pow(abs(a[i1][j1]-a[i2][j1]),2);
  }
      int k=sqrt(ans);
    if(k==sqrt(ans)){total++;}
    
    
  }
  }
cout<<total;
}
 

int main()
{
solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define Size 10000000
#define ll long long int
#define Sort(x) sort(x.begin(),x.end())
#define fr(x) for(long long i=0;i<x;i++)
#define rep(i,a,b) for (ll i = a; i <= b; ++i)
#define debug(x) cout<<x<<"\n"
#define dec(i,a,b) for (ll i = a; i >= b; --i)
#define pb push_back
#define in(x) cin>>x


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


    ll N,X,T,ans=0;
    cin>>N>>X>>T;
    if(N%X!=0){
        ans=N/X+1;
    }
    else ans=N/X;
    debug(T*ans);

}




Measured memory_bytes: 3688
#include<cstdio>
#include<algorithm>

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

using namespace std;

struct bar{
	int a,h;
	bool operator<(const bar &B)const{ return h<B.h; }
};

int main(){
	for(int n,m,h,k;scanf("%d%d%d%d",&n,&m,&h,&k),n;){
		int sc[1000];
		rep(i,n) scanf("%d",sc+i);
		bar B[100000];
		rep(i,m) scanf("%d%d",&B[i].a,&B[i].h), B[i].a--;
		sort(B,B+m);

		int p1[1000],p2[1000],q1[1000],q2[1000];
		rep(i,n) p1[i]=p2[i]=q1[i]=q2[i]=i;
		rep(i,m){
			int a=B[i].a,b=a+1;
			swap(q2[p2[a]],q2[p2[b]]);
			swap(p2[a],p2[b]);
		}

		int sum=0;
		rep(i,k) sum+=sc[q2[q1[i]]];
		int ans=sum;
		rep(i,m){
			int a=B[i].a,b=a+1;

			int sum2=sum;
			if(p1[a]<k) sum2=sum2-sc[q2[a]]+sc[q2[b]];
			if(p1[b]<k) sum2=sum2-sc[q2[b]]+sc[q2[a]];
			ans=min(ans,sum2);

			swap(p2[q2[a]],p2[q2[b]]);
			swap(q2[a],q2[b]);
			swap(q1[p1[a]],q1[p1[b]]);
			swap(p1[a],p1[b]);
		}

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

	return 0;
}

Measured memory_bytes: 1564
import java.util.Scanner;

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

		long n = stdIn.nextLong();
		stdIn.close();
		long money = 100;

		long year = 0;
		while (true) {
			year++;
			money = (long) (1.01 * (double)money);

			if(money >= n) {
				break;
			}
		}

		System.out.println(year);

	}
}


Measured memory_bytes: 35760
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll t, n;std::cin >> n;
  vll a(n);
  re(i, n) std::cin >> a[i];
  multiset<ll> s;
  re(i, n){
    std::cin >> t;
    s.insert(a[i]-t);
  }

  //for(auto itr=s.begin();itr!=s.end();itr++) std::cout << *itr << " ";
  //std::cout << '\n';
  while(*s.begin()<0){
    ll tmp = abs(*s.begin());
    s.erase(s.begin());
    s.insert(tmp%2);
    tmp = (tmp%2==1?tmp/2+1:tmp/2);
    //std::cout << "tmp" << tmp << '\n';
    while(tmp>0){
      ll k = *(--s.end());
      if(k<=0) {
        k-=tmp;
        tmp = 0;
        s.erase(--s.end());
        s.insert(k);
      }else if(k<tmp){
        tmp -= k;
        k = 0;
        s.erase(--s.end());
        s.insert(0);
      }else{
        k -= tmp;
        tmp = 0;
        s.erase(--s.end());
        s.insert(k);
      }
    }
    //for(auto itr=s.begin();itr!=s.end();itr++) std::cout << *itr << " ";
    //std::cout << '\n';
  }
  if(s.count(0)==n) std::cout << "Yes" << '\n';
  else std::cout << "No" << '\n';
  return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
#include <stack>
#include <string>
#include <list>
#include <set>
#include <queue>
#include <deque>
#include <math.h>
#include <string.h>
using namespace std;

//typedef pair<int, int> P;
#define ll long long
#define int ll
#define INF (1LL<<60)
#define mod 1000000007


int H, W, K;
int dp[123][8];
int f[] = { 1,2, 3, 5, 8, 13, 21 };

signed main(){

	cin >> H >> W >> K;

	dp[0][0] = 1;
	for (int h = 0; h < H; h++){
		for (int k = 0; k < W; k++){
			int tmp = 0;
			tmp += dp[h][k] * f[max(0LL, k - 1)] * f[max(0LL, W - k - 2)];
			tmp %= mod;
			if (k >= 1){
				tmp += dp[h][k - 1] * f[max(0LL, k - 2)] * f[max(0LL, W - k - 2)];
				tmp %= mod;
			}
			if (k <= W - 2){
				tmp += dp[h][k + 1] * f[max(0LL, k - 1)] * f[max(0LL, W - k - 3)];
				tmp %= mod;
			}

			dp[h + 1][k] = tmp % mod;

//			cout << h + 1 << " " << k << " " << dp[h + 1][k] << endl;
		}
	}

	cout << dp[H][K-1] << endl;


	return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		while(scan.hasNext()){
			out.println(gcd(si(),si()));
		}
		out.flush();
	}

	static int gcd(int a, int b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

	static int si() {
		return Integer.parseInt(scan.next());
	}
}

Measured memory_bytes: 17164