akhauriyash/Code-Regression huggingface dataset:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    T1, T2 = map(int, input().split())
    A1, A2 = map(int, input().split())
    B1, B2 = map(int, input().split())

    P = (A1 - B1) * T1
    Q = (A2 - B2) * T2
    if P > 0:
        P *= -1
        Q *= -1

    if P + Q < 0:
        print(0)
    elif P + Q == 0:
        print("infinity")
    else:
        S = (-P) // (P + Q)
        T = (-P) % (P + Q)
        if T != 0:
            print(S * 2 + 1)
        else:
            print(S * 2)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9216
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	string s;
	cin >> s >> s;
		
	cout << "A" << s[0] << "C" << endl;
	
	return 0;
}

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

using namespace std;


#ifdef zxc

#include <sys/resource.h>
#include "debug.h"
#include "profile.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define profile(X) LOG_DURATION(X)
#else
#define debug(...) 42
#define profile(...) 42
#endif

using ll = int64_t;
using ld = double;
const ld EPS = 1e-9;
//const ll MOD = 924844033;
const ld PI = 3.141592653589793;
const int maxn = 600001;
const int MOD = 1e9 + 7;
using cd = complex<double>;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

signed main() {
#ifdef zxc
    struct rlimit rl;
    const rlim_t kStackSize = 512L * 1024L * 1024L;
    assert(!getrlimit(RLIMIT_STACK, &rl));
    rl.rlim_cur = kStackSize;
    assert(!setrlimit(RLIMIT_STACK, &rl));
    freopen("../input.txt", "r", stdin);
//    freopen("../kolya_output.txt", "w", stdout);
#else
    //    mt19937 mt(std::chrono::high_resolution_clock::now().time_since_epoch().count());
    //            freopen("", "r", stdin);
    //        freopen("hack.out", "w", stdout);
#endif
    profile("all");

    auto solve = [](int _) {
        ll n;
        cin >> n;
        vector<ll> a(n);
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
        }
        ll sum = 0;
        set<int> ost;
        vector<ll> xx(n);

        for (int i = 0; i < n; ++i) {
            xx[i] = a[i] - a[(i - 1 + n) % n];
            sum += xx[i];
            ost.insert((xx[i] % n + n) % n);
        }
        ll max_el = *max_element(xx.begin(), xx.end());
        if (sum != 0 || ost.size() > 1) {
            cout << "NO";
            return;
        }
        vector<ll> cnt(n);
        for (int i = 0; i < n; ++i) {
            cnt[i] = (max_el - xx[i]) / n;
        }
        ll z = 0;
        ll ss = 0;
        for (int i = 0; i < n; ++i) {
            z += cnt[(n - i) % n] * (i + 1);
            ss += cnt[i];
        }

        for (int i = 0; i < n; ++i) {
            a[i] -= z;
            z += ss;
            z -= n * cnt[(i + 1) % n];
        }
        for (int i = 0; i + 1 < n; ++i) {
            if (a[i] != a[i + 1]) {
                cout << "NO";
                return;
            }
        }
        for (int i = 0; i < n; ++i) {
            if (a[i] < 0 || a[i] % (n * (n + 1) / 2)) {
                cout << "NO";
                return;
            }
        }
        cout << "YES";
    };


    fast_io();
    cout.precision(9);
    cout << fixed;

    solve(1);


}


