akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <bits/stdc++.h>
  
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
  
using namespace std;
  
const int N = 1000000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int PPP = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

void add(int &x, int y)
{
    x += y;
    if (x >= MOD)
        x -= MOD;
}

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    //ll TL = 2.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int n;
    string a, b;
    cin >> n >> a >> b;
    int dp[n][9][9];
    rep(i, 0, n)
        rep(x, 0, 9)
            rep(y, 0, 9)
                dp[i][x][y] = 0;
    if (a[0] == b[0])
    {
        rep(x, 0, 3)
            dp[0][x][x] = 1;
    }
    else
    {
        rep(x, 0, 3)
            rep(y, 0, 3)
                if (x != y)
                    dp[0][x][y] = 1;
    }
    rep(i, 1, n)
    {
        if (a[i] == b[i])
        {
            rep(x, 0, 3)
                rep(x1, 0, 3)
                    rep(y1, 0, 3)
                        if (x != x1 && x != y1)
                            add(dp[i][x][x], dp[i - 1][x1][y1]);
        }
        else
        {
            rep(x, 0, 3)
                rep(y, 0, 3)
                {
                    if (x == y)
                        continue;
                    rep(x1, 0, 3)
                        rep(y1, 0, 3)
                        {
                            bool b1 = (a[i - 1] == a[i] && x1 == x) || (a[i - 1] != a[i] && x1 != x);
                            bool b2 = (b[i - 1] == b[i] && y1 == y) || (b[i - 1] != b[i] && y1 != y);
                            if (b1 && b2)
                                add(dp[i][x][y], dp[i - 1][x1][y1]);
                        }
                }
        }
    }
    int ans = 0;
    rep(x, 0, 3)
        rep(y, 0, 3)
            add(ans, dp[n - 1][x][y]);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
    static void reconstruction(
            Iterator<Integer> preItr, List<Integer> inWalked, List<Integer> postWalked, int l, int r) {
        if (l >= r) return;

        int curr = preItr.next();
        int m = inWalked.indexOf(curr);

        reconstruction(preItr, inWalked, postWalked, l, m);
        reconstruction(preItr, inWalked, postWalked, m + 1, r);

        postWalked.add(curr);
    }

    public static void main(String[] args) {
        try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
            final int n = Integer.parseInt(in.readLine());
            List<Integer> preWalked = Stream.of(in.readLine().split(" "))
                    .map(Integer::valueOf)
                    .collect(Collectors.toList());
            List<Integer> inWalked = Stream.of(in.readLine().split(" "))
                    .map(Integer::valueOf)
                    .collect(Collectors.toList());

            List<Integer> postWalked = new ArrayList<>(n);

            reconstruction(preWalked.iterator(), inWalked, postWalked, 0, n);

            System.out.println(postWalked.stream().map(String::valueOf).collect(Collectors.joining(" ")));

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}



Measured memory_bytes: 31300
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int main() {
    double a, b, x; cin >> a >> b >> x;
    double ans;
    if(2 * x > a * a * b) ans = atan(2 * b / a - 2 * x / (a * a * a)) * 180 / PI;
    else ans = 90 - atan(2 * x / (a * b * b)) * 180 / PI;
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

// const int INF = 1 << 31;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

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

  vector<int> h(N);
  rep (i, N) cin >> h[i];

  ll lb = 1;
  ll ub = 1e9 + 5;

  while (lb < ub) {
    ll mid = (lb + ub) / 2;

    ll aCnt = 0;
    rep (i, N) {
      ll hp = h[i] - mid * B;
      if (hp > 0) aCnt += hp / (A - B) + (hp % (A - B) ? 1 : 0);
    }

    if (aCnt > mid) lb = mid + 1;
    else ub = mid;
  }

  cout << lb << endl;
}


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

int main() {
    int a[6];
    for(int i=1;i<=5;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<6;i++)
    {
        if(a[i]==0)
        {
            cout<<i<<endl;
            break;
        }
    }
}


Measured memory_bytes: 3624
#include <stdio.h>
main()
{
	int N;
	int D;
	int n;
	
	scanf("%d",&N);
	scanf("%d",&D);
	
	if (N%(2*D+1)==0)
	{
		int a = N/(2*D+1);
		printf ("%d",a);
	}	
	else 
	{
		int m = N/(2*D+1)+1;
 		printf("%d",m) ;
	}
} 

Measured memory_bytes: 2128
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) throws IOException {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int A[] = new int[n];
		for (int i = 0; i < n; i++) {
			A[i] = scanner.nextInt();
		}

		System.out.println(Arrays.toString(A).replaceAll("[,\\[\\]]", ""));
		for (int j = 1; j < A.length; j++) {
			int key = A[j];
			int i = j - 1;
			while (i >= 0 && A[i] > key) {
				A[i + 1] = A[i];
				i--;
			}
			A[i + 1] = key;
			System.out.println(Arrays.toString(A).replaceAll("[,\\[\\]]", ""));
		}
	}
}

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

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define	IOS ios_base::sync_with_stdio(0);
#define en "\n"
#define FOR(i, j, n) for(int j = i; j < n; ++j)
#define forn(i, j, n) for(int j = i; j <= n; ++j)
#define nfor(i, j, n) for(int j = n; j >= i; --j)
#define sortv(vv) sort(vv.begin(), vv.end())
#define all(v) v.begin(), v.end()
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>


