akhauriyash/Code-Regression huggingface dataset:
from collections import defaultdict

n=int(input())
d=defaultdict(int)

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

for i in range(n):
 d[i-a[i]]+=1


ans=0

for i in range(n):
 d[i-a[i]]-=1
 ans+=d[a[i]+i]
 
print(ans)




Measured memory_bytes: 61604
h,w,d=map(int,input().split())
a=[list(map(int,input().split())) for i in range(h)]
place=[[-1,-1] for i in range(h*w+1)]
for i in range(h):
  for j in range(w):
    place[a[i][j]]=[i,j]

def calcdist(i,j):
  return abs(place[i][0]-place[j][0])+abs(place[i][1]-place[j][1])

dp=[[0] for i in range(d+1)]
for i in range(1,d+1):
  for j in range(i+d,h*w+1,d):
    dp[i].append(dp[i][-1]+calcdist(j-d,j))
    
q=int(input())
for _ in range(q):
  l,r=map(int,input().split())
  i=l%d
  if i==0:
    i=d
  l=(l-1)//d
  r=(r-1)//d
  print(dp[i][r]-dp[i][l])

Measured memory_bytes: 74076
p = int(input())
sum = 0
if p >= 10000:
    sum += p//10000*10000
    p -= p//10000*10000
if p >= 5000:
    sum += p//5000*5000
    p -= p//5000*5000
if p >= 1000:
    sum += p//1000*1000
    p -= p//1000*1000
if p >= 500:
    sum += p//500*500
    p -= p//500*500
print(sum)



Measured memory_bytes: 5592
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;
char s[100][100];