Measured memory_bytes: 4736
S = input()
l = len(S)
import sys
a = S[:(l-1)//2]
b = S[((l+3)//2)-1:l]

for i in range(len(a)//2):
    if str(a[i])==str(a[-i-1]):
        pass
    else:
        print('No')
        sys.exit(0)


for j in range(len(b)//2):

    if b[j]==b[-j-1]:
        pass
    else:
        print('No')
        sys.exit(0)


for k in range(l//2):
    if S[k] == S[-k-1]:
        pass
    else:
        print('No')
        sys.exit(0)

print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  int n;
  cin >> n;
  vector<int> c(n-1),s(n-1),f(n-1);
  rep(i,n-1){
    cin >> c.at(i) >> s.at(i) >> f.at(i);
  }
  int i,j;
  rep(i,n-1){
    int ans=c.at(i)+s.at(i);
    for(j=i+1;j<n-1;j++){
      if(ans<=s.at(j)){
        ans=s.at(j)+c.at(j);
      }else{
        int p=(ans-s.at(j))%f.at(j);
        if(p==0){
          p=f.at(j);
        }
        ans=ans+(f.at(j)-p)+c.at(j);
      }
    }
    cout << ans << endl;
  }
  cout << 0;
}
    

Measured memory_bytes: 3624
#include<stdio.h>
main(void){
	int num[3]={0},i,a=0;
	for(i=0;i<3;i++){
		scanf("%d",&num[i]);
	}
	for(i=0;i<3;i++){
		if(num[0]>num[1]){
			a=num[0];
			num[0]=num[1];
			num[1]=a;
		}
		if(num[1]>num[2]){
			a=num[1];
			num[1]=num[2];
			num[2]=a;
		}
	}
	printf("%d %d %d\n",num[0],num[1],num[2]);
	return 0;
}

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

using ll = long long;
using namespace std;

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

int main(void) {
	int r;
	cin >> r;
	printf("%.12f\n", 2 * 4 * atan(1.0) * r);
	
	return 0;
}


Measured memory_bytes: 3752
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] strArr = br.readLine().split(" ");
		long a = Long.valueOf(strArr[0]);
		long b = Long.valueOf(strArr[1]);
		System.out.println(gcd(a, b));
 	}
	
	private static long gcd(long a, long b){
		long r = a % b;
		if(r == 0)
			return b;
		else
			return gcd(b, a % b);
	}
}

Measured memory_bytes: 16896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ll n,k;
	cin>>k>>n;
	ll a[n];
	for(ll i=0;i<n;i++)
	cin>>a[i];
	sort(a,a+n);
	ll sd=a[n-1]-a[0];
	for(ll i=1;i<n;i++)
	{
	    ll t=(k-a[i])+a[i-1];
	    if(t<sd)
	    sd=t;
	}
	cout<<sd;
	return 0;
}


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

#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()

typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie();
	int d, t, s;
	cin >> d >> t >> s;
	if (d <= s * t) cout << "Yes";
	else cout << "No";
	return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>

using namespace std;
using int64 = long long;

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

    double at = h * 30.0 + 30.0 * ((double)m/60.0);
    double bt = m * 6;

    double theta = abs(at-bt);
    double ans = a*a + b*b - 2.0*a*b*cos(theta*acos(-1.0)/180.0);
    ans = sqrt(ans);

    printf("%.20f\n", ans);
}


Measured memory_bytes: 3668
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	while (1) {
		auto n = readln.chomp.to!int;
    if (!n) break;
    int res[7];
    foreach (_; 0..n) {
      auto x = readln.chomp.to!int;
      res[x / 10 > 6 ? 6 : x / 10]++;
    }
    foreach (i; 0..7) {
      res[i].writeln;
    }
	}
}