using namespace std;
const ll maxn=1e6+100,inf=1e18,LOG=23,mod=1e9+7;
int block = 300, timer = 0;
const ld EPS = 1e-7;

#define bt(i) (1 << (i))
#define int ll

int n, ans;

main()
{
	cin >> n;
	forn(1, i, n)
	{
		if(i % 3 == 0 || i % 5 == 0)
		{
			continue;
		}
		ans += i;
	}
	cout << ans;
}

Measured memory_bytes: 3564
function main(input) {
    input = input.split("\n");
    var n = parseInt(input[0]);
    var Ps = input[1].split(" ").map((v) => parseInt(v, 10));

    var count = 0;
    for(var i = 1; Ps.length - 1 > i; i++) {
        if (Math.min(Ps[i - 1], Ps[i], Ps[i + 1]) >= Ps[i]) {
            continue;
        }
        if (max = Math.max(Ps[i - 1], Ps[i], Ps[i + 1]) <= Ps[i]) {
            continue;
        }

        count++;
    }

    console.log(count);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
N = int(input())
p_list = list(map(int,input().split()))
ans_list=[]
M = int(input())
for _ in range(M):
  ite,mount=map(int,input().split())
  temp_p = p_list.copy()
  temp_p[ite-1]=mount
  print(sum(temp_p))

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
a = [0]*k
has_k = [False]*n
count = 0

for i in range(k):
    tmp_d = int(input())
    tmp_a = list(map(int, input().split()))
    for ai in tmp_a:
        has_k[ai-1] = True

for ki in has_k:
    if ki == False:
        count += 1

print(count)


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

int main() {
  // ここにプログラムを追記
  int s1, s2, s3, sss;
  cin >> sss;
  s1=sss/100;
  s2=sss/10-10*s1;
  s3=sss-100*s1-10*s2;
  cout << s1+s2+s3 << endl;
}

Measured memory_bytes: 256
from collections import*
import sys
sys.setrecursionlimit(10**8)
input=sys.stdin.readline

n=int(input())
d={}

q=[]
for i in range(n-1):
    a,b=map(int,input().split())
    if a not in d:
        d[a]=[]
    if b not in d:
        d[b]=[]
    d[b].append(a)
    d[a].append(b)        
    q.append(tuple(sorted([a,b])))

m=max(map(len,d.values()))
print(m)

dcolars={}

def BFS(d,point,c):
    for i in d[point]:
        if tuple(sorted([point,i])) not in dcolars:
            c+=1
            if c==m+1:
                c=1
            dcolars[tuple(sorted([point,i]))]=c
            BFS(d,i,c)
    return dcolars

ans=BFS(d,1,0)

for i in q:
    print(ans[i])

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

int main() {
  int N;
  cin >> N;
  vector<int>A(N);
  int ans=0;
  for(int i=0;i<N;i++){
    cin>>A[i];
    if(A[i]%2==0){
      if(A[i]%3==0){
        ans++;
      }
      else if(A[i]%5==0){
        ans++;
      }
      else{
        ans*=0;
        break;
      }
    }
    else{
      ans++;
    }
  }
  if(ans>0){
    cout<<"APPROVED"<<endl;
  }
  else{
    cout<<"DENIED"<<endl;
  }
}

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

int main(){
    int n;
    cin >> n;
    long long int arr[n];
    for(int i=0;i<n;i++){
    	cin >> arr[i];
    }
    long long int best = 0;
    long long int count = 0;
    for(int i=0;i<n;i++){
    	if(arr[i]>=best){
    		best = arr[i];
    	}
    	else{
    		count+=best-arr[i];
    	}
    }
    cout << count << endl;
	return 0;
}

Measured memory_bytes: 5096
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
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; }
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)



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

    string result="";
    while(n){
        n--;
        result+=(char)('a'+(n%26));
        n/=26;
    }

    reverse(result.begin(),result.end());
    cout<<result<<endl;
}

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

typedef long long ll;
const int maxn=1e5+5;

int main(){
	int n,t,tt;
	while(~scanf("%d",&n)){
		int vis[13]={0};
		for(int i=0;i<n;i++){
			scanf("%d",&t);
			vis[t]++;
		}
		int f=0;
		for(int i=0;i<=12;i++){
			if(vis[i]>=3){	
				f=1;
				break;
			}
		}
		if(f){
			puts("0");
			continue;
		}
		vector<int> a,b,c;
		c.push_back(0);
		for(int i=0;i<=12;i++){
			if(vis[i]==1) a.push_back(i);
			if(vis[i]==2) c.push_back(i),c.push_back(24-i); 	
		}
		tt=24;
		for(int j=0;j<c.size()-1;j++){
				for(int k=j+1;k<c.size();k++){
					int t1=min(abs(c[j]-c[k]),24-abs(c[j]-c[k]));
					tt=min(t,t1);
				}
		}	
		int num=a.size(),ans=0;
		for(int i=0;i<(1<<num);i++){
			b=a;
			for(int j=0;j<num;j++){
				if(i&(1<<j)) b[j]=24-b[j];
			}
			t=tt;
			for(int j=0;j<num-1;j++){
				for(int k=j+1;k<num;k++){
					int t1=min(abs(b[j]-b[k]),24-abs(b[j]-b[k]));
					t=min(t,t1);
				}	
			}
			for(int j=0;j<num;j++){
				for(int k=0;k<c.size();k++){
					int t1=min(abs(b[j]-c[k]),24-abs(b[j]-c[k]));
					t=min(t,t1);
				}	
			}
			
			ans=max(ans,t);
		}
		printf("%d\n",ans);
	}
	return 0;
}


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

