akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
  int N;
  cin >> N;
  bool edge[N][N];
  int edgesum=(N*(N-1))/2;
  rep(i,N) rep(j,N) edge[i][j]=true;
  if(N%2==0){
    rep(i,N/2){
      edgesum--;
      edge[i][N-i-1]=false;
    }
  }
  else{
    rep(i,N/2){
      edgesum--;
      edge[i][N-i-2]=false;
    }
  }
  cout << edgesum << endl;
  rep(i,N) rep(j,N) if(i<j && edge[i][j]==true) cout << i+1 << " " << j+1 << " " << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes                \
    cout << "Yes" << endl; \
    return 0;
#define No                \
    cout << "No" << endl; \
    return 0;
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

template <typename T>
void print(const T &v);

int main()
{
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());
    if (a[0] + a[1] == a[2])
    {
        Yes;
    }
    else
    {
        No;
    }
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int x=0,y=0;
    int t=0;
    int a,b,c;
    for(int i=1;i<=n;i++)
    {
        cin>>c>>a>>b;
        if(abs(x-a)+abs(y-b)>c-t)
        {
            cout<<"No";
            return 0;
        }
        if((abs(x-a)+abs(y-b))%2==0 &&(c-t)%2==1)
        {
            cout<<"No";
            return 0;
        }
        if((abs(x-a)+abs(y-b))%2==1 &&(c-t)%2==0)
        {
            cout<<"No";
            return 0;
        }
        x=a;y=b;t=c;
    }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    long long p=0;
    int n,k,i;
    scanf("%d%d",&n,&k);
    for(i=0;i<n-1;i++){
        p++;
        p+=(p-1)/(long long)(k-1);
    }
    printf("%lld\n",p);
}


Measured memory_bytes: 1856
import java.util.Scanner;

public class Main {

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

        int[] cost = new int[3];

        cost[0] = sc.nextInt();
        cost[1] = sc.nextInt();
        cost[2] = sc.nextInt();

        int min = Integer.MAX_VALUE;

        for (int i = 0; i < 2; i++) {
            for (int j = i+1; j < 3; j++) {
                min = Math.min(min, cost[i] + cost[j]);
            }
        }

        System.out.println(min);
    }

}

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

typedef long long ll;
typedef long double ld; 
typedef double db; 
typedef string str; 

typedef pair<int, int> pi;
typedef pair<ll,ll> pl; 
typedef pair<ld,ld> pd; 

typedef vector<int> vi; 
typedef vector<ll> vl;
typedef vector<ld> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
typedef vector<pl> vpl; 

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound 
#define ub upper_bound 

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 1000001;

int N, aP, bP;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    cin >> N;
    vi a(N), b(N);
    F0R(i, N) cin >> a[i];
    F0R(i, N) cin >> b[i];
    vi perm(N); F0R(i, N) perm[i] = i + 1;
    int counter = 1;
    do {
        bool aF = true, bF = true;
        F0R(i, N) {
            if (perm[i] != a[i]) aF = false;
            if (perm[i] != b[i]) bF = false;
        }
        
        if (aF) aP = counter;
        if (bF) bP = counter;
        counter++;
    } while (next_permutation(all(perm)));
    cout << abs(aP - bP);
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  set<int> s;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    s.insert(a);
  }
  cout<<(s.size()==n?"YES":"NO")<<endl;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