Measured memory_bytes: 2020
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <tuple>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rep1(i, n) for(int i=1; i<=n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
#define countof(array) (sizeof(array) / sizeof(array[0]))
typedef long long ll;

#define MAX_N 100000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string ab = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string as = {"abcdefghijklmnopqrstuvwxyz"};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

void yes() {
  cout << "Yes" << endl;
}

void no() {
  cout << "No" << endl;
}

void print_array(int array[], int len) {

  for(int i=0; i<len; ++i) {
    cout << array[i] << endl;
  }

}

ll absolute(ll x) {
  return (x<0)? (-1)*x : x;
}

//g++ AtCoder.cpp -o AtCoder
//AtCoder

//--------------------------
//提出するときC++に帰る
//--------------------------

int main() {

  int n, q;
  cin >> n;
  vector<int> s(n);
  rep(i, n) cin >> s[i];
  cin >> q;
  vector<int> t(q);
  rep(i, q) cin >> t[i];

  int ans = 0;
  rep(i, q) {
    if(*lower_bound(s.begin(), s.end(), t[i])==t[i]) ++ans;
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3376
using System;
public class Hello{
    public static void Main(){
      int n=int.Parse(Console.ReadLine());
      char[] s = new char[n];
      var line = Console.ReadLine();
      for(int i=0;i<n;i++){
       s[i]=char.Parse(line.Split()[i]); 
      }
      int ans=0;
      bool[] flag = new bool[4];
      for(int i=0;i<n;i++){
        if(s[i]=='P')flag[0]=true;
        else if(s[i]=='W')flag[1]=true;
        else if(s[i]=='G')flag[2]=true;
        else flag[3]=true;
      }
      for(int i=0;i<4;i++){
       if(flag[i])ans++; 
      }
      if(ans==3){
       Console.WriteLine("Three"); 
      }
      else Console.WriteLine("Four");
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

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

ll lcm(ll x, ll y) {
    return x / gcd(x,y) * y;
}

int main(void)
{
    IOS
    int N, K;
    cin >> N >> K;
    vector<int> v(N);
    cin >> v[0];
    int g = v[0];
    REP(i,N-1) {
        cin >> v[i+1];
        g = gcd(g,v[i+1]);
    }
    sort(ALL(v));
    bool ans = false;
    REP(i,N) {
        if (v[i] < K) continue;
        if ((K-v[i]) % g == 0) {
            ans = true;
            break;
        }
    }

    if (ans) OUT("POSSIBLE")
    else OUT("IMPOSSIBLE")



    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
    double w, h, x, y;
    cin >> w >> h >> x >> y;
    double surface = w * h;
    cout << surface/2 << " " ;
    if (w==2*x && h==2*y) cout << 1;
    else cout << 0;

    return 0;
}


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

int main() {
    int n,a,b;
    cin>>n>>a>>b;
   
    int ans=0;
    
    rep(i,n){
        int s;
        s=i%10+(i/10)%10+(i/100)%10+(i/1000)%10+(i/10000)%10;
        if(s>=a && s<=b)ans+=i;
    }
    cout<<ans;
    
    return 0;
    }



Measured memory_bytes: 3584
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<ll> > mat;

int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  int k;
  cin >> k;
  for (int i = 0; i < n; i++)
  {
    cout << (s[i] == s[k - 1] ? s[i] : '*');
  }
  cout << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define sc second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;
 
#define Pr(f,...) fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)
 
typedef long long ll;
 
template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}
 
/*
const int N=,P=;
 
int mul(int a,int b){ return 1ll*a*b%P; }
int add(int a,int b){ a+=b; return a>=P?a-P:a; }
int sub(int a,int b){ a-=b; return a<0?a+P:a; }
int gcd(int a,int b){ return !b?a:gcd(b,a%b); }
*/
 
const int N=5e5+50;
int n;
typedef pair<int,int> pii;
pii a[N],c[N];
ll ans;
ll L(int a,int b){ return max(b-a+1,0); }
int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	//freopen("d.in","r",stdin);
#endif
	scanf("%d",&n);
	rep(i,1,n)scanf("%d%d",&a[i].fi,&a[i].sc);
	sort(a+1,a+n+1,[](pii a,pii b){return a.sc==b.sc?a.fi<b.fi:a.sc<b.sc; });
	sort(a+2,a+n+1,[](pii a,pii b){return a.fi==b.fi?a.sc<b.sc:a.fi<b.fi; });
	c[n]=a[n];
	dec(i,n-1,2){
		c[i].fi=max(a[i].fi,c[i+1].fi);
		c[i].sc=min(a[i].sc,c[i+1].sc);
	}
	//ans=L(c[2].fi,c[2].sc)+L(a[1].fi,a[1].sc);
	ll lmax=0;
	rep(i,2,n){
		ans=max(ans,L(c[i].fi,c[i].sc)+L(max(a[i-1].fi,a[1].fi),a[1].sc));
		//Pr("%d,%d---%d,%d\n",c[i].fi,c[i].sc,a[i-1].fi,a[1].sc);
		cmax(lmax,L(a[i].fi,a[i].sc));
	}
	ans=max(ans,lmax+L(max(a[n].fi,a[1].fi),a[1].sc));
	printf("%lld\n",ans);
	return 0;
}



Measured memory_bytes: 5120
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <cstring>
#include <map>
#include <unordered_map>
#include <tuple>
 
using namespace std;
 
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define umap unordered_map
#define uset unordered_set
#define cina(s, n, a) for(int i = s; i < n; i++) cin >> a[i]
#define couta(s, n, a) for(int i = s; i < n; i++) cout << a[i] << ' '
#define copy(s, n, a, b) for(int i = s; i < n; i++) b[i] = a[i]
#define yesno(ok) cout << (ok ? "YES\n" : "NO\n")
#define mod(a, b) (b + (a % b)) % b
#define MOD (int)1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

void add_self (int& a, int b){ a += b; if (a >= MOD) a -= MOD; }
//-------------------------------------------------------------------------------------------------------//

void solve(){
    int x, a;
    cin >> x >> a;
    if(x < a) cout << 0;
    else cout << 10;
}

int main(){
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int q = 1;
    //cin >> q;
    for(int i = 1; i <= q; i++){
        solve();
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#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)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

#define dis(a,b) min(abs(b-a), d-abs(b-a))

int main() {
  int d;
  while(cin >> d,d) {
    int n,m;
    cin >> n >> m;
    vector<int> v(n);
    REP(i,n-1)
      cin >> v[i];
    v[n-1] = 0;
    sort(ALL(v));
    int res = 0;
    while(m--) {
      int a;
      cin >> a;
      int hoge = INF;
      vector<int>::iterator it = lower_bound(ALL(v), a);
      if (it != v.end())
        hoge = min(hoge, dis(*it, a));
      else
        hoge = min(hoge, dis(v[0], a));
      if (v.size() > 1) {
        it--;
        hoge = min(hoge, dis(*it,a));
      }
      
//      cout << hoge << endl;
      res += hoge;
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 1332
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i,n) cin >> l[i];
  sort(all(l));
  ll ans=0;
  rep(i,n){
    for(int j=i+1; j<n; j++){
      //a<b+cでb,c固定
      //k:aの動ける範囲の右端
      int k=lower_bound(l.begin(),l.end(),l[i]+l[j])-l.begin();
      ans+=max(k-(j+1),0);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n, a, b;
long long s;
int main()
{
	cin>>n;
	for(a=1; a<=n/2; a++)
	{
		for(b=a; b<=n/a; b++)
		{
			if(a*b<n)
			{
				s++;
				if(a!=b)
				{
					s++;
				}
			}
			else
			{
				break;
			}
		}
	}
	cout<<s;
	return 0;
}

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

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

int main()
{
    string a, b;
    cin >> a >> b;
    float num = atoi((a + b).c_str());
    num = powf(num, 0.5);
    bool flag = (floor(num) == num);
    cout << (flag ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

int main(){
    int n,a,b;
    cin>>n>>a>>b;
    if(a>b){
        cout<<b<<" ";
    }else{
        cout<<a<<" ";
    }
    if(n>a+b){
        cout<<0;
    }else{
        cout<<a+b-n;
    }
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let mut a: Vec<i32> = (0..3).map({|_| read()}).collect();
    a.sort();
    println!("{}", a[0] + a[1] + a[2] * 10);
}


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

int main () {
    string str, op, p, tmp;
    int q, n1, n2, size;

    cin >> str;
    cin >> q;

    for ( int i = 0; i < q; i++ ) {
        cin >> op >> n1 >> n2;
        if ( op == "print" ) {
            cout << str.substr( n1, n2 - n1 + 1 ) << endl;
        } else if ( op == "reverse" ) {
            tmp = str.substr( n1, n2 - n1 + 1 );
            // cout << "Debug : " << tmp << endl;
            size = tmp.size();
            for ( int j = 0; j < size; j++ ) {
                str[j + n1] = tmp[size - j - 1];
            }
        } else if ( op == "replace" ) {
            cin >> p;
            str = str.replace( n1, n2 - n1 + 1, p );
            // cout << "Debug : " << str << endl;
        }
    }
    return 0;
}

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

int main(){
    int r,g,b;
    cin >> r >> g >> b ;
    if((r*100+g*10+b) % 4 == 0){
        cout << "YES" ;
    }else{
        cout << "NO" ;
    }
    cout << endl;
    return 0;
}

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

/**
 * Created by Santa.
 */
public class Main {

  static int N;
  static int K;
  static long Q;
  static int A;
  static int B;
  static long C;
  static double min = 9999999;
  static long ans = 0;

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


    int r = scanner.nextInt();
    int D = scanner.nextInt();

    int x = scanner.nextInt();
    long temp = x;
    for (int i = 0; i < 10; i++) {

      temp = r * temp - D;
      System.out.println(temp);
    }


  }
}



Measured memory_bytes: 23764
n=int(raw_input())
s=raw_input().split(' ')

ar=[]
k=0
for i in range(len(s)):
	ar.append(int(s[i]))
	k+=int(s[i])

l=0
mn=10000000000
for i in range(len(ar)-1):
	l=l+(ar[i])
	v=(k-l)
	g=0
	if v>l:
		g=v-l
	else:
		g=l-v;
	if g<mn:
		mn=g

print(mn)

Measured memory_bytes: 25608
import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

k=II()
print("ACL"*k)


Measured memory_bytes: 9056
#include <cstdio>
#include <algorithm>
using namespace std;
#define ll long long
ll ans;
int n,k;
int h[200005];
int main(){
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++){
		scanf("%d",&h[i]);
	}
	sort(h+1,h+n+1);
	for (int i=1;i<=n-k;i++){
		ans+=h[i];
	}
	printf("%lld",ans);
	return 0;
}


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

#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,b,a)     for(int i=b;i>=a;i--)

int n;
string s;
set<string> a;

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

    set<string> a;
    cin >> n;
    bool flag = true;
    string last = "";
    rep(i,1,n) 
    {
        cin >> s;
        if (a.count(s)) 
        {
            flag = false;
        } 
        else 
        {
            a.insert(s);
            if (last.empty() || last.back() == s.front()) 
            {
 
            } 
            else
                flag = false;
        }
        last = s;
    }
 
    if(flag)
        cout<<"Yes";
    else
        cout<<"No";
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define x first
#define y second
const int NMAX=100666; //LOL
using namespace std;
const int INF=1000000007;
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef vector<int> VI;

char c;
void solve()
{
    cin>>c;
    if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u')
        cout<<"vowel";
    else
        cout<<"consonant";

}

int main()
{
    // Tic
    clock_t t=clock();
   
    solve();
    cout<<"\n";
 
    //Toc
    t=clock()-t;
    //printf("It took me %d clicks (%f seconds).\n",(int)t,((float)t)/CLOCKS_PER_SEC);
    return 0;
}


Measured memory_bytes: 764
n = int(input())
Tp = 0
Hp = 0
tmp = "abcdefghijklmnopqrstuvwxyz"
alph = list(tmp)

for i in range(n):
    Ta,Ha = input().split()
    lTa = list(Ta)
    lHa = list(Ha)
    num = 0

    if (len(Ta) <= len(Ha)):  #definition of num
        num = len(Ta)

    else:
        num = len(Ha)

    if (Ta in Ha and lTa[0] == lHa[0]): #drow a
        if (Ta == Ha):
            Tp += 1
            Hp += 1
        else:
            Hp += 3

    elif (Ha in Ta and Ha != Ta and lTa[0] == lHa[0]):
        Tp += 3


    else:
        for i in range(len(lTa)):  # convert alphabet to number
            for j in range(26):
                if (lTa[i] == alph[j]):
                    lTa[i] = int(j)

                else :
                    continue

        for i in range(len(lHa)):  # convert alphabet to number
            for j in range(26):
                if (lHa[i] == alph[j]):
                    lHa[i] = int(j)

                else :
                    continue

        for i in range(num):
            if (lTa[i] < lHa[i]):
                Hp +=3
                break
            elif (lHa[i] < lTa[i]):
                Tp +=3
                break
            elif (lHa[i] == lTa[i]):
                continue

print(Tp,Hp)



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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル
	int R;
	cin >> R;
	cout << 2 * (float)R * acos(-1) << "\n";

}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	
	solve();
	return 0;
}

Measured memory_bytes: 3784
#include<iostream>
typedef long long ll;
using namespace std;

int main(){
    ll A, B, K, a, b, k;
    cin >> A >> B >> K;
    if(K<=A){
        cout << A-K << " " << B << endl;
    }else if(K<=A+B){
        cout << 0 << " " << A+B-K << endl;
    }else{
        cout << 0 << " " << 0 << endl;
    }
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline
MOD = 1000000007

op = list('+-')

x = input()[:-1]

res =""
for i in range(len(x)):
    res += str(x[i])
    if i != 3:
        res +="-"
res += "="

for bits in range(0,1<<3):
    y = []
    a = int(x[0])
    for d in range(2,-1,-1):
        if 1 & (bits>>d) :
            a += int(x[3-d])
            y.append("+")
        else:
            a -= int(x[3-d])
            y.append("-")
    
    if a == 7:
        res =""
        for i in range(len(x)):
            res += str(x[i])
            if i != 3:
                res +=str(y[i])
        res += "=7"
        print(res)
        exit()

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
struct edge{
    ll p;//点
    ll w;//辺の重み*-1
};
vector<vector<edge> > graph(100000);
vector<ll> res(100000);
ll v,e,r;//vは頂点,eは辺,rは始点
void dijkstra(){
  for(int i = 0;i < v;i++)res[i] = pow(10,18);
    res[r] = 0;
    priority_queue<pair<ll,ll> > que;//重み、頂点
    que.push(make_pair(0,r));
    while(!que.empty()){
        edge now;
        now.p = que.top().second;
        now.w = que.top().first * -1;
        que.pop();
        if(res[now.p] < now.w)continue;
        for(int i = 0;i < graph[now.p].size();i++){
            if(res[graph[now.p][i].p] > now.w + graph[now.p][i].w){
                res[graph[now.p][i].p] = now.w + graph[now.p][i].w;
                que.push(make_pair(res[graph[now.p][i].p] * -1,graph[now.p][i].p));
            }
        }
    }
}

int main(){
  cin >> v >> e;
  for(int i = 0;i < e;i++){
    ll s,t,c;
    cin >> s >> t >> c;
    s--,t--;
    edge memoa = {s,c};
    edge memob = {t,c};
    graph[s].push_back(memob);
    //graph[t].push_back(memoa);
  }
  e += v - 1;
  for(int i = 0;i < v - 1;i++){
    edge memo = {i,0};
    graph[i + 1].push_back(memo);
  }
  r = 0;
  dijkstra();
  if(res[v - 1] == pow(10,18))cout << -1 << endl;
  else cout << res[v - 1] << endl;
}

Measured memory_bytes: 9468
#include <stdio.h>
#include <algorithm>
using namespace std;
int n, a[100];
int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	for(int i = 0; i < n; i++) {
		for(int j = i - 1; j >= 0; j--) {
			if(a[j] < a[j + 1]) break;
			swap(a[j], a[j + 1]);
		}
		for(int i = 0; i < n; i++) {
			if(i) printf(" ");
			printf("%d", a[i]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 2584
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
template <char d = ' ', class T>
ostream& operator << (ostream& out, vector<T>& v){ for(auto& e : v){ out << e << d; } return out; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    set<char> cs;
    for(auto& c : s){
        cs.insert(c);
    }
    cs.insert('z' + 1);
    char next = 'a' - 1;
    for(auto& c : cs){
        if(c - 1 != next){
            next++;
            break;
        }
        next = c;
    }
    printd(next);
    if(next == 'z' + 1){
        set<char> cs2;
        for(int i = 25; i >= 0; i--){
            cs2.insert(s[i]);
            if(s[i] < *cs2.rbegin()){
                char mini = 'z';
                for(auto& c : cs2){
                    if(s[i] < c && c < mini){
                        mini = c;
                    }
                }
                s[i] = mini;
                // s[i] = *cs2.rbegin();
                cout << s.substr(0, i + 1) << '\n';
                return 0;
            }
        }
        cout << -1 << '\n';
        return 0;
    }
    // for(size_t i = 0; i < s.size(); i++){
    //     auto& c = s[i];
    //     if(c != (int)i + 'a'){
    //         cout << s.substr(0, i) << ' ' << next << '\n';
    //         return 0;
    //     }
    // }
    cout << s << next << '\n';
}


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

int main() {
	long long A, B, C;

	cin >> A >> B >> C;

	long long r = max(C - A - B, 0LL);
	long long ans = C - r + B;
	if( r > 0 ) {
		ans++;
	}

	cout << ans << endl;

	return 0;
}


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

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

    int A, B, C;
    ll K;
    cin >> A >> B >> C >> K;

    int sub = A - B;

    int res;
    if (K % 2 == 0) res = sub;
    else res = -sub;

    cout << res << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
int main(){
  int N,T,E=1001;
  char k,d;
  str x;
  cin>>N>>T;
  vector<int>c(N);
  vector<int>t(N);
  rep(0,N){
    cin>>c[i]>>t[i];
    if(t[i]<=T&&c[i]<E){
      E=c[i];
    }
  }
  if(E==1001)cout<<"TLE"<<endl;
  else cout<<E<<endl;
}


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

#define rep(i,n) for(int i=0; i<(n); ++i)
#define rrep(i,n) for(int i=1; i<=(n); ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define foreach(it, v) for(typeof(v.begin()) it=v.begin(); it!=v.end(); ++it)
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second

typedef unsigned int uint;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef set<int> si;

//MOD//
const ll MOD = 1000000007;
struct big;
big ex(big a, ll tms);
typedef struct big{
  ll val;
  big():val(0){}
  big(ll val):val((val%MOD+MOD)%MOD){}
  big& operator += (const big& obj){ (val+=obj.val)%=MOD; return *this;}
  big& operator -= (const big& obj){ (val+=MOD-obj.val)%=MOD; return *this;}
  big& operator *= (const big& obj){ (val*=obj.val)%=MOD; return *this;}
  big& operator /= (const big& obj){ (val*=ex(obj,MOD-2).val)%=MOD; return *this;}
  big operator + (const big& obj)const{ return big(*this) += obj;}
  big operator - (const big& obj)const{ return big(*this) -= obj;}
  big operator * (const big& obj)const{ return big(*this) *= obj;}
  big operator / (const big& obj)const{ return big(*this) /= obj;}
  bool operator < (const big& obj)const{ return val < obj.val;}
  bool operator == (const big& obj)const{ return val == obj.val;}
} big;
istream& operator >> (istream& i, big& obj){ i>>obj.val; return i;}
ostream& operator << (ostream& o, const big& obj){ o<<obj.val; return o;}
big ex(big obj, ll tms){
  if(!tms) return 1;
  big ret = ex(obj, tms/2);
  ret *= ret;
  return (tms&1) ? ret*obj : ret;
}
//MOD//

ll pow(ll n, int m){
  if(!m) return 1;
  ll ret = pow(n, m/2);
  ret *= ret;
  return (m&1) ? ret*n : ret;
}

template <class F, class T>
void convert(const F &f, T &t){
  stringstream ss;
  ss << f;
  ss >> t;
}

int N,M;
int c[200001];

//big jst[200000];
big cnt[200001];

big s[200001];

int main(){

  scanf("%d",&N);
  int bef = -1;
  int cc;
  rep (i,N) {
    scanf("%d", &cc);
    if (cc != bef) {
      c[M] = cc;
      bef = cc;
      ++M;
    }
  }

  rep (i,M) {
    big cntbef = i==0 ? 1 : cnt[i-1];
    cnt[i] = cntbef + s[c[i]];
    s[c[i]] += cntbef;
  }

  cout << cnt[M-1] << endl;

  return 0;
}


Measured memory_bytes: 4096
#include<stdio.h>
int main(){
    int f,g,h,l;
    scanf("%d%d%d",&f,&g,&h);
    if(f<=g && f<=h)
    {
        l=f;
    }
    else if(g<=f && g<=h){
        l=g;
    }
    else{
        l=h;
    }
    if(f>=g && f>=h)
    {
        printf("%d\n",f-l);
    }
    else if(g>=f && g>=h){
        printf("%d\n",g-l);
    }
    else{
        printf("%d\n",h-l);
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

// Optimization

//#pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) Fora(iiii, a) cout << iiii << ' '; cout << endl;
#define PrintVl(a) Fora(iiii, a) cout << iiii << endl;
#define PrintA(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << ' '; cout << endl;
#define PrintAl(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define mset1(a) memset(a, 1, sizeof(a))
#define msetn1(a) memset(a, -1, sizeof(a))
#define msetinf(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());
//int randt(int l, int r){ return (rando() % (r - l + 1) + l); }

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 1e5 + 5;
int mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e9 + 7;
ll infll = 1e18 + 7;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n; cin >> n;
    cout << 10 - (n / 200);
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 3644
import java.util.*;
public class Main {
	public static void main(String[] args){
        Main main = new Main();
        main.input();
        main.solve();
        main.output();
    }

    int N;
    int[] L;
    int result;

    private void input() {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        L = new int[N];
        for (int i=0; i<N; i++) {
            L[i] = sc.nextInt();
        }
        result = 0;
    }

    private void solve() {
        for (int i=0; i<N; i++) {
            for (int j=i+1; j<N; j++) {
                if (L[i] == L[j]) {
                    continue;
                }
                for (int k=j+1; k<N; k++) {
                    if (L[i] == L[k] || L[j] == L[k]) {
                        continue;
                    }
                    if (L[i] + L[j] > L[k] && L[i] + L[k] > L[j] && L[j] + L[k] > L[i]) {
                        result++;
                    }
                }    
            }
        }
    }

    private void output() {
        System.out.println(result);
    }
}


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

using namespace std;

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

    int ans = 0;

    for (int i = 1; i < n; i *= 100) {
        ans += min(9 * i, n - i);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod

signed main(){
    int N,D; cin>>N>>D;
    vector<vector<int>> X(N,vector<int>(D));
    REP(i,N){
        REP(j,D){
            cin>>X[i][j];
        }
    }
    int ans = 0;
    REP(i,N){
        FOR(j,i+1,N){
            int norm =0;
            REP(k,D){
                int diff = abs(X[i][k]-X[j][k]);
                norm += diff*diff;
            }
            bool answ = false;
            REP(k,norm+1){
                if(k*k==norm){
                    answ = true;
                }
            }
            if(answ) ans++;
        }
    }
    cout<<ans<<endl;
}





Measured memory_bytes: 256
read s;
read t;
if [ ${#s} -ne ${#t} ];then
	[ ${#s} -lt ${#t} ]&&echo LESS||echo GREATER;
else
	f="EQUAL";
	for((i=0;i<${#s};i++))do
		if [ ${s:$i:1} != ${t:$i:1} ];then
			if [ ${s:$i:1} \< ${t:$i:1} ];then
				f="LESS";
			else
				f="GREATER";
			fi;
			break;
		fi
	done;
	echo $f
fi;


Measured memory_bytes: 376
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5+5; 
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second; 
}

ll raise(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}


int n, m, x, c[15], a[15][15];

void solve()
{
    cin >> n >> m >> x;
    for (int i=0; i<n; ++i) {
    	cin >> c[i];
    	for (int j=0; j<m; ++j) {
    		cin >> a[i][j];
    	}
    }
    ll ans=INF;
    for (int mask=0; mask<(1<<n); mask++) {
    	ll sum=0, cost=0;
    	ll xd[m]; fill(xd,xd+m,0);
    	for (int i=0; i<n; ++i) {
    		if (1&(mask>>i)) {
    			cost += c[i];
    			for (int j=0; j<m; j++) xd[j] += a[i][j];
    		}
    	}
    	bool found=true;
    	for (int i=0; i<m; ++i) if (xd[i]<x) found=false;
    	if (found) ans=min(ans,cost);
    }

    nout(ans==INF?-1:ans);
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll=long long; 
int main(){
  ll a=0;
  ll N;
  ll D;
  cin>>N>>D;
  vector<ll>vec(2*N);
  for(ll i=0;i<2*N;i++){
    cin>>vec.at(i);
  }
 for(ll i=0;i<N;i++){
   if(vec.at(2*i)*vec.at(2*i)+vec.at(2*i+1)*vec.at(2*i+1)<=D*D){
     a+=1;
   }
 }
  cout<<a;
}
  

Measured memory_bytes: 6420
F[501][501];
main(m,n,w,h,s,t,i,j,k,l){
	for(;scanf("%d",&n),n;printf("%d\n",n)){
		for(scanf("%d%d",&w,&h),memset(F,0,sizeof(F)),i=0;i<n;i++)scanf("%d%d",&k,&l),F[k][l]=1;
		for(scanf("%d%d",&s,&t),n=i=0;i<=w-s+1;i++)for(j=0;j<=h-t+1;j++){
			for(m=0,k=i;k<i+s;k++)for(l=j;l<j+t;l++)if(F[k][l])m++;
			if(n<m)n=m;
		}
	}
}

Measured memory_bytes: 1588
import sys
input = sys.stdin.readline

n = int(input())
pre = -1
ans = -1
for i in range(n):
    a = int(input())
    if a > i or a > pre + 1:
        print(-1)
        exit()

    if a <= pre:
        ans += a
    else:
        ans += 1
    pre = a

print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

ll factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
    }
    return ans;
}

vector<ll> Eratosthenes(ll N){
    bool arr[N+1];
    //initialization
    arr[0] = false;
    arr[1] = false;
	for(ll i = 2; i < N+1; i++){
		arr[i] = true;
	}
    //eratosthenes
	for(ll i = 2; i <= sqrt(N); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = false;//not prime number
			}
		}
	}
    vector<ll> prime;
    llRep(i,N){
        if (arr[i]==true){
            prime.push_back(i);
        }
    }
    return prime;
}

char alphabet[] = {
    'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
};

int main(){
    ll N,K,a,b;
    cin >> N >> K;
    ll cnt[100002];
    llrep(i,100002){
        cnt[i] = 0;
    }
    llRep(i,N){
        cin >> a >> b;
        cnt[a] += b;
    }
    ll now=0;
    llRep(i,100000){
        now += cnt[i];
        if (now >= K){
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 1024
import sys

def _ia(): return map(int, sys.stdin.readline().strip().split())


class UnionFind:
    def __init__(self, n):
        self._par = [-1]*(n+1)

    def root(self, x):
        if self._par[x] < 0:
            return x
        else:
            self._par[x] = self.root(self._par[x])
            return self._par[x]

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        if self._par[x] > self._par[y]:
            x, y = y, x
        self._par[x] += self._par[y]
        self._par[y] = x

    def size(self, x):
        return -self._par[self.root(x)]


def main():
    n, m = _ia()
    uf = UnionFind(n)
    for _ in range(m):
        a, b = map(lambda x: x-1, _ia())
        uf.unite(a, b)
    return max(uf.size(i) for i in range(n))


if __name__ == "__main__":
    print(main())


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

using namespace std;

#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vll vector<long long>
#define MOD 1000000007

typedef long long ll;

void print(vi v){
    cout<<"Contents of vector:\n";
    for(auto x : v) cout<<x<<" ";
    cout<<endl<<endl;
}

void solve(){
    string s; cin>>s;
    int best = -1, cur = 0;
    for(int i = 0; i<s.length(); i++){
        if(s[i] == 'R') cur++;
        else {
            best = max(best, cur);
            cur = 0;
        }
    }
    best = max(best, cur);

    cout<<best<<endl;


}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    //ifstream cin("saul1.in"); ofstream cout("output.txt");///cia failai

    //int T; cin>>T;
    int T = 1;

    for(int it = 1; it<=T; it++){
        solve();


    }
}


Measured memory_bytes: 3612
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int k,a,b;
  scanf("%d%d%d",&k,&a,&b);
  if(a+2>=b){
    printf("%d\n",k+1);
  } else {
    if(k<=a-1){
      printf("%d\n",k+1);
    } else {
      int64 local=a;
      k-=a-1;
      local=local+(int64)(k/2)*(b-a);
      if(k&1) local++;
      printf("%lld\n",local);
    }
  }
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128