#define SIS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) (x & -x)
#define PI 3.14159265358979323846264338327950L
typedef long long ll;
using namespace std;
const int MAX = 0x7ffffff;
const int N = 100;
int t;
ll a[N][N] , c[N] , sum[N];
void slove()
{
	int n , m , x;
	cin >> n >> m >> x;
	for(int i = 0;i < n;i ++)
	{
		cin >> c[i];
		for(int j = 0;j < m;j ++)
			cin >> a[i][j];
	}
	ll mincost = MAX;
	for(int op = 0;op <= (1 << n) - 1;op ++)
	{
		memset(sum , 0 ,sizeof sum);
		ll tmpcost = 0;
		bool flag = false;
		for(int i = 0;i < n;i ++)
		{
			if(((op >> i) & 1))
			{
				tmpcost += c[i];
				for(int j = 0;j < m;j ++)
					sum[j] += a[i][j];
			}
		}
		for(int i = 0;i < m;i ++){
			if(sum[i] < x){
				flag = true;break;
			}
		}
		if(!flag){
			mincost = min(mincost ,tmpcost);
		}
	}
	if(mincost == MAX)cout << -1 << endl;
	else cout << mincost << endl;	
}
int main()
{
	SIS;
	slove();
}

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

int main()
{
  ll n,k;cin>>n>>k;
  double p[n];
  ll keep;
  for(ll i=0;i<n;i++){
    cin>>keep;
    p[i]=1.*(keep+1)/2;
  }
  double temp=0,hoge;
  for(ll i=0;i<k;i++)temp+=p[i];
  hoge=temp;
  for(ll i=0;i<n-k;i++){
    temp=temp-p[i]+p[i+k];
    if(hoge<temp)hoge=temp;
  }
  cout<<fixed<<setprecision(20)<<hoge<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

#define MOD 1000000007;

int main(){
	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	for(int i=0; i<n; i++)
		cin >> h[i];
	sort(h.begin(), h.end());
	int min=1e9;
	for(int i=k-1; i<n; i++){
		if(h[i]-h[i-(k-1)]<min)
			min = h[i]-h[i-(k-1)];
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
using namespace std;

int main(){
  int a,b;
  scanf("%d %d", &a, &b);
  if(a>b){
    printf("a > b\n");
  }else if(a<b){
    printf("a < b\n");
  }else{
    printf("a == b\n");
  }
  return 0;
}


Measured memory_bytes: 2588
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
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; }

const double PI = acos(-1);

int main(int argc, char const *argv[]) {
  float pi = 3.141592;
  int n;
  cin >> n;
  printf("%.9f", 2 * pi * n);
  return 0;
}

Measured memory_bytes: 3672
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define fail -1

int calcdiff(int a, int b){
	return (9000*a)+(4000*b);
}

int main(){

	bool flag1=true, flag2=false;
	int n, y, money_current, a=fail, b=fail, c=fail, diff;
	cin >> n >> y;

	if(y % 1000 != 0) flag1 = false;
	if(y < (n * 1000)) flag1 = false;
	if(y > (n * 10000)) flag1 = false;


	if(flag1!=false){
		diff = y - (1000*n);
		money_current = 0;
		for(int i=0;i<=n;i++){
			for(int j=0;j<=n;j++){
				money_current = calcdiff(i,j);
				if(money_current == diff && i+j <= n){
					a = i;
					b = j;
					flag2 = true;
				}
			}
		}
	}

	if(flag2 == true){
		c = n - a - b;
	}
	if(flag2 == false){
		a = fail;
		b = fail;
		c = fail;
	}

	cout << a << " " << b << " " << c << endl;
	return 0;
}

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

using namespace std;

bool comp(pair<int, int> x, pair<int, int> y) {
    if (x.first < y.first) 
        return true;
    else if (x.first == y.first) {
        if (x.second > y.second)
            return true;
    }
    return false;
}

int main() {
    int n, m, i;
    cin >> n >> m;
    vector<pair<int, int> > ab(m);
    for (i = 0; i < m; i++)
        cin >> ab[i].first >> ab[i].second;

    sort(ab.begin(), ab.end(), comp);

    int ans = 1;
    int aM = ab[0].first, bm = ab[0].second;

    i = 1;
    while (i < m) {
        if (ab[i].first >= bm) {
            ans++;
            bm = ab[i].second;
        }
        else {
            bm = min(ab[i].second, bm);
        }
        i++;
    }
    cout << ans << endl;

    return 0;
}

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

int main() {
    int N, M;
    int Sum = 0;

    // input
    cin >> N >> M;
    int A[N];
    for(int i=0; i<= M-1; i++){
        cin >> A[i];
    }

    // 配列の和の計算
    for(int i=0; i<= M-1; i++){
        Sum = Sum + A[i];
    }

    // 出力
    if( N - Sum >= 0){
        cout << N - Sum << endl;
    }
    else{
        cout << "-1" << endl;
    }

    return 0;
}

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



int main(){
    int H,W;
    cin >> H >> W;

    vector<vector<char>> map (H, vector<char>(W));
    for (int i=0;i<H;i++) {
        for (int j=0;j<W;j++) {
            cin >> map.at(i).at(j);
        }
    }

    vector<bool> black_in_row(H,false);
    vector<bool> black_in_column(W,false);

    for (int i=0;i<H;i++) {
        for (int j=0;j<W;j++) {
            if (map.at(i).at(j) == '#') {
                black_in_row.at(i) = true;
                black_in_column.at(j) = true;
            }
        }
    }

    for (int i=0;i<H;i++) {
        for (int j=0;j<W;j++) {
            if (black_in_row.at(i) && black_in_column.at(j)) {
                cout << map.at(i).at(j);
            }
        }
        if (black_in_row.at(i)){
            cout << endl;
        }
    }


}

Measured memory_bytes: 3644
n, m = map(int, raw_input().split())
 
a = [[0 for i in xrange(m)] for j in xrange(n)]
b = [0 for i in xrange(m)]
 
for i in xrange(n):
    tmp = map(int, raw_input().split())
    for j in xrange(m):
       a[i][j] = tmp[j]
for k in xrange(m):
    b[k] = int(raw_input())
 
for i in xrange(n):
    ans = 0
    for j in xrange(m):
        ans += a[i][j]*b[j]
    print ans
 

Measured memory_bytes: 6496
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  int A,B,X;
  cin>>A>>B>>X;
  string S="NO";
  if(A<=X&&X<=A+B) S="YES";
  cout<<S;
return 0;}

Measured memory_bytes: 3556
#include<iostream>
#include<cmath>
#include<algorithm>
typedef long long ll;
using namespace std;
inline ll cal(ll a,ll b,ll x) {return  (a*x/b)-a*(x/b);} 
ll solve()
{
	ll a,b,n;
	cin>>a>>b>>n;
	if (n<b)
		return 	cal(a,b,n);
	if (n%b==0)
		return cal(a,b,n-1);
	return max(cal(a,b,n),cal(a,b,(n/b)*b-1));
}
int main() 
{
	ios::sync_with_stdio(false);
	cout<<solve();
	return 0;
}

Measured memory_bytes: 3648
import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = sorted([A[i] - B[i] for i in range(N)])
if sum(C) < 0:
    print(-1)
elif min(C) >= 0:
    print(0)
else:
    D = [i for i in C if i < 0]
    m = sum(D)
    for i in range(N-1,-1,-1):
        m += C[i]
        if m >= 0:
            print(len(D)-i+N)
            break


Measured memory_bytes: 95804
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }


int main() {
    string S;
    cin>>S;
    int ans=0;
    for (int i = 0; i < S.length() / 2; ++i) {
        if(S[i]!=S[S.length()-1-i]) ++ans;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>


int main(void){

    int n;

    int ai[10000];

    int min;
    
    int max;

    long int sum = 0;

    scanf("%d", &n);

    int i;

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

    {

 scanf("%d",&ai[i]);

    }

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

    {

        if(i == 0)

        {

            min = ai[0];

            max = ai[0];

        }

        if(ai[i] < min)

        {

            min = ai[i];

        }

         if(ai[i] > max)

        {

            max = ai[i];

        }

        sum += ai[i];

    }

    printf("%d %d %ld\n", min, max, sum);

    return 0;

}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int x; cin >> x;
    if(x < 600){
        cout << 8 << endl;
    }else if(x < 800){
        cout << 7 << endl;
    }else if(x < 1000){
        cout << 6 << endl;
    }else if(x < 1200){
        cout << 5 << endl;
    }else if(x < 1400){
        cout << 4 << endl;
    }else if(x < 1600){
        cout << 3 << endl;
    }else if(x < 1800){
        cout << 2 << endl;
    }else{
        cout << 1 << endl;
    }
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7732
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>

using namespace std;
#define int long  long int
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main()
{
	int A, B, C;
	cin >> A >> B >> C;
	int ans = C - A + B;
	if (ans < 0)ans = 0;
	cout << ans;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
cnt = 0
while(1):
  exit = False
  for i in range(len(A)):
    if(A[i]%2 == 1): 
      exit = True
  if(exit == True): break
  for i in range(len(A)):
    A[i] /= 2
  cnt += 1
print(cnt)

Measured memory_bytes: 9116
//Zory-2020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
#define DD 1
#else
#define DD 0
#endif
#define Debug if(DD) printf("line %d\n",__LINE__)
#define deb(x) if(DD) cerr<<#x<<'='<<x<<endl
#define debug if(DD) printf
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void gg1(){write2(-1);exit(0);}
	void gg2(){puts("NO");exit(0);}
	
	const double eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int N=51;
	
	vc<int> to[N];int dep[N],ff[N];
	void dfs(int x,int fa)
	{
		//debug("dfs %d,%d\n",x,fa);
		dep[x]=dep[fa]+1;ff[x]=fa;
		for(auto y:to[x]) if(y!=fa) dfs(y,x);
	}
	int getlca(int x,int y)
	{
		//debug("getlca(%d,%d)\n",x,y);
		if(dep[x]<dep[y]) swap(x,y);
		while(dep[x]!=dep[y]) x=ff[x];
		while(x!=y) x=ff[x],y=ff[y];return x;
	}
	int LCA[N][N];
	
	int cnt;
	int tg[N];
	void solve(int x,int fa)
	{
		for(auto y:to[x]) if(y!=fa) solve(y,x),tg[x]+=tg[y];
		if(fa) cnt+=(tg[x]==0);
	}
	pii e[N];
	void main()
	{
		int n=qread();fo(i,2,n){ int x=qread(),y=qread();to[x].PB(y),to[y].PB(x); }dfs(1,0);
		fo(i,1,n) fo(j,1,n) LCA[i][j]=getlca(i,j);ll ans=0;
		int m=qread();fo(i,0,m-1) e[i].FR=qread(),e[i].SE=qread();
		fo(S,0,bin(m)-1)
		{
			cnt=0;mem(tg,0);
			fo(i,0,m-1) if(S&bin(i)) tg[e[i].FR]++,tg[e[i].SE]++,tg[LCA[e[i].FR][e[i].SE]]-=2;
			solve(1,0);ans+=bin(cnt)*(PC(S)&1?-1:1);
			debug("S=%d cnt=%d\n",S,cnt);
		}write(ans);
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	#endif
	srand(time(0));
	mine::main();
	if(DD) cerr<<"Time: " <<1.0*clock()/CLOCKS_PER_SEC<<"s";
}

Measured memory_bytes: 256
def main
  n = gets.chop.to_i
  hs = gets.chop.split.map(&:to_i)
  ans = 0
  prev = 10 ** 9 + 1
  count = -1
  0.upto(n-1) do |i|
    cur = hs[i]
    if cur <= prev
      count += 1
    else
      if count > ans
        ans = count
      end
      count = 0
    end
    prev = cur
  end
  if count > ans
    ans = count
  end
  puts ans
end

if __FILE__ == $0
  main
end

Measured memory_bytes: 9604
#include <bits/stdc++.h>
using namespace std;
#define lint long long
#define P pair<int, int>

int main(){
    int N;
    cin >> N;
    
    int A[N];
    
    int L = 0, S = 0;
    int posL = 0, posS = 0;
    for(int i = 0; i < N; ++i){
        cin >> A[i];
        
        if(A[i] >= L){
            L = A[i];
            posL = i;
        }
        if(A[i] <= S){
            S = A[i];
            posS = i;
        }
    }
    
    if(S == 0){
        cout << N - 1 << endl;
        for(int i = 0; i < N - 1; ++i){
            cout << i + 1 << " " << i + 2 << endl;
        }
        return 0;
    }
    if(L == 0){
        cout << N - 1 << endl;
        for(int i = N - 1; i > 0; --i){
            cout << i + 1 << " " << i << endl;
        }
        return 0;
    }
    
    if(L + S >= 0){
        cout << 2 * N - 1 << endl;
        for(int i = 0; i < N; ++i){
            cout << posL + 1 << " " << i + 1 << endl;
        }
        for(int i = 0; i < N - 1; ++i){
            cout << i + 1 << " " << i + 2 << endl;
        }
        return 0;
    }
    if(L + S < 0){
        cout << 2 * N - 1 << endl;
        for(int i = 0; i < N; ++i){
            cout << posS + 1 << " " << i + 1 << endl;
        }
        for(int i = N - 1; i > 0; --i){
            cout << i + 1 << " " << i << endl;
        }
        return 0;
    }
    
    
}


Measured memory_bytes: 256
using System;
namespace ITP1_2_B {
	class Program {
		static void Main(string[] args) {
			string[] s = Console.ReadLine().Split();
			int a = int.Parse(s[0]), b = int.Parse(s[1]), c = int.Parse(s[2]);
			Console.WriteLine((a < b && b < c) ? "Yes" : "No");
		}
	}
}

Measured memory_bytes: 8740
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

int main(){
  int n, m; cin >> n >> m;
  int x[m], dx[m+1];
  REP(i, m) cin >> x[i];
  sort(x, x+m);

  if(m == 1 || n >= m){
    cout << 0 << endl;
    return 0;
  }

  FOR(i, 1, m) dx[i] = x[i]-x[i-1];

  sort(dx+1, dx+m, greater<int>());

  ll sum = x[m-1]-x[0];
  FOR(i, 1, n){
    sum -= dx[i];
  }

  cout << sum << endl;

  return 0;
}


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

const int M = 1000005;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<int> cnt(M);
  for (int x : a) {
    if (cnt[x] != 0) {
      cnt[x] = 2;
      continue;
    }
    for (int i = x; i < M; i += x) cnt[i]++;
  }
  int ans = 0;
  for (int x : a) {
    if (cnt[x] == 1) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 7920
N, M = map(int, input().split())
A = []
B = []
ans = 0
for i in range(N):
    a, b = map(int, input().split())
    A.append([a, i])
    B.append(b)
A = sorted(A)
for i in range(len(A)):
    bn =  B[A[i][1]]
    if M > bn:
        M -= bn
        ans += A[i][0]  * bn
    else:
        ans += A[i][0] * M
        print(ans)
        exit()


Measured memory_bytes: 24764
#include <bits/stdc++.h>
using namespace std;
int main(){
  long n,i,k,p,ans;
  ans=0;
  bool roop=false;
  string str;
  cin>>n>>str;
  vector<char> vec(2*n);
  k=0;
  
  if(str.at(0)=='B'&&str.at(2*n-1)=='B'){
    roop=true;
    ans=1;
  }
  for(i=0; i<2*n; i++){
    if(i==0){
      vec.at(i)='R';
      k++;
      
      
      
    }
   
    else if(str.at(i)==str.at(i-1)){
      vec.at(i)='L';
      if(str.at(i)=='B'){
        str.at(i)='W';
      }
      else{
        str.at(i)='B';
      }
    }
    else{
      vec.at(i)='R';
      k++;
   
    }
  }
 
  while(roop){
   
    while(n==k){
      p=0;
      for(i=0; i<2*n; i++){
      
        
        if(vec.at(i)=='R'){
          p=p+1;
        }
        else{
        
          ans=ans*p%1000000007;
          p=p-1;
        }
      }
      break;
    }
    break;
  }
  for(i=1; i<n+1; i++){
    
    ans=ans*i%1000000007;
  }
  if(vec.at(2*n-1)=='R'){
    ans=0;
  }
  
 
  if(n==k){
  }
  else{
    ans=0;
  }
  
  
  
  cout<<ans;
}

Measured memory_bytes: 772
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

int main()
{
    string S, T;
    cin >> S >> T;

    ll ans = 0;

    rep (i, S.size())
    {
        if (S[i] != T[i]) { ++ans; }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3844
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,m,i,j,l,r,xlh,ans[5010],b[5010][202],c[5010],q[202][5010],cnt[5010],a[5010];
int main(){
	scanf("%lld%lld",&n,&m);
	for(i=2;i<=n;i++){
		scanf("%lld",&a[i]);
		a[i]=a[i-1]+a[i];
	}
	for(i=1;i<=n;i++)
	 for(j=1;j<=m;j++)scanf("%lld",&b[i][j]);
	for(r=1;r<=n;r++){
		for(l=1;l<=n;l++)c[l]=0;
		for(j=1;j<=m;j++){
			c[r]+=b[r][j];c[r-1]-=b[r][j];
			while(cnt[j]&&b[q[j][cnt[j]]][j]<=b[r][j]){
				c[q[j][cnt[j]]]+=b[r][j]-b[q[j][cnt[j]]][j];
				c[q[j][cnt[j]-1]]-=b[r][j]-b[q[j][cnt[j]]][j];
				cnt[j]--;
			}
			q[j][++cnt[j]]=r;
		}
		for(l=r;l;l--){
			c[l]+=c[l+1];ans[l]+=c[l];
			xlh=max(xlh,ans[l]-a[r]+a[l]);
		}
	}
	printf("%lld",xlh);
}

Measured memory_bytes: 14464
import itertools

s = raw_input()
N = int(s)

A = [[-1 for i in range(N)] for j in range(N)]
#print A

for i in range(N):
    n = int(raw_input())
    for j in range(n):
        [x,y] = raw_input().split()
        x = int(x)
        y = int(y)
        #print "x=",x, "y=",y
        A[i][x-1] = y

#print A

List = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
lst = List[0:N]
#print lst

def consistency_check(lst):
    #print "lst=",lst
    for i in range(N):
        if i in lst:
            continue
        for j in range(N):
            if A[i][j] == 0 and not(j in lst):
                return 0
            if A[i][j] == 1 and j in lst:
                return 0
    return 1

for i in range(N+1):
    lierlist = list(itertools.combinations(lst,i))
    for j in range(len(lierlist)):
        if consistency_check(lierlist[j]):
            print N-i
            exit (0)

#print "wrong"
print 0 # not reach


Measured memory_bytes: 5252
#include<iostream>
using namespace std;
int main(){
    int a,b,sum,sub,mal;
    cin>>a>>b;
    int max=-1000000;
    sum=a+b;
    sub=a-b;
    mal=a*b;
    if(max<sum)max=sum;
    if(max<sub)max=sub;
    if(max<mal)max=mal;
    cout<<max<<endl;
    return 0;
}

Measured memory_bytes: 256
x = input().split(" ")
n = int(x[0])
m = int(x[1])

probInit = set([])
probEnd  = set([])

for i in range(m):
    edge = input().split(" ")
    if edge[0] == "1":
        probInit.add(edge[1])

    if edge[1] == str(n):
        probEnd.add(edge[0])

sec = probEnd.intersection(probInit)
if (len(sec) == 0):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")


Measured memory_bytes: 23196
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {
	int H, W;
	int[][] distances;
	boolean[][] field;

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		H = Integer.parseInt(tokens[0]);
		W = Integer.parseInt(tokens[1]);
		this.distances = new int[H][W];
		this.field = new boolean[H][W];
		for (int i = 0; i < H; ++i) {
			Arrays.fill(this.distances[i], 0);
			Arrays.fill(this.field[i], true);
		}
		for (int i = 0; i < H; ++i) {
			String line = in.readLine();
			for (int j = 0; j < W; ++j) {
				char c = line.charAt(j);
				if (c == '.') {
					this.field[i][j] = true;
				} else {
					this.field[i][j] = false;
				}
			}
		}
		if (!this.field[0][0]) {
			this.distances[0][0] = 1;
		}
		// 横
		for (int i = 1; i < W; ++i) {
			if (this.field[0][i]) {
				// 白
				this.distances[0][i] = this.distances[0][i - 1];
			} else {
				// 黒
				// もし前のものが黒なら，そのまま行ける
				if (!this.field[0][i - 1]) {
					this.distances[0][i] = this.distances[0][i - 1];
				} else {
					this.distances[0][i] = this.distances[0][i - 1] + 1;
				}
			}
		}
		// 縦
		for (int i = 1; i < H; ++i) {
			if (this.field[i][0]) {
				// 白
				this.distances[i][0] = this.distances[i - 1][0];
			} else {
				// 黒
				// もし前のものが黒なら，そのまま行ける
				if (!this.field[i - 1][0]) {
					this.distances[i][0] = this.distances[i - 1][0];
				} else {
					this.distances[i][0] = this.distances[i - 1][0] + 1;
				}
			}
		}
	}

	void calc() {
		for (int i = 1; i < H; ++i) {
			for (int j = 1; j < W; ++j) {
				boolean cond = this.field[i][j];
				if (cond) {
					// 現在位置は白
					this.distances[i][j] = Math.min(this.distances[i - 1][j], this.distances[i][j - 1]);
				} else {
					// 現在位置は黒
					if (this.field[i - 1][j] && this.field[i][j - 1]) {
						// 両方白
						this.distances[i][j] = Math.min(this.distances[i - 1][j] + 1, this.distances[i][j - 1] + 1);
					} else if (this.field[i - 1][j] && !this.field[i][j - 1]) {
						// 左が黒
						this.distances[i][j] = Math.min(this.distances[i - 1][j] + 1, this.distances[i][j - 1]);
					} else if (!this.field[i - 1][j] && this.field[i][j - 1]) {
						// 上が黒
						this.distances[i][j] = Math.min(this.distances[i - 1][j], this.distances[i][j - 1] + 1);
					} else {
						// 左，うえが黒
						this.distances[i][j] = Math.min(this.distances[i - 1][j], this.distances[i][j - 1]);
					}
				}
			}
		}
	}

	void showResult() {
		// 開始位置が黒の場合は++1しないといけない
		int result = this.distances[H - 1][W - 1];
		System.out.println(result);
	}

}

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

using namespace std;

int main(){
  int n,d,res = 0;
  cin >> n >> d;
  int dd[n][d];
  for(int i = 0;i < n;i++){
    for(int j = 0;j < d;j++){
      cin >> dd[i][j];
    }
  }

  for(int i = 0;i < n;i++){
    for(int j = i+1;j < n;j++){
      double dou = 0;
      for(int k = 0;k < d;k++){
        dou += (dd[i][k] - dd[j][k])*(dd[i][k] - dd[j][k]);
      }
      if(sqrt(dou) - (int)sqrt(dou) == 0)res++;
    }
  }
  cout << res;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
#define ull unsigned long long int
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD 1000000007
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define precise(i) cout<<fixed<<setprecision(i)
using namespace std;
const double PI = atan(1.0)*4;
const int64_t INF=100000000000000003;
const int32_t LOG=21;
const int BIG=pow(2,20);
const int N=100005;
int power(int x, int y, int p) 
{ 
    int res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
int modInverse(int n, int p) 
{ 
    return power(n, p-2, p); 
} 
int nCrModPFermat(int n, int r, int p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    int fac[n+1]; 
    fac[0] = 1; 
    for (int i=1 ; i<=n; i++) 
        fac[i] = fac[i-1]*i%p; 
  
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
} 
 int32_t main(){
          getFaster;
          int X,Y;
          cin>>X>>Y;
          int x=(2*Y-X);
          int y=(2*X-Y);
          if(x<0 || y<0 || x%3!=0 || y%3!=0)
          {
            cout<<0<<endl;
            return 0;
          }
          x=x/3;
          y=y/3;
          int tot=x+y;
          int p=1e9+7;
          cout<<nCrModPFermat(tot,x,p)<<endl;
          return 0;
}

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

 
/*
ll gcds(ll a,ll b){
    if(a<b){
        swap(a,b);
    }
    ll r=a%b;
    if(r==0){
        return b;
    }
    while(r>0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
 
 
ll lcms(ll a,ll b){
    ll mmr=gcds(a,b);
    a=a/mmr;
    b=b/mmr;
    return a*b*mmr;
}
*/


int main(){
    double L;
    cin>>L;
    double p = L/3;
    cout<< std::fixed << std::setprecision(15) <<p*p*p<<endl;
}

Measured memory_bytes: 256
N = int(input())
A = []
for i in range(N):
    A.append(list(map(int, input().split())))
A.sort(key=lambda x: x[2], reverse=True)
for c_x in range(101):
    for c_y in range(101):
        H = -1
        H_upper = 10**9
        for i, v in enumerate(A):
            if v[2] == 0:
                H_upper = min(H_upper, abs(c_x - v[0]) + abs(c_y - v[1]))
                if H_upper < H:
                    break
            else:
                tmp_H = abs(c_x - v[0]) + abs(c_y - v[1]) + v[2]
                if H == -1:
                    H = tmp_H
                elif H != tmp_H:
                    break
            if i == N-1:
                if H == -1:
                    print(c_x, c_y, H_upper)
                else:
                    print(c_x, c_y, H)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
#define MOD 1000000007
int main() {
    int N;
    cin >> N;
    int a = 0,b = 0,c =0;
    rep(i, 0, N){
        ll tmp;
        cin >> tmp;
        if(tmp%4 == 0){
            a++;
        } else if (tmp%2 == 0){
            b++;
        } else {
            c++;
        }
    }
    
    if (a>=c) {
        cout << "Yes" << endl;
    } else if ( c == a+1 && b == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int N, X;
    cin >> N >> X;
    int D = 0;
    for(int i = 0; i < N; i++) {
        int l;
        cin >> l;
        D += l;
        if(D > X) {
            cout << i + 1 << endl;
            return 0;
        }
    }
    cout << N + 1 << endl;
    return 0;
}

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

int main() {
    string cards;
    while (cin >> cards, cards != "-") {
        int m;
        cin >> m;
        for (int i = 0; i < m; i++) {
            int h;
            cin >> h;
            cards = cards.substr(h) + cards.substr(0, h);
        }
        cout << cards << endl;
    }
}

Measured memory_bytes: 1216
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n;
while(cin>>n,n+1){
double l=1;
double o=0;
for(int i=1;i<n;i++){
o+=atan(1/sqrt(l));
l++;
}
l=sqrt(l);
//cout<<l<<endl;
cout<<l*cos(o)<<endl<<l*sin(o)<<endl;
}
}

Measured memory_bytes: 1292
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll n, k; cin >> n >> k;
    if(n > k){
    	n %= k;
    }
    print(min(n, k-n))
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("-O3")
/*
				C++
				encoding: UTF-8
				Last Modified: 01/Mar/20 06:04:53 PM
*/

#include <bits/stdc++.h>
#ifdef H4wk3ye
#	include <prettypr.hpp>
#endif

using namespace std;

// clang-format off

#define		int                    long long
#define		ve                     vector
#define		pb                     push_back
#define		endl                   "\n"
#define		ff                     first
#define		ss                     second
#define		pii                    pair<int, int>
#define		len(v)                 (int)v.size()
#define		all(v)                 v.begin(), v.end()
#define		reset(a, b)            memset(a, b, sizeof(a));
#define		fr(i, s, n)            for (int i = s ; i < n ; ++i)
#define		dfr(i, s, n)           for (int i = s ; i > n ; --i)

template < typename T > void pr (const T& t) {
    cout << t << "\n";
}

template < typename T, typename U, typename... ARGS >
void pr (const T& t, const U& u, const ARGS&... args) {
    cout << t << " ";
    pr (u, args...);
}

// clang-format on

const int N = 1e5 + 5;
ve< int > graph[N];
int n, m, k;
int cnt[N], deg[N], vis[N], com[N];
int c;

void dfs (int node) {
	if (vis[node]) return;
	com[node] = c;
	vis[node] = 1;
	for (auto& to : graph[node]) {
		if (!vis[to]) dfs (to);
	}
}

signed main () {
	ios_base::sync_with_stdio (false), cin.tie (nullptr);
	cin >> n >> m >> k;
	fr (i, 0, m) {
		int u, v;
		cin >> u >> v;
		graph[u].pb (v);
		graph[v].pb (u);
		deg[u]++;
		deg[v]++;
	}

	fr (i, 1, n + 1) {
		if (!vis[i]) {
			++c;
			dfs (i);
		}
	}

	fr (i, 0, k) {
		int u, v;
		cin >> u >> v;
		if (com[u] != com[v]) continue;
		cnt[u]++;
		cnt[v]++;
	}


	map< int, int > mp;
	fr (i, 1, n + 1) mp[com[i]]++;

	fr (i, 1, n + 1) {
		int ans = mp[com[i]] - deg[i] - cnt[i] - 1;
		cout << ans << " ";
	}
	cout << endl;
	return 0;
}

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

int main() {
  int s;
  cin >> s;
  int count = 0;
  if (s == 0) {
    // nothing
  } else if (s >= 1 && s < 11) {
    count = 1;
  } else if ( s == 11) {
    count = 2;
  } else if ( s > 11 && 100 >= s) {
    count = 1;
  } else if ( s > 100 && s < 111) {
    count = 2;
  } else {
    count = 3;
  }
  cout << count;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int i,j,W,H;
    char c;
    cin>>W>>H;
    cin>>c;
    for(j=0;j<H;j++){
        for(i=0;i<W;i++){
            if(j==0||j==H-1){
                if(i==0||i==W-1){
                    cout<<"+";
                }else{
                    cout<<"-";
                }
            }else if(j!=H/2){
                if(i==0||i==W-1){
                    cout<<"|";
                }else{
                    cout<<".";
                }
            }else{
                if(i==0||i==W-1){
                    cout<<"|";
                }else if(i==W/2){
                    cout<<c;
                }else{
                    cout<<".";
                }
            }
        }
        cout<<endl;
    }
}



Measured memory_bytes: 3108