typedef int LL;
const LL maxn=1e6+9;
inline LL Read(){
	LL x(0),f(1); char c=getchar();
	while(c<'0' || c>'9'){
		if(c=='-') f=-1; c=getchar();
	}
	while(c>='0' && c<='9'){
		x=(x<<3)+(x<<1)+c-'0'; c=getchar();
	}return x*f;
}
LL ans,n,d;
LL x[101][101];
inline void Check(LL i,LL j){
	double ret(0);
	for(LL k=1;k<=d;++k){
		ret+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
//		printf("%d ",(x[i][k]-x[j][k])*(x[i][k]-x[j][k]));
	}//puts("");
	LL now(ret);
//	printf("(%lf)%lf %d\n",ret,sqrt(ret),sqrt(now));
	if((LL)sqrt(now)==sqrt(ret)) ++ans;
}
int main(){
    n=(Read()),d=(Read());
	for(LL i=1;i<=n;++i){
		for(LL j=1;j<=d;++j) x[i][j]=Read();
	}
	for(LL i=1;i<=n;++i){
		for(LL j=i+1;j<=n;++j){
			Check(i,j);
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
//
// Created on 2020/08/02.
//


#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
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
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; }
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;



int main() {
    int n;
    cin>>n;
    string c;
    cin>>c;
    string s = "#";
    s += c;
    int r = 0;
    int w = 0;
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        if(s[i] == 'R')r++;
        else if(s[i] == 'W') w++;
    }


        for (int i = 1; i <= r; ++i) {

            if(s[i] == 'W')ans++;
        }


    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 3920
#include<bits/stdc++.h>
using namespace std;
long double X[200100];
int N;
long long Count(long double len)
{
  long long Ans=0;
  for(int i=0;i<N;i++)
  {
    Ans+=(long long)(X[i]/len);
  }
  return Ans;
}
int main()
{
  long long K;
  cin>>N>>K;
//long long Max=0;
  for(int i=0;i<N;i++)
{
	cin>>X[i];
//	Max=max(Max,(long long)(X[i]));
	X[i]-=0.1;
}
//if(!K)
//{
//	cout<<Max<<endl;
//	return 0;
//}
  long double l=1,r=1e10;
  while(l<r-0.1)
  {
    long double mid=(l+r+0.1)/2;
  //  cout<<l<<" "<<r<<" "<<mid<<endl;
    if(Count(mid)<=K)
      r=mid-0.07;
    else	l=mid+0.07;
  }
  cout<<(long long)(l+0.999)<<endl;
  return 0;
}


Measured memory_bytes: 6728
from collections import Counter

N, P = map(int, input().split())

def factorization(n):
    factor = []
    tmp = int(n ** 0.5) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    factor.append(n)
    factor.sort()
    return factor

lP = factorization(P)
clP = Counter(lP)

ans = 1
for key in clP:
    if clP[key] >= N:
        ans *= key ** (clP[key] // N)
    # print(key, clP[key])

# print(N, lP)
print(ans)

Measured memory_bytes: 38896
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

int main(void)
{
    int N, M;
    cin >> N >> M;

    int left, right;
    int begin = 1;
    int end = N;

    int ans;
    for (int i = 0; i < M; i++)
    {
        cin >> left >> right;
        if (left > end)
        {
            cout << 0 << endl;
            return (0);
        }
        begin = max(begin, left);
        end = min(end, right);
    }
    ans = end - begin + 1;
    cout << ans << endl;
}

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

main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    
    int n;
    cin>>n;
    map<string,int> m;
    while(n--){
        string s;
        cin>>s;
        sort(s.begin(),s.end());
        m[s]++;
    }

    int ans=0;
    for(auto i:m){
        ans+=(i.second*(i.second-1))/2;
    }
    cout<<ans;

    return 0;
}

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

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
    string a, b;
    cin >> a >> b;
    if (a[0] == b[2] && a[1] == b[1] && a[2] == b[0])
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 256
N, L = map(int,input().split())
tastes = [L+(i+1)-1 for i in range(N)]
taste = sum(tastes)
diff = 99999999
taste_minus = 0
for i in range(N):
  my_sum = sum([tastes[j] for j in range(N) if j != i])
  if diff > abs(taste - my_sum):
    diff = abs(taste - my_sum)
    taste_minus = my_sum
    
print(taste_minus)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define maxn 100005
int main()
{
    int n;
    int C[3][maxn];
    int dp[3][maxn];
    cin>>n;
    for(int i = 0; i < n; i++)  cin>>C[0][i]>>C[1][i]>>C[2][i];
    dp[0][0] = C[0][0];
    dp[1][0] = C[1][0];
    dp[2][0] = C[2][0];
    for(int i = 1; i < n; i++)
    {
        dp[0][i] = C[0][i] + max(dp[1][i-1],dp[2][i-1]);
        dp[1][i] = C[1][i] + max(dp[0][i-1],dp[2][i-1]);
        dp[2][i] = C[2][i] + max(dp[0][i-1],dp[1][i-1]);
    }
    cout<<max(dp[0][n-1],max(dp[1][n-1],dp[2][n-1]));
    return 0;
}

Measured memory_bytes: 5940
def f(N, X):
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= a[N - 1] + 1:
        return f(N - 1, X - 1)
    else:
        return 1 + p[N - 1] + f(N - 1, X - 1 - a[N - 1] - 1)


N, X = map(int, input().strip().split(" "))

a, p = [1], [1]
for i in range(N):
    a.append(2 * a[i] + 3)
    p.append(2 * p[i] + 1)

print(f(N, X))

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

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

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

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

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

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

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  while(cin>>n&&n){
    int ans = 0;
    vary(int,dp,n+3,0);
    dp[1]=1,dp[2]=2,dp[3]=4;
    REP(i,1,n+1){
      if(i > 3){
        REP(j,1,4){
          dp[i] += dp[i-j];
        }
      }
      ans += dp[i]/3650;
    }
    cout << 1+ dp[n] / 3650<<endl;
  }
  return 0;
}

Measured memory_bytes: 3188
N,K=map(int,input().split())
mod=10**9+7

C1=[0]*K
C2=[0]*K
C1[0]=1
C2[0]=N-K+1

for i in range(1,K):
  C1[i]=C1[i-1]*(K-i)//i
  C2[i]=C2[i-1]*(N-K+1-i)//(i+1)
#print(C1)
#print(C2)

for i in range(K):
  print(C1[i]*C2[i]%mod)

Measured memory_bytes: 3828
#include <iostream>

using namespace std;

int BubbleSort(int A[], int N){
  int cnt=0;
  bool flag = true;
  
  while(flag){
    flag = false;
    for(int i = N-1; i > 0; i--){
      if(A[i] < A[i-1]){
	int tmp = A[i];
	A[i] = A[i-1];
	A[i-1] = tmp;
	cnt++;
	flag = true;
      }
    }
  }
  
  return cnt;
}

int main(){
  int A[100], N, cnt;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }

  cnt = BubbleSort(A, N);

  cout << A[0];
  for(int i = 1; i < N; i++){
    cout << " " << A[i];
  }
  cout << endl << cnt << endl;
  
  return 0;
}