int main(){
    int a,b;
    cin>>a>>b;
    a--;
    b--;
    for(int i=0;i<50;i++){
        for(int j=0;j<100;j++){
            s[i][j]='#';
        }
    }
    for(int i=50;i<100;i++){
        for(int j=0;j<100;j++){
            s[i][j]='.';
        }
    }
    while(a){
        for(int i=0;i<50;i+=2){
            for(int j=0;j<50;j++){
                s[i][2*j]='.';
                a--;
                if(a==0) break;
            }
            if(a==0) break;
        }
        if(a==0) break;
    }
    while(b){
        for(int i=99;i>=50;i-=2){
            for(int j=0;j<50;j++){
                s[i][2*j]='#';
                b--;
                if(b==0) break;
            }
            if(b==0) break;
        }
        if(b==0) break;
    }
    cout<<100<<" "<<100<<endl;
    for(int i=0;i<100;i++){
        for(int j=0;j<100;j++){
            cout<<s[i][j];
        }
        cout<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout<<v<<endl;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;

int main(){
    string K;
    cin >> K;
    ll D;
    cin >> D;
    ll N=K.size();

    //dp1[i][j]は未満、i桁目まででjmodD;
    //dp0[i][j]は一致、i桁目まででjmodD;
    vector<vector<ll>> dp1(N, vector<ll>(D,0));
    vector<vector<ll>> dp0(N, vector<ll>(D,0));
    for(ll i=0;i<K[0]-'0';i++)dp1[0][i%D]++;
    dp0[0][(K[0]-'0')%D]=1;
    for(ll i=1;i<N;i++)
        for(ll j=0;j<D;j++){
            for(ll k=0;k<K[i]-'0';k++){
                dp1[i][(j+k)%D]+=dp1[i-1][j]+dp0[i-1][j];
                dp1[i][(j+k)%D]%=MOD;
            }
            dp1[i][(j+(K[i]-'0'))%D]+=dp1[i-1][j];dp1[i][(j+(K[i]-'0'))%D]%=MOD;
            dp0[i][(j+(K[i]-'0'))%D]+=dp0[i-1][j];dp0[i][(j+(K[i]-'0'))%D]%=MOD;
            for(ll k=(K[i]-'0')+1;k<10;k++){
                dp1[i][(j+k)%D]+=dp1[i-1][j];
                dp1[i][(j+k)%D]%=MOD;
            }
        }

    print((dp0[N-1][0]+dp1[N-1][0]-1+MOD)%MOD)
    


    return 0;
}


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

int main()
{
	int n,m;
	cin >> n >> m;
	if(m==1)
	{
		cout<<0<<endl;
		return 0;
	}
	vector<int> a(m);
	for(int i = 0;i<m;i++)cin >> a[i];
	sort(a.begin(),a.end());
	vector<int> div(m-1);
	for(int i = 0;i<m-1;i++)
	{
		div[i] = a[i+1]-a[i];
	}
	sort(div.begin(),div.end());
	ll ans = 0;
	for(int i = 0;i<max(0,(int)div.size()-(n-1));i++)
	{
		//if(i<div.size())
		ans += div[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18 + 10;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	vector<vector<int>> G(n);
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		G[a - 1].push_back(b - 1);
		G[b - 1].push_back(a - 1);
	}
	vector<int> dist1(n, n + 5), dist2(n, n + 5);
	dist1[0] = 0;
	queue<int> que;
	que.push(0);
	while (!que.empty()) {
		int q = que.front();
		que.pop();
		for (auto nq : G[q]) {
			if (dist1[nq] > dist1[q] + 1) {
				dist1[nq] = dist1[q] + 1;
				que.push(nq);
			}
		}
	}
	dist2[n - 1] = 0;
	que.push(n - 1);
	while (!que.empty()) {
		int q = que.front();
		que.pop();
		for (auto nq : G[q]) {
			if (dist2[nq] > dist2[q] + 1) {
				dist2[nq] = dist2[q] + 1;
				que.push(nq);
			}
		}
	}
	int cnt = 0;
	rep(i, n) {
		if (dist1[i] <= dist2[i])
			cnt++;
		else
			cnt--;
	}
	if (cnt > 0)
		cout << "Fennec" << endl;
	else
		cout << "Snuke" << endl;

	return 0;
}

Measured memory_bytes: 9516
primes :: [Int]
primes = sieve (2 : [3, 5..])
  where
    sieve (p:xs) = p : sieve [ x | x <- xs, x `mod` p > 0]

eff_prime::Int->Int->[Int]
eff_prime n p = takeWhile (large n p) primes

eater::Int->Int->[Int]->Int
eater n p []    = 1
eater n p (pr:prs)= let (p',k) = (multi_div p pr) in (pr^(div k n))*(eater n p' prs)

large::Int->Int->Int->Bool
large n p pr =  n <= (loga pr p)


loga::Int->Int->Int
loga k l = if k > l then 0 else 1 + (loga k (div l k))

multi_div::Int->Int->(Int,Int)
multi_div n divider = if mod n divider /= 0
                        then (n,0)
                        else let (q,i) = multi_div (div n divider) divider in (q,i+1)

solver::Int->Int->Int
solver n p  = if n == 1 then p
                        else if n == 2 then case_2 p else eater n p (eff_prime n p)

case_2::Int->Int
case_2 p = (last.(filter (\i -> mod p (i^2) == 0)).(takeWhile (\i-> i^2 <= p))) [1..]

main::IO()
main=do
  d<-getLine
  let n:p:[]=map read (words d)
  print (solver n p)

Measured memory_bytes: 1404
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  double ans = 0;
  for (int i = 1; i <= N; i++) {
    int score = i;
    int count = 0;
    while (score < K) {
      score *= 2;
      count++;
    }
    ans += 1.0 / pow(2,count);
  }
  
  cout << fixed << setprecision(15) << ans / N << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int W, H;
    char c;
    cin >> W >> H;
    cin >> c;

    for(int i = 1; i <= H; i++){
        for(int j = 1; j <= W; j++){
            if(i == 1 || i == H){
                if(j == 1 || j == W) cout << '+';
                else cout << '-';
            }
            else{
                if(j == 1 || j == W) cout << '|';
                else{
                    if(i == H / 2 + 1 && j == W / 2 + 1) cout << c;
                    else cout << '.';
                }
            }
        }
        cout << endl;
    }
    return 0;
}



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

int main(){
  int n, h, w;

  cin >> n >> h >> w;

  int a, b;
  int ans = 0;
  for(int i = 0;i < n;i++){
    cin >> a >> b;
    if(a >= h && b >= w){
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  ll N;
  cin>>N;
  
  vector<ll>a(N);
  ll sum=0;
  rep(i,N){
    cin>>a[i];
}
  vector<bool>ans(N);
  ll num=0;
  
  for(ll i=N-1;i>=0;i--){
    if(i==N-1){
      if(a[i]==1){
        ans[i]=true;
        num++;
      }
      else{
        ans[i]=false;
      }

      
    }
    else{
    ll sum=0;
     ll X=N/(i+1);
for(ll j=2;j<=X;j++){
  if(ans[j*(i+1)-1]){
  
sum++;
  
  }
}

    if((sum%2==1&&a[i]==0)||(sum%2==0&&a[i]==1)){
      ans[i]=true;
      num++;
    }
    else{
ans[i]=false;
    }
    }
  }

  
  cout<<num<<endl;
rep(i,N){
if(ans[i]){
  cout<<i+1<<" ";
}
}
  
  cout<<endl;
}

     
    


     
       
     

Measured memory_bytes: 2560
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

from math import sqrt

def divisor_enumeration(n):
    div = []
    for i in range(1, int(sqrt(n))+1):
        if n % i == 0:
            if n // i != i:
                div.append((i, n // i))
            else:
                div.append((i, i))
        
    return div


def main():
    N = int(readline())

    F = divisor_enumeration(N)

    ans = 10**15
    for a, b in F:
        a, b = len(str(a)), len(str(b))
        tmp = max(a, b)
        ans = min(ans, tmp)

    print(ans)
    

if __name__ == "__main__":
    main()


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

using namespace std;

#define IOS                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(NULL);                \
    cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define Debug(x) cout << #x " = " << (x) << endl
#define SORT(a) sort(a.begin(), a.end())
#define SORTR(a) sort(a.rbegin(), a.rend())
#define mod 1000000007
#define pi 3.141592653589793238
#define ll long long int
#define ull unsigned long long
#define be begin()
#define en end()
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define FORI(i, a, b) for (int i = a; i >= b; i--)

typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
typedef vector<PI> VPI;

int main()
{
    IOS;

    int a, b, c, k;
    cin >> a >> b >> c >> k;

    if (a < b && b < c)
    {
        cout << "Yes" << endl;
    }
    else
    {
        while (k > 0 && a >= b)
        {
            k--;
            b *= 2;
        }

        while (k > 0 && b >= c)
        {
            k--;
            c *= 2;
        }

        if (a < b && b < c)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <deque>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <complex>
#include <cstring>
#include <cassert>
#include <bitset>

using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, a, b) for(int i = (a); i > (b); i--)
#define forIt(it, a) for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define forRev(it, a) for(__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define ft(a) __typeof((a).begin())
#define ll long long
#define ld long double
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define bitcount(n) __builtin_popcountll(n)
#define randchar() ((rand() % 26) + 'a')


typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
typedef vector<ii> vii;
typedef vector<iii> viii;

const int N = 200000 + 7;
const int M = 1000000;
const ll MM = 1ll * M * M;
const int inf = 1e9 + 7;
const long long linf = 1ll * inf * inf;
const double pi = acos(-1);
const double eps = 1e-7;
const bool multipleTest = 0;

ll lo = 0, hi = 10000000000000000ll + 1000;
int n;
ll a[N];

void solve() {
	cin >> n;
	for (int i = 0; i < n; ++i) cin >> a[i];
	sort(a, a + n);
	
	
	ll res = 0;
	
	while (true) {
		sort(a, a + n);
//		for (int i = 0; i < n; ++i) cout << a[i] << ' '; puts("");
		int i = n - 1;
		while (i > 0 && a[i] - a[i - 1] <= n + 1) --i;
		if (i == 0) break;
		ll x = (a[i] - a[i - 1] - n - 1 + n) / (n + 1);
		int k = n - i;
		for (int j = 0; j < i; ++j) a[j] += x * k;
		for (int j = i; j < n; ++j) a[j] += x * (-n + k - 1);
		res += x * k;
//		if (a[i] - a[i - 1] <= n + 1) {
//			
//		}
	}
	
	if (a[0] >= n) {
		res += n * (a[0] - n);
		ll d = a[0] - n;
		for (int i = 0; i < n; ++i) a[i] -= d;
	}
	while (true) {
		sort(a, a + n);
		
//		for (int i = 0; i < n; ++i) cout << a[i] << ' '; puts("");
		if (a[n - 1] < n) break;
		a[n - 1] -= n;
		for (int i = 0; i + 1 < n; ++i) a[i]++;
		++res;
	}
	cout << res;
	
}

int main() {
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin);
	//	freopen("out.txt", "w", stdout);
#endif
	int Test = 1;
	if (multipleTest)
		cin >> Test;
	for(int i = 0; i < Test; ++i) {
		solve();
	}
	
#ifdef _LOCAL_
	cout<<"\n" << 1.0 * clock() / CLOCKS_PER_SEC<<endl;
#endif
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n, ans=0;
int main()
{
    cin >> n;
    ans-=n;
    for (size_t i = 0; i < n; i++)
    {
        int t;
        cin>>t;
        ans+=t;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    int n, m; cin >> n >> m;
    priority_queue<int> pq;
    for(int i = 0; i < n; i++) {
        int a; cin >> a;
        pq.push(a);
    }

    for(int i = 0; i < m; i++) {
        int temp = pq.top();
        pq.pop();
        temp /= 2;
        pq.push(temp);
    }

    int ans = 0;
    while(!pq.empty()) {
        ans += pq.top();
        pq.pop();
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define Fast_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int32_t main()
{	
	Fast_IO
	#ifdef __WIN32 
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w",stdout);
	#endif
	int n;cin>>n;

	int in[3];
	int ou[3];
	vector<int> dp(3,0);
	for(int ii=0;ii<n;ii++){
		vector<int>dpo(3,0);
		for(int j=0;j<3;j++){
			cin>>in[j];
		}
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				if(i!=j){
					dpo[j] = max(dpo[j],dp[i]+in[j]);
				}
			}
		}
		dp=dpo;
	}	
	cout<<max({dp[0],dp[1],dp[2]});
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<int>>;


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




int main() {
    ll a,b;
    cin >> a>> b;
    cout << a*b  << endl;
}



Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000

// 🔴

// O(ElogE)

// pq<pair> はfirstが大きい順に出てくるのですか？
// s:= 開始ノード  v:= 頂点数  adjlist:= 隣接リスト (first:= コスト   second:= 行先)
vector<long long> dijk(int s, int v, vector<vector<pair<int, int> > > adjlist){
    
    priority_queue <pair<int, int> > wait;
    vector<long long> result(v, INF);

    //スタート地点を追加
    result[s] = 0;
    wait.push(make_pair(0, s));

    //ダイクストラ本体
    while(!wait.empty()){    //waitが空になるまで

        int nowpoint = wait.top().second;
        int nowcost = -wait.top().first;
        wait.pop();

        if(result[nowpoint] < nowcost) continue;


        //今いる頂点と隣接しているすべての頂点をなめる
        for(int i = 0; i < adjlist[nowpoint].size(); i++){

            int nextpoint = adjlist[nowpoint][i].second;
            int nextcost = nowcost + adjlist[nowpoint][i].first;
            //現時点より安く到達できそうであれば、結果を更新して優先度付きキューに格納
            if(result[nextpoint] > nextcost){
                result[nextpoint] = nextcost;
                wait.push(make_pair(-nextcost, nextpoint));
            }
        }
    }
    
    return result;         //結果列を返す
}

int main(){

    int V, E, S, G; cin >> V >> E >> S >> G;     // V:= 頂点の数    E:= 辺の数    S:= スタートノード　　G:= ゴールノード
    S--;
    G--;
    vector<vector<pair<int, int> > > adjlist(V);      //first := コスト　second := 行先

    //入力
    for(int i = 0; i < E; i++){
        int a, b; cin >> a >> b;                    // a ,b 間に辺がある
        a--;
        b--;
        adjlist[a].push_back(make_pair(1, b));
        adjlist[b].push_back(make_pair(1, a));      
    }

    //int a, b; cin >> a >> b;
    //adjlist[a].push_back(make_pair(1, b));
    //adjlist[b].push_back(make_pair(1, a)); 
    

    vector<long long> result_S(V);                 //Sからの距離
    vector<long long> result_G(V);                 //Gからの距離
    result_S = dijk(S, V, adjlist);
    result_G = dijk(G, V, adjlist);    
    //cout << result[G] << endl;

    vector<long long> s(1000000, 0);
    vector<long long> g(1000000, 0);
    for(int i = 0; i < V; i++){

        if(result_S[i] < 10000000) s[result_S[i]]++;
        
        if(result_G[i] < 10000000) g[result_G[i]]++;        
    }

    long long ans = 0;
    long long dis = result_S[G] - 2;
    //cout << dis << endl;
    //result[S];
    for(int i = 0; dis - i >= 0; i++){
        
        //cout << i << " " << dis - i << " " << s[i] << " " << g[i] << endl;
        
        ans += s[i] * g[dis - i];
        //else ans += result_S[i] * result_G[dis - i] + result_S[dis - i] * result_G[i];
        //cout << i << ": " << result_S[i] << " " << result_G[i] << endl;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 27468
N, K = map(int, input().split())


class MathUtil:
    # calculate {m+n}C{n}
    def egcd(self, a: int, b: int):
        if a == 0:
            return b, 0, 1
        else:
            g, y, x = self.egcd(b % a, a)
            return g, x - (b // a) * y, y

    def modinv(self, a: int, m: int):
        g, x, y = self.egcd(a, m)
        if g != 1:
            raise Exception('modular inverse does not exist')
        else:
            return x % m

    def combination(self, n: int, r: int, mod: int = 10**9+7) -> int:
        r = min(r, n-r)
        res = 1
        for i in range(r):
            res = res * (n-i) * self.modinv(i+1, mod) % mod
        return res


m = 10**9+7
for i in range(1, K+1):
    a = MathUtil().combination(K-1, i-1, m)
    if N-K+1 >= i:
        b = MathUtil().combination(N-K+1, i, m)
    else:
        b = 0
    print((a*b) % m)


Measured memory_bytes: 68440
n=int(input())
i=0
while i<n:
    a,b,c=map(int,input().split())
    if a*a+b*b==c*c:
        print("YES")
    elif a*a+c*c==b*b:
        print("YES")
    elif b*b+c*c==a*a:
        print("YES")
    else:
        print("NO")
    i=i+1


Measured memory_bytes: 5592
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define F first
#define S second
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

#define error(args...) {vector<string>_v=split(#args,',');err(_v.begin(),args);cout<<endl;}
vector<string> split(const string &s, char c) {vector<string>v; stringstream ss(s); string x;
while (getline(ss, x, c))v.emplace_back(x); return move(v);} void err(vector<string>::iterator it) {}
template<typename T, typename... Args>void err(vector<string>::iterator it, T a, Args...args) {
cout << it->substr((*it)[0] == ' ', it->length()) << " = " << a << " "; err(++it, args...);}

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 41;
ll vis[N],res[N];
int m[10010];

int solve() 
{
	//happy coding

	int n;
	cin>>n;
	int N = sqrt(n);
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++){
			for(int k=1;k<=N;k++){
				int x = ((i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(i*k));
				if(x<=n)m[x]++;
			}
		}
	}

	for(int i=1;i<=n;i++){
		cout<<m[i]<<endl;
	}


	
	return 0;
}
int main(){
	int test = 1;
  	//scanf("%d", &test);
  	while (test--)solve();return 0;
}

Measured memory_bytes: 3540
#include <iostream>
#include <cstdlib>
#include <vector>

using namespace std;

int main(){
	int N;
	vector<int> A;
	cin >> N;
	for(int i = 0;i < N;i++){
		int temp;
		cin >> temp;
		A.push_back(temp);
	}
	long long int mx = 2;
	long long int mn = 2;
	for(int i = N-1;i >= 0;i--){
		if(A[i] > mx){
			cout << -1 << endl;
			return 0;
		} else{
			long long int tempmn = (mn - 1) / A[i];
			long long int tempmx = mx/A[i];
			tempmn++;
			if(tempmn > tempmx){
				cout << -1 << endl;
				return 0;
			} else{
				mn = tempmn*A[i];
				mx = (tempmx+1)*(A[i])-1;
			}
		}
	}
	cout << mn << " " << mx << endl;
	return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++){
        for(int j=0;j<n;j++){
            s[i]++;
            if(s[i]>'Z') s[i]='A';
        }
    }
    cout<<s<<endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int D, G;
    cin >> D >> G;
    vector<P> pc(D);
    rep(i, D){ cin >> pc[i].first >> pc[i].second;}

    int ans = 1e9;
    rep(i, (1<<D)){
        int tans = 0;
        int remain = G;
        for (int j = D-1; j >= 0; j--)
        {
            int ten = j*100 + 100;
            if ((i>>j)&1){
                if (remain <= pc[j].first*ten) {
                    tans += (remain + (ten) -1)/ (ten);
                    remain = 0; 
                } else {
                    tans += pc[j].first;
                    remain -= pc[j].first*ten + pc[j].second;
                }
                if (remain <= 0) break;
            }
        }
        if (remain > 0) continue;
        //cout << tans << endl;
        ans = min(ans, tans);
    }
    cout << ans << endl;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
inline int rd(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 5e5+5, oo = 0x3f3f3f3f;
int n, p, q, l[N], r[N], ans; pii v[N];
int main()
{
    n = rd(), p = oo; for(int i = 1; i <= n; ++i) l[i] = rd(), r[i] = rd(), p = min(p, r[i]), q = max(q, l[i]);
    for(int i = 1; i <= n; ++i) v[i].fi = p-l[i]+1, v[i].se = r[i]-q+1, ans = max(ans, r[i]-l[i]+1+max(p-q+1, 0));
    sort(v+1, v+n+1); for(int i = 1, w = oo; i < n; ++i) w = min(w, v[i].se), ans = max(ans, w+v[i+1].fi);
    printf("%d\n", ans);
    return 0;
}

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

int main() {
    ll h, n;
    cin >> h >> n;

    rep(i, n) {
        int a;
        cin >> a;
        h -= a;
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstring>
#include <limits>
using namespace std;
#define lli long long int
#define X first
#define Y second
#define fw(i, start, end) for (lli i = start; i < end; ++i)
#define fe(i, start, end) for (lli i = start; i <= end; ++i)
#define pi 3.141592
#define L(T)  \
    lli T;    \
    cin >> T; \
    while (T--)
#define FASTIO                   \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);            \
    cout.tie(nullptr);
int main()
{
    FASTIO
    //   L(T)
    {
       double n;
        cin>>n;
        cout<<2*pi*n<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3804
#include <iostream>

using namespace std;

class Array
{
public:
    Array();
    ~Array();

    int length, *p;

    void print();
};

Array a[2];
bool solve(int, int);

int main()
{

// Input
    for(int j=0; j<=1; ++j)
    {
        cin >> a[j].length;
        a[j].p = new int[a[j].length];
        for(int i=0; i<=a[j].length-1; ++i)
            cin >> a[j].p[i];
        
        //a[j].print();
    }

    bool ret;
    for(int i=0; i<a[1].length; ++i)
    {
        ret = solve(0, a[1].p[i]);
        if(ret == false) cout << "no" << endl;
        else cout << "yes" << endl;
    }
      
    return 0;
}

Array::Array()
{
    length = 0;
    p = nullptr;
}

Array::~Array()
{
    delete [] p;
    //cout << "DELETE ARRAY" << endl;
}

void Array::print()
{
    for(int i=0; i<length; ++i)
    {
        if(i) cout << " ";
        cout << p[i];
    }
    cout << endl;
}

bool solve(int i, int m)
{
    if(m == 0)
        return (true);
    
    if(i >= a[0].length)
        return (false);
    
    bool res = solve(i+1, m) || solve(i+1, m-a[0].p[i]);
    
    return (res);
}


Measured memory_bytes: 3104
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-9;
const int inf=1e8;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
	int a,b;
	cin>>a>>b;
	if(a==b)cout<<"Draw"<<endl;
	else{
		if(a==1)cout<<"Alice"<<endl;
		else if(b==1)cout<<"Bob"<<endl;
		else if(a>b)cout<<"Alice"<<endl;
		else cout<<"Bob"<<endl;
	}
}











Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{

  long long int n;
  char s[4000];

  long long int count_R=0, count_G=0, count_B=0;
  long long int ans=0, not_ans=0;
  long long int i, j;

  scanf("%lld", &n);
  scanf("%s", s);

  for (i=0;i<n;i++) {
    switch (s[i]) {
    case 'R': count_R++; break;
    case 'G': count_G++; break;
    case 'B': count_B++; break;
    }
  }

  ans = count_R*count_G*count_B;

  for (i=0;i<n;i++) {
    for (j=1;j<=(n-1-i)/2;j++) {
      if (s[i]!=s[i+j] && s[i+j]!=s[i+j+j] && s[i+j+j]!=s[i])
	not_ans++;
    }
  }

  ans -= not_ans;

  printf("%lld", ans);

  return 0;
}


Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define T() int t; cin>>t; while(t--)                      
#define pb push_back
#define endl "\n"

int main()
{	
	FIO;
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	string s,t;
	cin>>s>>t;

	ll cnt = 0;
	for(int i=0;i<s.size();i++){
		if(s[i]!=t[i]) cnt++;
	}
	
	cout<<cnt<<endl;

	return 0;
	
}

Measured memory_bytes: 3808
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int A = sc.nextInt();
		int count = 0;
		while(H > 0) {
			H = H - A;
			count++;
			}
		System.out.println(count);
	}
}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using f64 = double;
using f80 = long double;

#define FOR(v, a, b) for(i64 v = (a); v < (b); ++v)
#define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(i64 v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}

template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}

template <typename T> void print(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void print(const T &value, const Args&... args){std::cout << value << " ";print(args...);}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;

/**
 * @title 素因数分解
 * @docs prime_factorize.md
 */
auto prime_factorize(int64_t n){
  std::vector<std::pair<int64_t,int64_t>> ret;
  for(int64_t i = 2LL; i * i <= n; ++i){
    if(n % i == 0){
      int64_t c = 0;
      while(n % i == 0){
        n /= i;
        ++c;
      }
      ret.emplace_back(i, c);
    }
  }
  if(n != 1) ret.emplace_back(n, 1);
  return ret;
}



int main(){
  i64 N;

  while(cin >> N){
    auto res = prime_factorize(N);

    dump(res);

    i64 ans = 0;

    for(auto [x, c] : res){

      int s = 0;
      FORE(i,1,200){
        if(s + i > c) break;
        s += i;
        ans += 1;
      }
    }

    print(ans);
  }

  return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#include<tr1/unordered_map>
#define pb push_back
#define pii pair<int,int>
#define SZ(x) (int)x.size()
#ifdef __linux__
#define getchar getchar_unlocked
#endif
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
typedef long long LL;
using namespace std;
const int N=110;
const int inf=0x3f3f3f3f;
const LL mod=1e9+7;
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
#ifdef ztzshiwo
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
}
int n,K;
char str[N];
int st[N],a[N],len,p[N];
LL fac[N],ifac[N],C[N][N],ans;
inline void Add(LL&x,LL y){x=x+y<mod?x+y:x+y-mod;}
inline LL qpow(LL a,LL b)
{
	LL ret=1;
	for(;b;b>>=1,a=a*a%mod)
		if(b&1)ret=ret*a%mod;
	return ret;
}
inline bool check(int tot)
{
	int cnt=0,cntr=tot,cntb=tot;
	For(i,1,K)
	if(str[i]=='r')
	{
		if(cntr)cntr--;
		else cnt-=cnt>0;
	}
	else
	{
		if(cntb>cntr&&cntb&&st[cntb])cnt+=st[cntb--]-1;
		else cnt-=cnt>0;
	}
	return !cnt&&!cntr&&(!cntb||st[cntb]==0);
}
LL b[N],r[N],w[N],f[N],g[N];
inline LL CC(int a,int b)
{
	if(b==0)return a==0;
	return C[a+b-1][b-1];
}
inline LL Solve(int tot,int res)
{
	int bcnt=0,rcnt=0,wcnt=0;
	For(i,1,tot)
	{
		bcnt+=st[i];
		rcnt+=st[i]+1;
	}
	wcnt=tot+1;
	For(i,0,res)f[i]=0;
	For(i,0,res)g[i]=0;
	//printf("r:%d b:%d w:%d\n",rcnt,bcnt,wcnt);
	For(i,0,res)
		For(j,0,res-i)
			Add(f[i+j],CC(i,rcnt)*CC(j,bcnt)%mod);
	//For(i,0,res)printf("%lld ",f[i]);puts("");
	For(i,0,res)
		For(j,0,res-i)
			Add(g[i+j],f[i]*CC(j,wcnt)%mod);
	//For(i,0,res)printf("%lld ",g[i]);puts("");
	//printf("%lld\n",g[res]);
	return g[res];
}
inline void dfs(int cnt,int res,int now,LL val)
{
	if(res-max(now*2-1,1)-1<0)
	{
		if(check(cnt))
		{
			//For(i,1,cnt)printf("%d ",st[i]);
			//printf("res:%d\n",res);
			LL ret=Solve(cnt,res)*fac[cnt]%mod*val%mod;
			//printf("%lld\n",ret);
			Add(ans,ret);
		}
		return;
	}
	dfs(cnt,res,now+1,val);
	For(i,1,res)
	{
		st[cnt+i]=now;
		int l=res-max(now*2-1,1)*i-i;
		if(l>=0)dfs(cnt+i,l,now+1,val*ifac[i]%mod);
		else break;
	}
}
inline void init(int n)
{
	fac[0]=ifac[0]=1;
	For(i,1,n)fac[i]=fac[i-1]*i%mod;
	ifac[n]=qpow(fac[n],mod-2);
	rFor(i,n,2)ifac[i-1]=ifac[i]*i%mod;
	C[0][0]=1;
	For(i,1,n)For(j,0,i)C[i][j]=(C[i-1][j]+(j?C[i-1][j-1]:0))%mod;
}
int main()
{
	file();
	read(n),read(K);
	init(100);
	scanf("%s",str+1);
	dfs(0,n+1,0,1);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll> 
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,q,x;cin>>a>>b>>q;
  ll sl,su,tl,tu,slpos,supos,tlpos,tupos;
  lvector S(a,0),T(b,0),ans(q,0);
  rep(i,a) cin>>S[i];rep(i,b) cin>>T[i];
  rep(i,q) {
    cin>>x;
    slpos=distance(S.begin(),lower_bound(ALL(S),x));
    supos=distance(S.begin(),upper_bound(ALL(S),x));
    tlpos=distance(T.begin(),lower_bound(ALL(T),x));
    tupos=distance(T.begin(),upper_bound(ALL(T),x));
    if(slpos==supos) slpos--;if(tlpos==tupos) tlpos--;
    if(x<=S[0]) sl=-1e12;else sl=S[slpos];
    if(x<=T[0]) tl=-1e12;else tl=T[tlpos];
    if(S[a-1]<=x) su=1e12;else su=S[supos];
    if(T[b-1]<=x) tu=1e12;else tu=T[tupos];
    ll ans1=abs(x-min(sl,tl));
    ll ans2=abs(x-max(su,tu));
    ll ans3=2*min(abs(x-sl),abs(x-tu))+max(abs(x-sl),abs(x-tu));
    ll ans4=2*min(abs(x-su),abs(x-tl))+max(abs(x-su),abs(x-tl));
    ans[i]=min({ans1,ans2,ans3,ans4});
  }
  rep(i,q) print(ans[i]);
  return 0;
}

Measured memory_bytes: 3712
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	ll n = in();
	double ans = 0;
	REP(i, n) {
		double x = in<double>();
		string u = in<string>();
		if (u == "JPY") {
			ans += x;
		} else {
			ans += x * 380000;
		}
	}
	SETP(20);
	cout << ans << endl;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;

#define fill(a,x) memset(a,x,sizeof(a)) 
#define pb push_back
#define sz(x) (int)x.size() 
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const ll INF = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+10; 

int main(){
  fast;
  ll a,b,c;
  cin>>a>>b>>c;
  if(a%2 or b%2 or c%2)
  {
  	cout<<0;
  	return 0;
  }

  if(a==b and b==c)
  {
  	cout<<-1;
  	return 0;
  }

  int ans=0;
  while(a%2==0 and b%2==0 and c%2==0)
  {
  	ans++;
  	ll newa=(b+c)/2;
  	ll newb=(a+c)/2;
  	ll newc=(a+b)/2;
  	a=newa;
  	b=newb;
  	c=newc;
  }

  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(void){
int n;
double t,a;
cin >> n;
cin >> t;
cin >> a;
int h[n];
for(int i=0;i<n;i++){
cin >> h[i];
}
 
double sa[n];
for(int i=0;i<n;i++){
sa[i]=a-(t-h[i]*0.006);
if(sa[i]<0){
sa[i] = -sa[i];
}
}
 
double hikaku = 9999;
int out = -1;
 
for(int i=0;i<n;i++){
if(sa[i]<hikaku){
hikaku = sa[i];
out = i+1;
}
}
 
cout << out <<endl;
return 0;
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;


template <typename T, T F(T, T), T ZERO>
struct SegmentTree {
    ll n;
    vector<T> v;

    SegmentTree(ll n_){
        n = 1;
        while(n < n_){ n *= 2; }
        v.resize(2 * n - 1);
        fill(v.begin(), v.end(), ZERO);
    }

    // zero-indexed
    void update(ll k, T a){
        k += n - 1;
        v[k] = a;
        while(k > 0){
            k = (k - 1) / 2;
            v[k] = F(v[k * 2 + 1], v[k * 2 + 2]);
        }
    }

    // [a, b), zero-indexed
    T query(ll a, ll b) const {
        return query_internal(a, b, 0, 0, n);
    }

    T get(ll a) const {
        return query(a, a + 1);
    }

    T query_internal(ll a, ll b, ll k, ll l, ll r) const {
        if(r <= a || b <= l){ return ZERO; }
        if(a <= l && r <= b){
            return v[k];
        }else{
            T v1 = query_internal(a, b, k * 2 + 1, l, (l + r) / 2);
            T v2 = query_internal(a, b, k * 2 + 2, (l + r) / 2, r);
            return F(v1, v2);
        }
    }
};


ll add(ll x, ll y){ return x + y; }

int main(){
    ll n, q;
    cin >> n >> q;

    vector<ll> c(n);
    REP(i, n){ cin >> c.at(i); }

    vector<array<ll, 3>> lr(q);
    REP(i, q){
        cin >> lr.at(i).at(0) >> lr.at(i).at(1);
        lr.at(i).at(0)--;
        lr.at(i).at(1)--;
        lr.at(i).at(2) = i;
    }
    sort(ALL(lr));

    vector<ll> nxt(n, -1);
    map<ll, ll> cur;
    RREP(i, n){
        const ll ci = c.at(i);
        if(cur.count(ci)){
            nxt.at(i) = cur.at(ci);
        }
        cur[ci] = i;
    }

    SegmentTree<ll, add, 0LL> st(n);
    for(auto it = cur.begin(); it != cur.end(); ++it){
        st.update(it->second, 1);
    }

    vector<ll> ans(q, 0);
    ll lr_index = 0;
    REP(i, n){
        while(lr_index < lr.size() && lr.at(lr_index).at(0) == i){
            ans.at(lr.at(lr_index).at(2)) = st.query(
                lr.at(lr_index).at(0), lr.at(lr_index).at(1) + 1);
            lr_index++;
        }
        if(nxt.at(i) != -1){
            st.update(nxt.at(i), 1);
        }
    }

    REP(i, q){
        cout << ans.at(i) << endl;
    }
    return 0;
}


Measured memory_bytes: 66676
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final long x = in.nextLong();
        int res = 0;
        long curr = 100;
        while (curr < x) {
            curr += curr / 100;
            res++;
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 35740
#include<stdio.h>
int main(){
  int H,W,i,j;
  for(;;){
    scanf("%d %d",&H,&W);
    if(H==0&&W==0)break;
    for(j=0;j<H;j++){
      for(i=0;i<W;i++){
	if((i+j)%2==0){
	  printf("#");
	}else{
	  printf(".");
	}
      }printf("\n");
    }printf("\n");
  }
  return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
inline int_fast64_t read(){int_fast64_t 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*10+c-'0',c=getchar();return x*f;}
inline string read_s(){string s="";char c=getchar();while(c<'!'||c>'~'){c=getchar();}while(c>='!'&&c<='~'){s+=c;c=getchar();}return s;}
void Main(){
    read();
    int K = read();
    string S = read_s();
    S[K-1] += 32;
    printf("%s\n", S.c_str());
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const ll MOD = (ll)(1e9 + 7);
ll dp[1024][1024];
int main2() {
  int N = nextInt();
  int K = nextInt();
  CLR(dp, 0);
  dp[0][0] = 1;
  for (int i = 0; i < N; i++) {
    for (int k = 0; k <= K; k++) {
      if (dp[i][k] != 0) {
        (dp[i+1][k] += k * dp[i][k]) %= MOD;
        (dp[i+1][k+1] += (K - k) * dp[i][k]) %= MOD;
      }
    }
  }
  ll ans = dp[N][K];
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}



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

#define ll long long
#define mp make_pair
#define pb push_back

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)

const int maxn = 2005;
int n;
int a[maxn];
vector <int> g[maxn], ng[maxn];
bool vis[maxn];

void dfs(int u) {
	vis[u] = 1;
	rep(i, g[u].size()) {
		int v = g[u][i];
		if (!vis[v]) dfs(v), ng[u].pb(v);
	}
}

int main() {
	scanf("%d", &n);
	rep(i, n) scanf("%d", &a[i]);
	sort(a, a + n);
	rep(i, n) rep(j, i) if (__gcd(a[i], a[j]) > 1) g[i].pb(j), g[j].pb(i);
	priority_queue <pair <int, int> > pq;
	rep(i, n) if (!vis[i]) dfs(i), pq.push(mp(a[i], i));
	while (!pq.empty()) {
		int u = pq.top().second;
		pq.pop();
		printf("%d ", a[u]);
		rep(i, ng[u].size()) {
			int v = ng[u][i];
			pq.push(mp(a[v], v));
		}
	}
	puts("");
	return 0;
}


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

using namespace std;
int main(){
  int d;
  cin >> d;
  vector<int> c(26),tmp(26);
  vector<vector<int>> s;
  for(int i=0;i<26;i++){
    cin >> c[i];
  }
  for(int i=0;i<d;i++){
    for(int j=0;j<26;j++){
      cin >> tmp[j];
    }
    s.push_back(tmp);
  }
  vector<int> t(d,1);
  
  vector<int> v(d+1,0),last(26,0);
  for(int i=1;i<d+1;i++){
    for(int j=1;j<=26;j++){
      int v_tmp = v[i-1] + s[i-1][j-1];
      for(int k=0;k<26;k++){
        if(k!=j-1){
          v_tmp -= c[k] * (i - last[k]);
        }
      }
      if(v[i]==0||v_tmp>v[i]){
        v[i] = v_tmp;
        t[i-1] = j;
      }
    }
    last[t[i-1]-1] = i;
  }
  
  //cout << v[d] << endl;
  for(int i=0;i<d;i++){
    cout << t[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3684
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)


int main() {
  string s,t;
  cin >> s >> t;
  int n = s.size();
  
  string ss = s+s;
  
  rep(i,n) {
    if(ss.substr(i,n)==t) {
    cout << "Yes" << endl;
    return 0;
    }
  }
  
  cout << "No" << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define Rep(i,n) for(int i=1;i<=(n);++i)
using LL = long long;
using ULL = unsigned long long;

const int mod = 998244353;
const double pi = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int dx[]{-1, 0, 1, 0};
const int dy[]{0, -1, 0, 1};

char s[1000123];
int dis[1000123];

int main()
{
    int h, w, k;
    cin >> h >> w >> k;
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    --x1; --y1; --x2; --y2;
    rep(i, h) scanf("%s", s+w*i);
    memset(dis, 0x3f, sizeof dis);
    queue<int> qx, qy;
    qx.push(x1); qy.push(y1);
    dis[x1*w+y1] = 0;
    while(!qx.empty()) {
        int x0 = qx.front(), y0 = qy.front();
        qx.pop(); qy.pop();
        rep(d, 4) {
            int x = x0, y = y0;
            Rep(i, k) {
                x += dx[d]; y += dy[d];
                if(x == -1 || x == h || y == -1 || y == w || s[x*w+y] == '@' || dis[x*w+y] <= dis[x0*w+y0]) break;
                if(dis[x*w+y] == INF) {
                    qx.push(x), qy.push(y);
                    dis[x*w+y] = dis[x0*w+y0] + 1;
                }
            }
        }
    }
    cout << (dis[x2*w+y2] == INF ? -1 : dis[x2*w+y2]) << endl;
    return 0;
}



Measured memory_bytes: 9212
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
string a;
int main()
{
	cin>>a;
	if(a.length()<4)printf("No\n");
	else if(a[0]=='Y'&&a[1]=='A'&&a[2]=='K'&&a[3]=='I')printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
A, B, C, D = map(int, input().split())

turn_T = 0
turn_A = 0

while C > 0:
    C -= B
    turn_A += 1


while A > 0:
    A -= D
    turn_T += 1

if turn_A <= turn_T:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9180
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

int n, t, a, h[1003], x, ans = 0;

int main(){
	ios::sync_with_stdio(false);
	cin >> n >> t >> a;

	a *= 1000;
	t *= 1000;

	for(int i = 0; i < n; ++i) {
		cin >> x;
		h[i] = t - 6*x;
		if(abs(a - h[i]) < abs(a - h[ans])) ans = i;
	}
	cout << ans + 1 << endl;



    return 0;
}


Measured memory_bytes: 256