Measured memory_bytes: 3100
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
N = int(input())
a = list(map(int, input().split()))

ave = (round(sum(a)/N, 0))

sum = 0
for i in range(N) :
  sum += (a[i] - ave) ** 2

print (int(sum))


Measured memory_bytes: 38384
#include <stdio.h>
int main() {
    int i;
    double a, s;
 
    while (scanf(" %lf ", &a) != EOF) {
        s = a;
        for (i = 0; i < 9; i++) {
            if (i % 2 == 0)
                a *= 2.0;
            else
                a /= 3.0;
            s += a;
        }
        printf("%.6lf\n", s);
    }
    return 0;
}

Measured memory_bytes: 656
/*
  AOJ 2216
  Title:Summer of KMC
  @kankichi573
*/
#include <stdio.h>

main()
{
  int A,B,change,c100,c500,c1000;
  while(scanf("%d %d",&A,&B) && (A||B))
    {
      change=B-A;
      c1000 =change / 1000;
      c100  =(change % 1000)/100;
      if(c100>=5)
	{
	  c500  = 1;
	  c100 -= 5;
	}
      else
	c500=0;
      printf("%d %d %d\n",c100,c500,c1000);
    }
  return(0);
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll N, D, d[500050], Q, q[500010], pos[500010], ok[500010];

int main() {
    //cout.precision(10)
    cin >> N >> D;
    pos[0] = D;
    for(int i = 1; i <= N; i++) {
        cin >> d[i];
        pos[i] = min(pos[i - 1], abs(pos[i - 1] - d[i]));
    }
    ok[N] = 0;
    for(int i = N - 1; i >= 0; i--) {
        ll val = d[i + 1];
        if(val >= 2 * (ok[i + 1] + 1)) {
            ok[i] = ok[i + 1];
            continue;
        }
        ok[i] = ok[i + 1] + d[i + 1];
    }
    //for(int i = 0; i <= N; i++) {
        //cout << i << " " << ok[i] << endl;
    //}
    //for(int i = 0; i <= N; i++) {
        //cout << i << " " << pos[i] << endl;
   // }
    cin >> Q;
    while(Q--) {
        int q;
        cin >> q;
        if(ok[q] < pos[q - 1]) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 15488
def DFS( graph, bridge, node, count, parent, low, pre):
    pre[node] = count
    count+= 1
    low[node] = pre[node]
    for n in graph[node]:
        if pre[n] == -1:
            low[node] = min( low[node], DFS( graph, bridge, n, count, node, low, pre))
            if low[n] == pre[n]:
                bridge.append( (node, n))
        else:
            if n == parent:
                continue
            low[node] = min( low[node], low[n])
    return low[node]

N, M = [int(x) for x in input().split()]
graph = [ [] for i in range(N)]
for i in range(M):
    a, b = [int(x) for x in input().split()]
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
bridge = []
low = [-1]*N
pre = [-1]*N
DFS( graph, bridge, 0, 0, -1, low, pre)
print( len(bridge))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long ll;
const ll INF = 1ll<<60;
using namespace std;

ll N,S;

ll function_f(ll b, ll n){

  if(b<2) return INF;

  ll ans=0;
  
  while(n >= b){
    ans += n%b;
    n /= b;
  }

  return ans+n;
}


ll search(){
  if(N == S) return N+1;
  ll ans = INF;
  
  for(int i=2; i<sqrt(N)+1; i++)if (function_f(i, N) == S) ans = min(ans, (ll)i);

  for(int i=1; i<sqrt(N); i++) {
    ll B = (N - S) / i + 1;
    if (function_f(B, N) == S) ans = min(ans, B);
  }

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


int main(){
  
  cin>>N>>S;
  cout<<search()<<endl;

  return 0;
}


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

const int N = 1000 + 10;

int main()
{
    int n;
    int a[N];
    while(~ scanf("%d", &n))
    {
        int ans = 0;
        for(int i = 1; i <= n; i++)
        {
            scanf("%d", &a[i]);
            ans += a[i];
        }
        if(ans % 10) printf("%d\n", ans);
        else
        {
            sort(a + 1, a + 1 + n);
            for(int i = 1; i <= n; i++)
            {
                if(a[i] % 10)
                {
                    ans -= a[i];
                    break;
                }
            }
            if(ans % 10) printf("%d\n", ans);
            else printf("0\n");
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  char b;
  cin >> b;
  if(b=='A') cout << "T" << endl;
  if(b=='C') cout << "G" << endl;
  if(b=='G') cout << "C" << endl;
  if(b=='T') cout << "A" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,i,m;
	
	scanf("%d",&n);
	
	for(i=0; i<3; i++)
	{
		if(n%10==7)
		{
			puts("Yes");
			return 0;
		}
		
		else
		n= n/10;
	}
	
	printf("No");
	
  return 0;
	
	
}


Measured memory_bytes: 1732
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	string s;
	long long n, p, i, j, k, ans = 0, x, d;

	cin >> n >> p >> s;
	vector<long long> ct(p, 0);
	ct[0] = 1;
	x = 0;

	if (p == 2) {
		for (i = 0; i < n; i++) {
			x = s[i] - '0';
			if (x % 2 == 0) ans += (i + 1);
		}
	}
	else if (p == 5) {
		for (i = 0; i < n; i++) {
			x = s[i] - '0';
			if (x % 5 == 0) ans += (i + 1);
		}
	}
	else {
		d = 1;
		x = 0;
		for (i = n - 1; i >= 0; i--) {
			x = (x + (s[i] - '0') * d) % p;
			ans += ct[x];
			ct[x]++;
			d = (d * 10) % p;
		}
	}

	cout << ans << "\n";


	return 0;
}


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

namespace _0256
{
    class Program
    {
        static void Main(string[] args)
        {
            int res = 0;
            for (int i = 0; i < 10; i++) res += RInt();
            Console.WriteLine(res);
        }
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



Measured memory_bytes: 15896
#include <stdio.h>

int main(void) {

  int A, B;
  do {
    scanf("%d %d", &A, &B);
  } while (A < 3 || A > 20 || B < 3 || B > 20);

  int n = 0;
  for (int i = 0; i < 2; i++) {
    if (A >= B) {
      n += A;
      A--;
    } else {
      n += B;
      B--;
    }
  }

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

  return 0;
}

Measured memory_bytes: 128
//        VIVEK UPADHYAY
//        MANIT, BHOPAL(M.P)


//                         JAB-TAK TODEGA NHI,
//                         TAB -TAK CHODEGA NHI :D
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<endl
#define ok cout<<"ok\n" ;
typedef long long ll;
const int MAXN = 1e6 + 10 ;
const int MAX = 1e7 ;
double pi = 3.1415926535897932384626433832795;
const ll inf=1e18 ;

vector<int>tree[5*MAXN];
int A[MAXN];
int b[MAXN] ;
void build_tree( int curr , int l , int r )
{
    if( l==r )
    {
        tree[curr].push_back( b[ l ] );
        return ;
    }
    int mid = l+(r-l)/2;
    build_tree(2*curr+1 , l , mid );
    build_tree(2*curr+2 , mid+1 , r );
    merge(tree[2*curr+1].begin(), tree[2*curr+1].end(), tree[2*curr+2].begin(), tree[2*curr+2].end(), back_inserter(tree[curr]));
    
   /* for(int i=0;i<tree[curr].size();i++)
        cout<<tree[curr][i]<<" " ;
    LINE ; */
}
int query( int cur, int l, int r, int x, int y, int k)
{
    if( r < x || l > y )
    {
        return 0;
    }
    if( x<=l && r<=y )
    {
        return upper_bound(tree[cur].begin(),tree[cur].end(),k)-tree[cur].begin();
    }
    int mid=l+(r-l)/2;
    return query(2*cur+1,l,mid,x,y,k)+query(2*cur+2,mid+1,r,x,y,k);
}
bool comp(pair<int,int> a , pair<int,int> b){
    return a.F < b.F ;
}
int main() {
    
    int N ,M ,Q ;
    cin >> N >> M>> Q ;
    
    vector<pair<int,int> >a(M) ;
    
    
    
    for(int i=0;i<M;i++)
        cin >> a[i].F >> a[i].S ;
    
    sort(a.begin(),a.end(),comp) ;
    
    for(int i=0;i<M;i++) b[i]=a[i].S ;
    
    build_tree(0,0,M-1) ;
   
    while(Q--){
        
        int L , R ;
        cin >> L >> R ;
        int Lindex = -1 ,Rindex = -1 ;
        int lw = 0 , hg = M-1;
        
        while(lw <= hg){
            
            int mid = (lw + hg)/2 ;
            
            if(a[mid].F >= L){
                
                if(mid==0 || a[mid-1].F < L){
                    Lindex = mid ;
                    break ;
                }
            }
            if(a[mid].F >= L) hg = mid-1 ;
            else lw = mid+1 ;
        }
        
        if(Lindex==-1){
            cout<<"0\n" ;
            continue ;
        }
        lw = 0 ; hg = M-1 ;
        
        while(lw<=hg){
            int mid=  (lw + hg)/2 ;
            
            if(a[mid].F<=R){
                
                if(mid==M-1 || a[mid+1].F > R){
                    Rindex= mid ;
                    break ;
                }
            }
            if(a[mid].F <= R) lw= mid+1 ;
            else hg = mid-1;
        }
       // cout<<Lindex<<" "<<Rindex<<endl;
        cout<<query(0, 0,M-1,Lindex,Rindex,R)<<endl;
       
    }
    return 0 ;
    
}


Measured memory_bytes: 149364
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

int N;
ll x;
const int MAX_N = 2000;
ll a[MAX_N * 2]; 


int main(){
  cin >> N >> x;
  REP(i, N) cin >> a[i];
  REP(i, N) {
    a[i + N] = a[i];
  }
  

  ll memo[N][N];
  REP(i, N) {
    memo[i][0] = a[i];
  }
  REP(i, N) {
    REP(j, N - 1) {
      memo[i][j + 1] = min(a[N + i - j - 1], memo[i][j]);
    }
  }

  ll ans = INFll;
  REP(j, N) {
    ll s = 0;
    REP(i, N) {
      s += memo[i][j];
    }
    ans = min(ans, s + x * j);
  }

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 31488
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end
require 'date'

S = gets.chomp

if Date.parse(S) <= Date.parse('2019/04/30')
  puts 'Heisei'
else
  puts 'TBD'
end


Measured memory_bytes: 14500
# https://atcoder.jp/contests/abc107/tasks/abc107_b
# 愚直かな

import sys
sys.setrecursionlimit(1 << 25)
ra = range
enu = enumerate

read = sys.stdin.readline


def read_map_as(H, replace={'#': 1, '.': 0}):
    '''
    文字列のmapを置換して読み込み。デフォでは#→1,.→0
    '''
    ret = []
    for _ in range(H):
        ret.append([replace[s] for s in read()[:-1]])
        # 内包表記はpypyでは若干遅いことに注意
        # #numpy使うだろうからこれを残しておくけど
    return ret


H, W = map(int, input().split())
A = read_map_as(H)
import numpy as np
A = np.array(A)
# 削除する行の取得
del_i = set()
for i in range(H):
    if A[i].sum() == 0:
        del_i.add(i)

del_j = set()
for j in range(W):
    if A[:, j].sum() == 0:
        del_j.add(j)

# print
for i in range(H):
    if i in del_i:
        continue
    for j in range(W):
        if j in del_j:
            continue
        print('#' if A[i, j] == 1 else '.', end='')
    print()


Measured memory_bytes: 13720
fn read() -> (i32, i32) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let vec: Vec<i32> = s
        .trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    (vec[0], vec[1])
}

fn main() {
    let (a, b) = read();
    if a + b < 10 {
        println!("{}", a + b);
    } else {
        println!("error");
    }
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(){

  int i,j,datanum,minj,flag,cnt=0,temp;
  int a[101];
  scanf("%d",&datanum);
  for(i=0;i<datanum;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<datanum;i++){
    minj = i;
    flag = 0;
    for(j=i;j<datanum;j++){
      if(a[j] < a[minj]){
	minj = j;
	flag = 1;
      }
    }
    if(flag == 1){
      temp = a[minj];
      a[minj] = a[i];
      a[i] = temp;
      cnt++;
    }
  }
  
  for(i=0;i<datanum;i++){
    if(i == datanum -1){
      printf("%d\n",a[i]);
      break;
    }
    printf("%d ",a[i]);
  }
  
  printf("%d\n",cnt);
  return 0;
}




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

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


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <time.h>

using namespace std;

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

int num_divisions( int n )
{
    int ret = 1, i = 0, _n = n;
    while ( _n > 1 && i < num_primes )
    {
        const int p = prime_list[i++];
        int d = 1;
        while ( _n % p == 0 ) _n /= p, d++;
        ret *= d;
    }
    if ( _n > 1 ) ret *= 2;
    return ret;
}

int main()
{
    long N, ret = 0;
    cin >> N;
    for ( int c = 1; c < N; c++ ) { ret += num_divisions( N - c ); }
    cout << ret << endl;
    return 0;
}


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

n = int(input())
li = list(map(int,input().split()))
ans = 1

if li.count(0) > 0:
    print(0)
    exit()

for i in li:
    ans = ans * i
    if ans > 10**18:
        print(-1)
        exit()

print(ans)


Measured memory_bytes: 82824
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
#define vi vector <int>
#define vl vector <long long>
#define pb push_back
#define mk make_pair
#define pi pair <int,int>
#define pl pair <ll,ll>
#define rep(a,b) for(int i=a;i<=b;i++)
#define rep_(a,b) for(int i=a;i>=b;i--)
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    cout<<(3*n*n)<<endl;
}

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

A = input()
B = input()
if len(A) > len(B):
    print('GREATER')
elif len(A) < len(B):
    print('LESS')
else:
    for i in range(len(A)):
        if A[i] > B[i]:
            print('GREATER')
            exit()
        elif A[i] < B[i]:
            print('LESS')
            exit()
        else:
            continue
    print('EQUAL')


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

int main() {
    int k;
    cin >> k;
    if (k % 2 == 0) {
        cout << -1 << endl;
        return 0;
    }
    int ans = 1;
    int cur = 7 % k;
    while (cur != 0) {
        cur = 10 * cur + 7;
        cur %= k;
        ++ans;
        if (ans > 100000000) {
            ans = -1;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 999999

ll min(ll a, ll b){
	if (a<b) return a;
	else return b;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, x;
	cin >> n >> x;
	vector<ll> m(n);
	REP(i, n){cin >> m[i];}
	ll sum = 0;
	ll min_m = INF;
	REP(i, n){
		sum += m[i];
		min_m = min(min_m, m[i]);
	}
	cout << n + (x-sum)/min_m << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    printf("%.8f\n", r * 6.28318530717958623200);

    return 0;
}

Measured memory_bytes: 3772
#include<iostream>
#include<cmath>
using namespace std;
int a[100],n,t=0;
void mpsort(int n)
{
	int i,j;
	for(i=n-1;i>0;i--)
	{
		for(j=0;j<i;j++)
		{
			if(a[j]>a[j+1])
			{
				swap(a[j],a[j+1]);
				t++;
			}
		}
	}
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>a[i];
	mpsort(n);
	for(int i=0;i<n-1;i++)
	cout<<a[i]<<" ";
	cout<<a[n-1]<<endl;
	cout<<t<<endl;
	return 0;
 } 


Measured memory_bytes: 3092
n = int(input())
a = list(map(int, input().split()))
flag = True

for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            flag = False
            break
if flag == True:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
#define trav(x,c) for(auto &x:c)
using namespace std;

int toint(string s) {
  int ans = 0;
  for(char x: s) ans = ans*10 + (x - '0');
  return ans;
}

int sum(int x) {
  int s = 0;
  while(x) {
    s += x%10;
    x /= 10;
  }
  return s;
} 

bool equal(string s) {
  for(int i = 0,j = s.size()/2;j < s.size();i++,j++) {
    if(s[i] != s[j]) return false;
  }
  return true;
}

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  int f = 1;
  set<int> vis;
  while(true) {
    int r = (a*f)%b;
    if(r==c) {cout<<"YES"; return 0;}
    if(vis.find(r) != vis.end()) {cout<<"NO"; return 0;}
    vis.insert(r);
    f++;
  }
}

Measured memory_bytes: 256
n = int(input())
arr = []
for _ in range(n):
    a, b = map(int, input().split())
    arr.append((a, b))

def is_doublet(v):
    return v[0] == v[1]

for i in range(n - 2):
    if is_doublet(arr[i]) and is_doublet(arr[i + 1]) and is_doublet(arr[i + 2]):
        print("Yes")
        break
else:
    print("No")


Measured memory_bytes: 62512
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
	scanf("%d",&n);
	int bes = 1234567891,A,B;
	long long int tot=0;
	for(int i=1; i<=n; i++){
		scanf("%d%d",&A,&B);
		if(A > B)
			bes = min(bes, B);
		tot += A;
	}
	if(bes == 1234567891)cout << 0 << endl;else
		cout << tot - bes << endl;
	return 0;
}


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

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int c =0;
	for(int i=1;i<n;i++){
		if(s[i]=='E')c++;
	}
	int ans = c;
	for(int i=1;i<n;i++){
		if(s[i]=='E')c--;
		if(s[i-1]=='W')c++;
		ans = min(ans,c);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 900
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }

struct Tmp
{
public:
  Tmp(int N);
};

Tmp::Tmp(int N){}

void solve(void)
{
  int N; cin >> N;
  vector<int> A(N);
  for (auto& a : A) { cin >> a; }
  auto calc = [](int a) {
    int res{};
    while (a % 2 == 0) {
      a /= 2;
      ++res;
    }
    return res;
  };
  auto ans = boost::accumulate(A, (int)INF, [&calc](int r, int a){
    return std::min(r, calc(a));
  });
  cout << ans << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
def cmb1(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

n, k = map(int, input().split())
A = list(map(int, input().split()))
mod = 10**9+7

A.sort(reverse=True)

max_ = 0
for i in range(n):
    max_ += cmb1(n-1-i, k-1, mod)*A[i]
max_ %= mod

min_ = 0
for i in range(n):
    min_ += cmb1(n-1-i, k-1, mod)*A[n-1-i]
min_ %= mod
ans = max_-min_
ans %= mod
print(ans)    


Measured memory_bytes: 127788
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

int main() {
	int a, b;
	char op;
	cin >> a >> op >> b;
	if (op == '+')cout << a + b << endl;
	else if (op == '-')cout << a - b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if(a == b && b != c) cout << "Yes";
  else if(b == c && c != a) cout << "Yes";
  else if(a == c && b != c) cout << "Yes";
  else cout << "No";
  return 0;
}

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

int     main() {
        char A, B;
        string S="Good";
        cin >>A;
        for (int i=0; i<3; i++) {
                B=A;
                cin >>A;
                if (A == B) S="Bad";
        }
        cout << S << endl;
        return 0;
}

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

typedef struct P{
  int x;
  int y;
  int h;
} P;


int main()
{
  int N;
  P p[110];
  int res=0;
  cin >> N;

  int tx, ty, th;

  rep(i,N) {
    cin >> p[i].x >>p[i].y>>p[i].h;
    if(p[i].h>=1) {
      tx=p[i].x;ty=p[i].y;th=p[i].h;
    }
  }
  FOR(cy,0,100){
    FOR(cx,0,100){
      bool condIsMet=true;
      int H = th + abs(tx-cx)+abs(ty-cy);
      rep(i,N){
        if(max(H - abs(p[i].x-cx) - abs(p[i].y-cy), 0)!=p[i].h){
          condIsMet = false;
          break;
        }
      }
      if(condIsMet){
        printf("%d %d %d\n", cx, cy, H);
        return 0;
      }
    }
  }

}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main() {
    int a,b;
    cin>>a>>b;
    if(b==1){
        cout<<0<<endl;
        return 0;
    }
    int ans=1;
    while(true){
        if(a+(ans-1)*(a-1)>=b){
            break;
        }
        ans++;
    }
    cout<<ans<<endl;





    return 0;
}


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


ll Pow(ll x, ll n){
  if(n == 0) return 1;
  if(n % 2 == 0) return Pow(x*x % mod, n/2);
  else return x * Pow(x,n-1) % mod;
}

ll mod_inverse(ll a) {
  return Pow(a,mod-2);
}

int main(){
  ll n;
  cin >> n;
  ll a[n];
  ll sum = 0;
  rep(i,n) {
    cin >> a[i];
    sum = (sum + a[i]) % mod;
  }
  ll ans = 0;
  rep(i,n) {
    ll c = (sum - a[i]) % mod;
    ans = (ans + c * a[i]) % mod;
  }
  (ans *= mod_inverse(2)) %= mod;
  if(ans < 0) ans += mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5196
import math
n,d=map(int,input().split())
x=[]
for i in range(n):
  x_=list(map(int,input().split()))
  x.append(x_)
cnt=0
for i in range(n):
  for j in range(i+1,n):
    sumx=0
    for k in range(d):
      sumx+=abs(x[i][k]-x[j][k])**2

    s=float(math.sqrt(sumx))
    #print(s)
    if s.is_integer():
      cnt+=1

    else:
      continue
print(cnt)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define MOD 1000000007
#define int long long

signed main(){
    int N,W;cin>>N>>W;
    int w[N],v[N];
    for(int i=0;i<N;i++)cin>>w[i]>>v[i];
    vector<vector<int>> dp(N+1,vector<int>(W+1,0));
    for(int i=0;i<N;i++){
        for(int j=0;j<=W;j++){
            if(j<w[i]){
                dp[i+1][j]=dp[i][j];
            }else{
                dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i]);
            }
        }
    }
    cout<<dp[N][W]<<endl;
}

Measured memory_bytes: 80256
import itertools
n = int(input())
L = list(map(int, input().split()))

# L = list(set(L))
L.sort()

c = itertools.combinations(L, 3)

count = 0
for i in c:
    if i[0] + i[1] > i[2] and i[0] != i[1] and i[0] != i[2] and i[1] != i[2]:
        count += 1
print(count)


Measured memory_bytes: 9180
//NAME-DEEPESH BHATT
//Institute-IIT Dhanbad
//MOTTO-THINK FIRST,CODE LATER
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1000000007  ;
#define pb push_back
#define mp make_pair
#define pi 3.14159265359
#define fill(a,b) memset(a, b, sizeof(a))
#define endl '\n'
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a ,ll b)
{
    return a/gcd(a,b)*b;
}
ll power(ll a,ll n)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2);
    p = (p * p);
    if (n % 2)
        return (p * a);
    else
        return p;
}
struct compare{
    bool operator()(pair<int,int>p1,pair<int,int>p2){
        int l1=p1.second-p1.first+1;
        int l2=p2.second-p2.first+1;
        if(l1==l2){
            return p1.first<p2.first;
        } else
            return l1>l2;
    }
};
int main()
{
    ios_base::sync_with_stdio(false);    //for fast I/O operation
    cin.tie(NULL);
    int test=1;
    /*cin>>test;*/
    while(test--) {
        int n;
        cin>>n;
        int data[n][3];
        for(int i=0;i<n;i++){
            for(int j=0;j<3;j++){
                cin>>data[i][j];
            }
        }
        int DP[n][3];
        fill(DP,0);
        DP[0][0]=data[0][0];
        DP[0][1]=data[0][1];
        DP[0][2]=data[0][2];
        for(int i=1;i<n;i++){
            for(int j=0;j<3;j++){
                DP[i][0]=data[i][0]+max(DP[i-1][1],DP[i-1][2]);
                DP[i][1]=data[i][1]+max(DP[i-1][0],DP[i-1][2]);
                DP[i][2]=data[i][2]+max(DP[i-1][0],DP[i-1][1]);
            }
        }
        cout<<max(DP[n-1][0],max(DP[n-1][1],DP[n-1][2]));
    }
    return 0;
}




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

int main(){
	int a,b;
	cin>>a>>b;
	
	int c=b-a;
	int s=0;
	for(int i=1; i<=c; i++) s+=i;
	cout << s - b << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <tuple>
#include <queue>
#include <algorithm>
#define REP(a, b, c) for (int (a) = (b); (a) < (c); ++a)
using namespace std;
typedef tuple<int, int, int> tiii;
const int INF = 1 << 29;
int N, M;
int A[100][100];
int a, b, c;
queue<tiii> q;
int main(void) {
	cin >> N >> M;
	fill_n(A[0], 100 * 100, INF);
	for (int i = 0; i < M; ++i) {
		cin >> a >> b >> c;
		--a; --b;
		A[a][b] = A[b][a] = c;
		q.push(tiii(a, b, c));
	}
	REP(k, 0, N) REP(i, 0, N) REP(j, 0, N) {
		A[i][j] = min(A[i][j], A[i][k] + A[k][j]);
	}
	int ans = M;
	while (!q.empty()) {
		tie(a, b, c) = q.front(); q.pop();
		if (A[a][b] == c) --ans;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  for(int i=1;i<=9;i++){ 
    for(int j=1;j<=9;j++){
      if(i*j==N){
        cout<<"Yes";
        return 0; 
      }
    }                  
  }
  cout<<"No";
}

Measured memory_bytes: 256
import Data.Maybe
import Data.List

main :: IO ()
main = do
  input <- getContents
  putStrLn $ trim (solve (trim input))

--処理
solve :: String -> String
solve s | a <= c && c <= b = "Yes"
        | otherwise        = "No"
  where [a, b, c] = fmap read (words s) :: [Int]

trimHead :: String -> String
trimHead = dropWhile (\s -> isJust (elemIndex s [' ', '\t', '\n', '\r']))

trim :: String -> String
trim = reverse . trimHead . reverse . trimHead

Measured memory_bytes: 508