akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

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

const ll mod = 1e9 + 7;
const ll inf = 1e18;

class Point{
    public:
    int i;
    int j;

    Point(int a, int b){
        i = a;
        j = b;
    }
};

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

    // input
    int H, W;
    cin >> H >> W;

    vector<string> S(H);
    FOR(i, 0, H){
        cin >> S[i];
    }

    // distance
    int d[H][W];
    FOR(i, 0, H){
        FOR(j, 0, W){
            d[i][j] = 10000;
        }
    }

    d[0][0] = 0;
    queue<Point> q;
    q.push(Point(0, 0));
    while(q.size()!=0){
        auto point = q.front();
        q.pop();

        // 周辺を見る
        FOR(i, 0, 4){
            int index_i = point.i + dy[i];
            int index_j = point.j + dx[i];

            if(0<=index_i && index_i < H && 0<=index_j && index_j < W){
                char color = S[index_i][index_j];
                if(color == '.'){
                    // 塗ろうかな
                    int mydist = d[point.i][point.j];
                    if(d[index_i][index_j] > mydist + 1){
                        // 距離を更新
                        d[index_i][index_j] = mydist + 1;
                        q.push(Point(index_i, index_j));
                    }
                }
            }
        }
    }

    // p("[dist]");
    // FOR(i, 0, H){
    //     FOR(j, 0, W){
    //         cout << setw(5) << d[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    if(d[H-1][W-1]==10000){
        p(-1);
    }else{
        int lastWhiteNum = d[H-1][W-1] + 1;

        int initialWhiteNum = 0;
        FOR(i, 0, H){
            FOR(j, 0, W){
                if(S[i][j] == '.'){
                    initialWhiteNum++;
                }
            }
        }

        p(initialWhiteNum - lastWhiteNum);
    }
    
    return 0;
}

Measured memory_bytes: 384
N = int(input())
A = list(map(int, input().split()))
D = {}
for i in range(N):
    if A[i] in D:
        D[A[i]] += 1
    else:
        D[A[i]] = 1
Q = int(input())
S = sum(A)
for i in range(Q):
    B, C = map(int, input().split())
    diff = C - B
    cnt = 0
    if B in D:
        S += diff * D[B]
        print(S)
        if C in D:
            D[C] += D[B]
        else:
            D[C] = D[B]
        D[B] = 0
    else:
        print(S)

Measured memory_bytes: 85228
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
ll GCD(ll a, ll b){
    return b ? GCD(b, a%b) : a;
}
ll LCM(ll a, ll b){
    return a/GCD(a,b)*b;
}
int dfs(vector<vector<int>> &G, vector<bool> visit, int v, int N, int cnt){
    visit.at(v)=true;
    cnt++;
    if(cnt==N){
        return 1;
    }
    int ans=0;
    for(int u:G.at(v)){
        if(visit.at(u)) continue;
        ans+=dfs(G,visit,u,N,cnt);
    }
    return ans;
}
int main(){
    int N,M;
    cin>>N>>M;
    vector<int> a(M),b(M);
    vector<vector<int>> G(N);
    rep(i,M){
        int from,to;
        cin>>from>>to;
        from--;
        to--;
        G.at(from).push_back(to);
        G.at(to).push_back(from);
    }
    vector<bool> visit(N,false);
    int ans=dfs(G,visit,0,N,0);
    cout<<ans<<endl;
}



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

class Main{
    public static void main(String[] a)throws IOException{
    	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
 		String str = null;
 		String[] strList = new String[2];

 		while((str = in.readLine()) != null){                    
            strList = str.split(" ");

            int sum = Integer.parseInt(strList[0])+Integer.parseInt(strList[1]);

            System.out.println(String.valueOf(sum).length());
	    }
    }
}

Measured memory_bytes: 16996
L = list(map(int,input().split()))
L.sort()
ans = 0
if (L[1] - L[0]) % 2 == 0:
    ans += (L[1] - L[0]) // 2
    ans += L[2] - L[1]
else:
    ans += 1
    L[0] += 1
    L[2] += 1
    ans += (L[1] - L[0]) // 2
    ans += L[2] - L[1]
print(ans)



Measured memory_bytes: 38384
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
//#include "bits/stdc++.h"
using namespace std;
//using namespace std::vector;
#define rep(i,a,b) for(int i=(a);i<(b);++i)


#define huge 1000000007
typedef long long ll;

int main(void) {

	ll N = 0;
	ll A = 0;
	ll B = 0;
	ll C = 0;
	ll D = 0;
	ll K = 0;
	ll X = 0;
	//double a[100000] = {};
	//double b[100000] = {};
	//ll v[100] = {};
	ll *p, *c, *d;
	string S,T,U;
	ll count = 0;
	ll sum = 0;
	ll min = 100000;
	ll max = 0;
	int flag = 0;
	char temp,head;
	//int is = 0;

	
	//char p;
	cin >>S >> K;
	//cin >> D >> G;
	//vector<pair<float, float>> is(D);
	//sort(is.begin(), is.end());
	//p = (ll *)malloc(D * sizeof(ll));
	//c = (ll *)malloc(D * sizeof(ll));
	//d = (ll *)malloc(D * sizeof(ll));

	//rep(i, 0, D) {
	//	cin >> is[i].first >> is[i].second;
	//	//cin >> p[i] >>c[i];

	//	//d[i] = (p[i] + 1) * 100;
	//}
	temp = '1';

	rep(i, 0, K) {
		if (S[i] != '1') {
			temp = S[i];
			break;
		}

	}

		cout << temp << endl;

	
	//sort(l,l+N);


	return 0;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

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

int main() {
    int n;
    cin >> n;
    int h[n];
    for (int i = 0; i < n; i++) cin >> h[i];
    int ans = 0;
    while (1) {
        int cnt = 0;
        for (int i = 0; i < n && (cnt == 0 || h[i] != 0); i++) {
            if (h[i] != 0) {
                cnt++;
                h[i]--;
            }
        }
        if (!cnt) break;
        else ans++;
    }
    cout << ans << endl;
}

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

#define rep(i, N) for(int (i) = 0; (i) < (N); i++)
#define all(v) v.begin(), v.end()
using i64 = int_fast64_t;

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

    string ans = "";
    rep(i, N) {
        ans += S[i];
        ans += T[i];
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
char s[105],s2[10]="keyence";
int n,i,a,b;
int main()
{
	scanf("%s",s);
	n=strlen(s);
	for(i=0;i<7;i++)if(s[i]!=s2[i])break;
	a=i;
	for(i=n-1;i>n-8;i--)if(s[i]!=s2[i+7-n])break;
	b=n-i-1;
	if(n>=7&&a+b>=7)printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cmath>
#include<cstdio>
#include<map>
#define l(a,b,c,d) sqrt(pow(c-a,2)+pow(d-b,2))
#define KEI(s,a,b,c) sqrt(s*(s-a)*(s-b)*(s-c))
using namespace std;
int main(){
  int n=0;
  double x[20],y[20];
  double sum = 0.0,a,b,c,s;

  while(scanf("%lf,%lf",&x[n],&y[n])!=EOF) n++;
  for(int i=2;i<n;i++){
    a = l(x[0],y[0],x[i-1],y[i-1]);
    b = l(x[0],y[0],x[i],y[i]);
    c = l(x[i-1],y[i-1],x[i],y[i]);
    sum += KEI((a+b+c)/2,a,b,c);
  }
  printf("%.10f\n",sum);
}

Measured memory_bytes: 1240
import java.io.*;
import java.util.*;

class Main {
	
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		List<List<Integer>> list = new ArrayList<List<Integer>>(50);
		
		int prevComCount = 0;
		boolean decreasing = false;
		
		//first
		list.add(new ArrayList<Integer>());
		list.get(0).add(Integer.valueOf(br.readLine()));
		
		
		while(true) {
			String str = br.readLine();
			
			if(!decreasing) {
				int comCount = 0;
				for(int i = str.indexOf(","); i != -1; i = str.indexOf(",", i+1)) {
					comCount++;
				}
				decreasing = prevComCount > comCount;
				prevComCount = comCount;
			}
			
			int commaPos = str.indexOf(",");
			
			if(commaPos == -1) { //last
				list.get(list.size()-1).add(Integer.valueOf(str));
				break;
			}
			else {
				int prev = 0;
				int i = 0;
				int cursor = commaPos;
				for(; cursor != -1; cursor = str.indexOf(",", cursor+1), i++) {
					if(!decreasing && i == 0) {
						list.add(new ArrayList<Integer>());
					}
					list.get(list.size() - 1 - i).add(Integer.valueOf(str.substring(prev, cursor)));
					prev = cursor + 1;
				}
				list.get(list.size() - 1 - i).add(Integer.valueOf(str.substring(prev)));
			}
			
		}
		
		int width = list.size();
		int[][] weight = new int[width][width];
		
		for(int y = 0; y < width; y++) {
			for(int x = 0; x < width; x++) {
				int left = (x == 0 ? 0 : weight[y][x-1]);
				int up   = (y == 0 ? 0 : weight[y-1][x]);
				weight[y][x] = list.get(y).get(x) + Math.max(left, up);
			}
		}
		
		System.out.println(weight[width-1][width-1]);
	}
}

Measured memory_bytes: 9648
#include <stdio.h>
int main(void)
{
    int A,B;
    scanf("%d %d",&A,&B);
    if(A-B >= 2){
        printf("%d",A*2-1);
    }else if(B-A >= 2){
        printf("%d",B*2-1);
    }else{
        printf("%d",A+B);
    }
}

Measured memory_bytes: 1720
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

Int a[100005];

int main(){
    cin.tie(0);

    int N; cin >> N;
    for (int i = 1; i <= N; i++){
        cin >> a[i];
    }
    if (N == 2){
        cout << abs(a[1] - a[2]) << endl;
        return 0;
    }
    sort(a+1, a+N+1);

    Int ans = 0;
    int right = N;
    int left = 1;
    int crt = (N+1)/2;
    int cnt = 1;
    while (cnt < N){
        if (cnt == 1){
            ans += abs(a[crt]-a[right]);
            crt = right;
            right--;
            cnt++;
            continue;
        }
        if (abs(a[crt] - a[right]) > abs(a[crt] - a[left])){
            ans += abs(a[crt] - a[right]);
            crt = right;
            right--;
        }else{
            ans += abs(a[crt] - a[left]);
            crt = left;
            left++;
        }
        cnt++;
    }
    Int ANS = ans;
    right = N;
    left = 1;
    crt = (N+1)/2;
    cnt = 1;
    ans = 0;

    while (cnt < N){
        if (cnt == 1){
            ans += abs(a[crt]-a[left]);
            crt = left;
            left++;
            cnt++;
            continue;
        }
        if (abs(a[crt] - a[right]) > abs(a[crt] - a[left])){
            ans += abs(a[crt] - a[right]);
            crt = right;
            right--;
        }else{
            ans += abs(a[crt] - a[left]);
            crt = left;
            left++;
        }
        cnt++;
    }

    ANS = max(ANS, ans);
    cout << ANS << endl;

}


Measured memory_bytes: 1656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1000005,INF=1<<30;

int main(){
    
    int N,M;cin>>N>>M;
    vector<int> A(M),open(M,0);
    for(int i=0;i<M;i++){
        int b;cin>>A[i]>>b;
        for(int j=0;j<b;j++){
            int c;cin>>c;
            c--;
            open[i]|=(1<<c);
        }
    }
    
    int dp[(1<<N)][M+1];
    for(int i=0;i<(1<<N);i++){
        for(int j=0;j<M+1;j++){
            dp[i][j]=INF;
        }
    }
    
    dp[0][0]=0;
    
    for(int j=0;j<M;j++){
        for(int i=0;i<(1<<N);i++){
            if(dp[i][j]==INF) continue;
            dp[i|open[j]][j+1]=min(dp[i|open[j]][j+1],dp[i][j]+A[j]);
            dp[i][j+1]=min(dp[i][j+1],dp[i][j]);
        }
    }
    
    if(dp[(1<<N)-1][M]==INF) cout<<-1<<endl;
    else cout<<dp[(1<<N)-1][M]<<endl;
}


Measured memory_bytes: 16256
#include<bits/stdc++.h>
#define ll  long long
//#define int long long
#define inf 0x3f3f3f3f
#define fi first
#define se second
#define pb push_back
#define pa pair<int,int>
#define mkp(a,b) make_pair(a,b)
const int N=2e5+10;
const int mod=998244353;
using namespace std;


const double eps=1e-8;
inline int sgn(double x){return x<-eps?-1:(x>eps?1:0);}
inline double pf(double x){return x*x;}
struct Point
{
   double x,y;
   Point(){}
   Point(double x,double y):x(x),y(y){}
   Point(pair<double,double> p):x(p.first),y(p.second){}
   bool operator == (const Point& p)const {return sgn(x-p.x)==0&&sgn(y-p.y)==0;}
   bool operator != (const Point& p)const {return sgn(x-p.x)!=0||sgn(y-p.y)!=0;}
   inline double length()const {return sqrt(pf(x)+pf(y));}
   inline double angle()const{return atan2(y,x);}
};
typedef Point Vector;
Vector operator + (Vector a,Vector b){return Vector(a.x+b.x,a.y+b.y);}
Vector operator - (Vector a,Vector b){return Vector(a.x-b.x,a.y-b.y);}
Vector operator * (Vector a,double mul){return Vector(a.x*mul,a.y*mul);}
Vector operator / (Vector a,double div){return Vector(a.x/div,a.y/div);}
inline double dot(Vector a,Vector b){return a.x*b.x+a.y*b.y;}
inline double cross(Vector a,Vector b){return a.x*b.y-a.y*b.x;}
inline double dist(Vector a,Vector b){return sqrt(pf(a.x-b.x)+pf(a.y-b.y));}
inline double angle(Vector a,Vector b){return acos(dot(a,b)/a.length()/b.length());}
Vector rot(Vector a,double rad){return Vector(a.x*cos(rad)-a.y*sin(rad),a.x*sin(rad)+a.y*cos(rad));}//ni shi zhen
Vector unit(Vector v){return v/v.length();}// 单位向量
Vector normal(Vector a){return Vector(-a.y,a.x);} // 法向量
struct Line
{
   Point p;
   Vector v;
   Line(){}
   Line(Point p,Vector v): p(p),v(v){}
};
typedef Line Halfplane;
Point line_intersect(Line a,Line b)// 两直线交点
{
   double t=cross(b.v,a.p-b.p)/cross(a.v,b.v);
   return a.p+a.v*t;
}
double x[5],y[5];
int32_t main()
{
   //ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
   int q; scanf("%d",&q);
   while(q--)
   {
   	  for(int i=1;i<=4;i++) scanf("%lf%lf",&x[i],&y[i]);
   	  Line l1=Line(Point(x[1],y[1]),Vector(x[2]-x[1],y[2]-y[1]));
   	  Line l2=Line(Point(x[3],y[3]),Vector(x[4]-x[3],y[4]-y[3]));
      Point a=line_intersect(l1,l2);
      printf("%.10f %.10f\n",a.x,a.y);
   }
return 0;
}
/*

*/



Measured memory_bytes: 3248
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int y = sc.nextInt();
		int res10000 = -1, res5000 = -1, res1000 = -1;
		sc.close();
		for (int a = 0; a <= N; a++) {
			for (int b = 0; b + a <= N; b++) {
				int c = N - a - b;
				int total = 10000*a + 5000*b + 1000*c;
				if (total == y) {
					res10000 = a;
					res5000 = b;
					res1000 = c;
				}
			}
		}
		System.out.println(res10000 + " " + res5000 + " " + res1000);
	}

}


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

// using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"

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

using ll = long long;

using vint = std::vector<int>;

constexpr int mod = 1e9 + 7;
class mint {
private:
  std::int64_t m_x;

public:
  mint(int64_t m_x = 0) : m_x(m_x % mod) {}
  mint &operator+=(const mint a) {
    if ((m_x += a.m_x) >= mod)
      m_x -= mod;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((m_x += mod - a.m_x) >= mod)
      m_x -= mod;
    return *this;
  }
  mint &operator*=(const mint a) {
    (m_x *= a.m_x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  std::int64_t get() { return m_x; }
};

void Main() {
  int n, m;
  std::cin >> n >> m;

  vint a(m);
  for (auto &ai : a) {
    std::cin >> ai;
  }

  std::vector<mint> dp(n + 1, 0);
  dp[0] = 1;
  dp[1] = 1;

  int acount = 0;

  for (int i = 0; i <= n; ++i) {
    if (m > 0 && i == a[acount]) {
      dp[i] = 0;
      ++acount;
    } else if (i >= 2) {
      dp[i] = dp[i - 1] + dp[i - 2];
    }
  }

  std::cout << dp[n].get() << "\n";
}

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


Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] params = scanner.nextLine().split(" ");
        int a = Integer.parseInt(params[0]);
        int b = Integer.parseInt(params[1]);
        int[] results = {a + b, a - b, a * b};
        int max = -9999999;
        for (int n: results) {
            if (n > max) max = n;
        }
        scanner.close();
        System.out.println(max);
    }
}

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

int main()
{
  int a, b;
  cin >> a >> b;
  int min_ = min(a, b);
  int max_ = max(a, b);
  string ans;
  rep(i, max_)
      ans += min_ + '0';
  cout << ans << endl;
  return 0;
}

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

int main(){
  constexpr double theta_hour= acos(-1.0)/ 6.0;
  constexpr double theta_min = acos(-1.0)/ 30.0;
  double L_hour,L_min,hour,min;
  cin >> L_hour >> L_min >> hour >> min;

  double ans= sqrt(L_hour*L_hour + L_min*L_min - 2*L_hour*L_min*cos(hour*theta_hour- min*(theta_min- theta_hour/60.0)));

  cout << fixed;
  cout << setprecision(9) << ans << endl;
}

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

signed main() {
	int h, w;
	cin >> h >> w;
	vector<vector<int>> a;
	for (int i = 0; i < h; ++i) {
		vector<int> v(w);
		for (int i = 0; i < w; ++i)cin >> v[i];
		a.push_back(v);
	}
	vector<vector<int>> ans;
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w - 1; ++j) {
			if (a[i][j] % 2) {
				ans.push_back({ i + 1, j + 1, i + 1, j + 2 });
				++a[i][j + 1];
			}
		}
	}
	for (int i = 0; i < h - 1; ++i) {
		if (a[i][w - 1] % 2) {
			ans.push_back({ i + 1,w,i + 2,w });
			++a[i + 1][w - 1];
		}
	}
	cout << ans.size() << endl;
	for (auto v : ans) {
		printf("%d %d %d %d\n", v[0], v[1], v[2], v[3]);
	}
}

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

int main() {
    string S;
    cin >> S;
    int N = (int)S.size();
    vector<int> res(N);

    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'R') {
            cnt++;
        } else {
            res[i] += cnt/ 2;
            res[i - 1] += (cnt + 1) / 2;
            cnt = 0;
        }
    }
    for (int i = N - 1; i >= 0; i--) {
        if (S[i] == 'L') {
            cnt++;
        } else {
            res[i] += cnt / 2;
            res[i + 1] += (cnt + 1) / 2;
            cnt = 0;
        }
    }

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

Measured memory_bytes: 1024
while(1):
    m, f, r = map(int, raw_input().split())
    if m == -1 and f == -1 and r == -1:
        break
    elif m == -1 or f == -1 or m+f < 30:
        print "F"
    elif m+f >= 30 and 50 > m+f:
        if r >= 50:
            print "C"
        else:
            print "D"
    elif m+f >= 50 and 65 > m+f:
        print "C"
    elif m+f >= 65 and 80 > m+f:
        print "B"
    else:
        print "A"
                

Measured memory_bytes: 6368
from bisect import bisect_left, bisect_right

N = int(input())
A = list(map(int, input().split()))

li = []
for i in range(N):
    li.append(A[i] + i)

li.sort()

cnt = 0
for j in range(N):
    target = j - A[j]
    cnt += bisect_right(li, target) - bisect_left(li, target)

print(cnt)


Measured memory_bytes: 100188
#include <math.h>
#include <ctype.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)

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

    long long ans = 1;
    if(abs(n - m) <= 1){
        for(int i = 1; i <= n; i++){
            ans *= i;
            ans %= 1000000007;
        }
        for(int i = 1; i <= m; i++){
            ans *= i;
            ans %= 1000000007;
        }
        if(n == m) ans = (ans * 2) % 1000000007;
    }else ans = 0;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
N,K,Q = map(int,input().split())
ANS = [0] * N
A = [int(input()) for _ in range(Q)]
for a in A:
  ANS[a-1] += 1
  
R = []
for i in range(N):
  p = K - Q + ANS[i]
  if p <= 0:
    R.append('No')
  else:
    R.append('Yes')
    
print('\n'.join(R))


Measured memory_bytes: 9760
#pragma GCC optimize("Ofast")
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <bitset>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy 2333333
#define bql 2147483647
using namespace std;
int n;
struct node
{
	int num;
	int pos;
}a[100005];
bool cmp(node x,node y)
{
	return x.pos<y.pos;
}
int main()
{
	fast;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>a[i].pos;
		a[i].num=i;
	}
	sort(a+1,a+n+1,cmp);
	for (int i=1;i<=n;i++)
	   cout<<a[i].num<<' ';
	return 0;
}

Measured memory_bytes: 1664
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
public:
    static const int MAXN=2e5+10;
    int N,K;
    int p[MAXN];
    void solve(){
        ios::sync_with_stdio(false);
        cin.tie(0);
        cin>>N>>K;
        for(int u=1;u<=N;u++){
            cin>>p[u];
            p[u]++;
        }
        int ans=0,tmp=0;
        for(int u=1;u<=N;u++){
            if(u<=K){
                tmp+=p[u];
                ans=max(ans,tmp);
            }
            else {
                tmp+=-p[u-K]+p[u];
                ans=max(ans,tmp);
            }
        }
        cout<<fixed<<setprecision(9)<<ans*1.0/2;
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define N 200100
using namespace std;
long long dp[N];
int x[N],l[N];
int main(){
	int n,e,t,cl=-1;
	scanf("%d%d%d",&n,&e,&t);
	for(int i=1;i<=n;i++) scanf("%d",&x[i]);
	dp[0]=0;
	l[n+1]=n;
	for(int i=n;i>=1;i--){
		l[i]=min(l[i+1],i);
		while(l[i]&&2*(x[i]-x[l[i]])<=t) l[i]--;
	}
	for(int i=1;i<=n;i++){
		dp[i]=dp[l[i]]+t;
		for(int j=l[i-1];j<l[i];j++){
			if(cl<0||dp[j]+2*(x[i]-x[j+1])<dp[cl]+2*(x[i]-x[cl+1])){
				cl=j;
			}
		}
		if(cl>=0) dp[i]=min(dp[i],dp[cl]+2*(x[i]-x[cl+1]));
	}
	printf("%lld\n",dp[n]+e);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
using namespace std;

int main() {
	int N, ans=0;
	
	cin >> N;

	vector<string> S(N);

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

	sort(S.begin(), S.end());
	int j = 0;
	while (j < N) {
		if (j == 0 || S[j] != S[j-1]) {
			ans++;
		}
		j++;
	}
	
	cout << ans;
	return 0;
}


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

int main(){
  int n;
  cin>>n;
  long a[n][3];
  cin>>a[0][0]>>a[0][1]>>a[0][2];
  for(int i=1;i<n;i++){
    long x, y, z;
    cin>>x>>y>>z;
    a[i][0] = x + max(a[i-1][1], a[i-1][2]);
    a[i][1] = y + max(a[i-1][0], a[i-1][2]);
    a[i][2] = z + max(a[i-1][0], a[i-1][1]);
  }
  long ans = max(a[n-1][0], max(a[n-1][1], a[n-1][2]));
  cout<<ans;
  return 0;
}

Measured memory_bytes: 5916
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<map>
#define mod 1000000007
using namespace std;
char str[10001];
map<char,int> mp;
int main()
{
	scanf("%s",str);
	mp['A']=1;mp['C']=1;
	mp['G']=1;mp['T']=1;
	int mx=0;
	int num=0;
	for(int i=0;str[i]!='\0';i++)
	{
		if(mp[str[i]]) num++;
		else{
			mx=max(num,mx);
			num=0;
		}
	}
	mx=max(mx,num);
	printf("%d",mx);
}

Measured memory_bytes: 256
using System;


namespace ConsoleApp1 {
    class Program {
        static void Main(string[] args) {
            string[] Input = Console.ReadLine().Split(' ');

            int A = int.Parse(Input[0]);
            int B = int.Parse(Input[1]);
            int C = int.Parse(Input[2]);

            int Max = B / A;
            if(Max >= C) {
                Console.WriteLine(C);
            }
            else {
                Console.WriteLine(Max);
            }
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>

using namespace std;

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

long long  a[n]={0};
long long dp[n];
for(int i=0;i<m;i++)
{
    int x;
    
    cin>>x;
    a[x]=1;
    
    
}
dp[0]=1;
dp[1]=1;
for(int i=2;i<=n;i++)
{
    if(a[i-1]==1&&a[i-2]==1)
    dp[i]= 0;
    else if(a[i-2]==1)
    dp[i]=dp[i-1]%1000000007;
    else if(a[i-1]==1)
    dp[i]=dp[i-2]%1000000007;
    else if(a[i-1]==0&&a[i-2]==0)
    dp[i]=(dp[i-1]+dp[i-2])%1000000007;
}
cout<<dp[n];

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
signed main(){
    string s;
    int g=0 , p=0 , w=0 , l=0;
    cin >> s;
    
    for(int i=0 ;i<s.size() ;i++ ){
        if(p>=g){
            g++;
            if(s[i] == 'p'){
                l++;
            }
        } else {
            p++;
            if(s[i] == 'g'){
                w++;
            }
        }
    }
    
    cout << w - l << endl;
}

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

#define fo(i,n)         for(int i=0;i<n;i++)
#define fo2(i,n)        for(int i=n-1;i>=0;i--)
#define Fo(i,k,n)       for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll              long long
#define si(x)	        scanf("%d",&x)
#define sl(x)	        scanf("%lld",&x)
#define ss(s)	        scanf("%s",s)
#define pi(x)	        printf("%d\n",x)
#define pi2(x)          printf("%d ",x)
#define pl(x)	        printf("%lld\n",x)
#define pl2(x)          printf("%lld ",x)
#define ps(s)	        printf("%s\n",s)
#define pn              printf("\n")
#define deb(x)          cout << #x << "=" << x << endl
#define deb2(x, y)      cout << #x << "=" << x << " , " << #y << "=" << y << endl
#define pb              push_back
#define F               first
#define S               second
#define all(x)          x.begin(), x.end()
#define clr(x)          memset(x, 0, sizeof(x))
#define sortall(x)      sort(all(x))
#define tr(it, a)       for(auto it = a.begin(); it != a.end(); it++)
#define PI              3.1415926535897932384626

typedef pair<int, int>ii;
typedef pair<ll, ll>pl;
typedef vector<int>vi;
typedef vector<ll>vl;
typedef vector<ii>vii;
typedef vector<pl>vpl;
typedef vector<vi>vvi;
typedef vector<vl>vvl;

/*int mpow(int base, int exp);
ll binpow(ll base , ll exp);
void ipgraph(int n, int m);
void dfs(int u);*/

const int mod = 1000000007;
const int N = 3e5+5, M = N;

//vi g[N];
//bool vis[N];

bool ok[1000005];


void solve()
{
    ll n, m, res=0;

    char a;

    scanf("%c",&a);

    if(a>='A' && a<='Z') printf("A\n");
    else printf("a\n");

}


int main()
{
    int t = 1;

    //si(t);

    while(t--)
    {
        solve();
    }

    return 0;
}






















/*void dfs(int u) //DFS
{
    vis[u] = 1;

	for(int v:g[u])
    {
		if (!vis[v])
           dfs(v);
	}

	vis[u] = 0;
}

void ipgraph(int n, int m) //GRAPH INPUT
{
	int i, u, v;

	while(m--)
    {
		si(u); si(v);
		g[u].pb(v);
		g[v].pb(u);
	}
}



ll binpow(ll base, ll exp)
{
    ll res = 1;
    while (exp > 0)
    {
        if (exp & 1)
            res = res * base;
        base = base * base;
        exp >>= 1;
    }
    return res;
}

int mpow(int base, int exp)
{
    base %= mod;
    int result = 1;
    while (exp > 0)
    {
       if (exp & 1) result = ((ll)result * base) % mod;
       base = ((ll)base * base) % mod;
       exp >>= 1;
    }
    return result;
}
*/






//    #include <chrono>
//    using namespace std::chrono;
//    auto start = high_resolution_clock::now();
//    auto stop = high_resolution_clock::now();
//    auto duration = duration_cast<milliseconds>(stop - start);
//    cout << duration.count() << endl;
//#ifdef _DEBUG
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//#endif




Measured memory_bytes: 3684
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

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

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

	map<string, int> mp;
	rep(i, n) {
		string s;
		cin >> s;
		mp[s]++;
	}

	cout << mp.size() << endl;
}

Measured memory_bytes: 19132
n = int(input())
h = list(map(int, input().split()))


def f(left, right, base):
    m = min(h[left:right+1])
    result = 0
    le = -1
    ri = -1
    for i in range(left, right+1):
        if h[i] > m:
            if le == -1:
                le = i
            ri = i
        else:
            if le != -1:
                result += f(le, ri, m)
                le, ri = -1, -1

    if le != -1:
        result += f(le, ri, m)
    return result + (m - base)


print(f(0, n-1, 0))


Measured memory_bytes: 3064
def solve():
  n, k = map(int,input().split())
  group_num = 10
  
  book_map = [[] for i in range(group_num)]
  acc_map = [[0] for i in range(group_num)]

  for i in range(n):
    c,g = map(int,input().split())
    book_map[g - 1].append(c)

  for i in range(group_num):
    bmi = book_map[i]
    bmi.sort(reverse=True)
    append = acc_map[i].append
    acc = 0
    for j in range(len(bmi)):
      acc += (bmi[j] + j * 2)
      append(acc)
  
  dp = [[0] * (k + 1) for i in range(group_num + 1)]
  for y in range(1,k + 1):
    for x in range(1,group_num + 1):
      mp = acc_map[x - 1]
      be = dp[x - 1]
      dp[x][y] = max([be[y - z] + mp[z] for z in range(min(y + 1, len(mp)))])
  
  print(dp[group_num][k])
solve()



Measured memory_bytes: 6328
#include<iostream>

using namespace std;

int main(void)
{
        int n;
        cin >> n;
        int t[n+1],x[n+1],y[n+1];

        for(int i=1;i<=n;i++)
                cin >> t[i] >> x[i] >> y[i];
        t[0]=x[0]=y[0]=0;
        
        bool ans = true;

        for(int i=1;i<=n;i++)
        {
                int dt=t[i]-t[i-1];
                int dx=abs(x[i]-x[i-1]);
                int dy=abs(y[i]-y[i-1]);

                if(dt<dx+dy)
                {
                        ans=false;
                        break;
                }
                else if(dt%2!=(dx+dy)%2)
                {
                        ans=false;
                        break;
                }
        }

        cout << (ans? "Yes" : "No") << endl;
}

Measured memory_bytes: 1408
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int ans = Math.min(b / a, c);
    System.out.println(ans);
  }
}

Measured memory_bytes: 22100
using System;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            int zero = 0;
            int one = 0;

            for(int i=0;i<s.Length;i++)
            {
                if (s[i].Equals('0'))
                    zero++;
                else
                    one++;
            }

            if (zero > one)
                Console.WriteLine((one*2).ToString());
            else
                Console.WriteLine((zero*2).ToString());

        }

    }
}


Measured memory_bytes: 13148
import java.util.*;
import java.io.*;

public class Main {
    static int n;
    static int[][] dp;
    static int mod = 1000000007;
    
    public static int solve(int[][] comp, int womenMask, int currentMen){
            
        if(currentMen == comp.length){
            
            if(womenMask == (1 << n)-1)
                return 1;
            return 0;
     
        }
     
        if(dp[currentMen][womenMask] != -1)
            return dp[currentMen][womenMask];
        
            int ans = 0;
        for(int j = 0; j < comp.length; j++){
            if(comp[currentMen][j] == 1 && (womenMask & (1 << j) ) == 0){
                ans =( ans + solve(comp,(womenMask |  (1 << j) ) , currentMen+1))%mod;
            }
        
        }
        ans %= mod;
        
        return dp[currentMen][womenMask] = ans % mod;
        
    }
    
    
    
    public static void main(String args[]) throws Exception {
    
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
           n = Integer.parseInt(br.readLine().trim());
           dp = new int[n+1][(1 << n)+1];
           int[][] arr = new int[n][n];
           
           for(int i = 0; i < dp.length; i++){
               Arrays.fill(dp[i],-1);
           }
           
           StringTokenizer token;
           
           for(int i = 0; i < n; i++){
              int j = 0;
              token =  new StringTokenizer(br.readLine().trim()," ");
              while(token.hasMoreTokens()){
                  arr[i][j++] = Integer.parseInt(token.nextToken());
              }
               
           }

   
      System.out.println(solve(arr,0,0));
    }
}

Measured memory_bytes: 206420
#include <iostream>
const int first = 100000;
int round_up(int price) // 1000円未満を切り上げ
{
    if (price%1000 == 0) {
        return price;
    }
    int complement  = 1000 - price%1000; // 補数
    return (price + complement);
}
int get_dept(int n) // n週間後
{
    int dept = first;
    for (int i=0; i<n; i++) {
        dept += dept * 0.05;
        dept = round_up(dept);
    }
    return dept;
}
int main()
{
    int n;
    std::cin  >> n;
    std::cout << get_dept(n) << std::endl;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;

#define int long long

signed main(void) {
  int num; // num
  num = 0; // count, result
  // num = numeric_limits<int>::min(); // max
  // num = numeric_limits<int>::max(); // min
  int N;
  int M;
  // array<int, 10000> A;
  // string S;
  // string T;

  int H, W;
  array<string, 50> S;
  array<string, 50> T;
  
  cin >> H >> W;

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

  for (int x = 0; x < H; ++x) {
    T[x] = "";
    for (int y = 0; y < W; ++y) {
      if (S[x][y] == '#') T[x] = T[x] + '#';
      else {
        int tmp = 0;
        for (int i = x - 1; i <= x + 1; ++i) {
          for (int j = y - 1; j <= y + 1; ++j) {
            if (i < 0 || H <= i) continue;
            if (j < 0 || W <= j) continue;
            if (S[i][j] == '#') ++tmp;
          }
        }
        T[x]= T[x] + to_string(tmp);
      }
    }
  }

  for (int i = 0; i < H; ++i) {
    cout << T[i] << endl;
  }
  
  // cin >> N;
  // for (auto it = A.begin(); it < A.begin() + N; ++it)
  //   cin >> *it;
  // for (auto it = A.begin(); it < A.begin() + N; ++it)
  //   if (*it % 2 == 0) ++num;
  // cout << num << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cout << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 28;
constexpr lint   INFL = 1LL << 60;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  vector<int> h(n);
  rep (i, n) cin >> h[i];
  int cnt = 0;
  while (count(all(h), 0) < n) {
    int idx = 0;
    while (idx < n && h[idx] == 0) ++idx;
    int l = idx;
    while (idx < n && h[idx] != 0) ++idx;
    int r = idx;
    rep (i, l, r) h[i]--;
    ++cnt;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();

        // 数取得
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int k = scanner.nextInt();


        // ループの開始
        int n = 0;
        if(a>b){
        	n=b;
        }else {
        	n=a;
        }

        // カウンタ
        int cnt = 0;

        for(int i=n;i>0;i--) {
        	if((a%i==0)&&(b%i==0)) {
        		cnt++;
        		if(cnt==k) {
        			System.out.println(i);
        			break;
        		}
        	}
        }
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}

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

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <sstream>
#include <deque>
#include <queue>
#include <complex>
#include <random>
#include <cassert>
#include <chrono>

using namespace std;

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FIXED cout << fixed << setprecision(12)
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define graph vector<vector<int>>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define f first
#define s second
#define hashmap unordered_map
#define hashset unordered_set
#define eps 1e-9
#define mod 1000000007
#define inf 3000000000000000007ll
#define sz(a) signed(a.size())
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#ifdef DEBUG
    mt19937 gen(857204);
#else
    mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

template<class T, class U> inline void checkmin(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void checkmax(T &x, U y) { if (y > x) x = y; }
template<class T, class U> inline bool ifmax(T &x, U y) { if (y > x) return x = y, true; return false; }
template<class T, class U> inline bool ifmin(T &x, U y) { if (y < x) return x = y, true; return false; }
template<class T> inline void sort(T &a) { sort(all(a)); }
template<class T> inline void rsort(T &a) { sort(rall(a)); }
template<class T> inline void reverse(T &a) { reverse(all(a)); }
template<class T, class U> inline istream& operator>>(istream& str, pair<T, U> &p) { return str >> p.f >> p.s; }
template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }
template<class T> inline T sorted(T a) { sort(a); return a; }

signed main() {
    FAST; FIXED;
    ll a, b, c;
    cin >> a >> b >> c;
    c -= a + b;
    if (c <= 0) {
        cout << "No";
        return 0;
    }
    cout << (4 * a * b < c * c ? "Yes" : "No");
    #ifdef DEBUG
        cerr << "Runtime is: " << clock() * 1.0 / CLOCKS_PER_SEC << endl;
    #endif
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll int
#define N ((ll)101*1000)

ll n,k,a[N],b[N],ans,v[N],cnt_v;
map <ll,ll> mp;
vector <ll> e[N];
bool mark[N];

ll _find(ll x){return lower_bound(v,v+cnt_v,x)-v;}

void dfs(ll x)
{
	mark[x]=1;
	for(auto u:e[x])
		if(!mark[u])
			dfs(u);
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i],a[0]^=a[i],mp[a[i]]++,v[cnt_v++]=a[i];
	mp[a[0]]++;
	v[cnt_v++]=a[0];
	sort(v,v+cnt_v);cnt_v=unique(v,v+cnt_v)-v;
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		mp[b[i]]--;
		if(mp[b[i]]<0)return cout<<"-1\n",0;
		if(b[i]!=a[i])e[_find(a[i])].push_back(_find(b[i])),ans++;
	}
	for(auto u:mp)
		if(u.second)
			e[_find(a[0])].push_back(_find(u.first)),ans++;
	ans-=2;
	for(int i=0;i<cnt_v;i++)
		if(!mark[i])
		{
			dfs(i);
			if(e[i].size())ans++;
		}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 14848
/**
 * ABC042 A
 * 
 * @date 2020.05.02
 * @author 焼き鮭 <yaki-shake@up-tri.me>
 */

#include <iostream>
#include <string>

using std::cin;
using std::cout;
using std::endl;

int main(int argc, char const *argv[])
{
  int count = 0;
  int in;
  for (int i = 0; i < 3; i++)
  {
    std::cin >> in;
    if (in == 5)
      count += 1;
    if (in == 7)
      count += 10;
  }
  std::cout << (count == 12 ? "YES" : "NO") << endl;

  return 0;
}

Measured memory_bytes: 888
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define FOR(i, s, e) for (ll(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (ll(i) = (s); (i) > (e); (i)--)
#define debug(x) cout << #x << ": " << x << endl
#define mp make_pair
#define pb push_back
const ll MOD = 1000000007;
const int INF = 1e9;
const ll LINF = 1e16;
const double PI = acos(-1.0);
int dx[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };
int dy[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/05/20  Problem: ARC 074 B / Link: http://arc074.contest.atcoder.jp/tasks/arc074_b  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */


ll N;

ll ans = LLONG_MIN;
ll a[300030];
ll b[300030];
ll res[300030];
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	cin >> N;

	FOR(i, 0, 3 * N) {
		cin >> a[i];
	}
	priority_queue<ll, vector<ll>, greater<ll>>qa;
	priority_queue<ll>qb;
	ll asum = 0;
	ll bsum = 0;
	FOR(i, 0, 3 * N) {
		qa.push(a[i]);
		asum += a[i];
		if (qa.size() > N) {
			asum -= qa.top(); qa.pop();
		}
		res[i] = asum;
	}
	FORR(i, 3 * N - 1, -1) {
		qb.push(a[i]);
		bsum += a[i];
		if (qb.size() > N) {
			bsum -= qb.top(); qb.pop();
		}
		if(i>=1)
		res[i-1] -= bsum;
	}

	ans = res[N - 1];
	FOR(i, N, 2 * N) {
		ans = max(ans, res[i]);
	}


	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 9716
from heapq import heappop, heappush
n=int(input())
ab=[[int(i) for i in input().split()]for j in range(n)]
cd=[[int(i) for i in input().split()]for j in range(n)]
ab.sort()
cd.sort()

se=set()
for c,d in cd:
    li=[]
    for a,b in ab:
        if a>=c or b>=d:
            continue
        else:
            if (a,b) not in se:
                heappush(li,[-b,a])
    if li:
        b,a=heappop(li)
        se.add((a,-b))
print(len(se))
        
            
            

Measured memory_bytes: 3188
import java.util.Scanner;

class Main{



	public static void main(String[] args) {



		Scanner sc = new Scanner(System.in);			//文字の入力
	String string = sc.next();
	int c = 0;
	for(int i = 0;i < 3;i++){
		if(		string.charAt(i) == 'o'){
			c++;
		}
	}
System.out.println(700+100*c);


	}

	static long comb(int n,int r){
		long ue = 1;
		for(int i = 0;i < r;i++){
			ue *= n-i;
		}
		long sita = 1;
		for(int i = 1;i <= r;i++){
			sita *= i;
		}
		return ue/sita;


	}





}




class Pair implements Comparable{
	String from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}





Measured memory_bytes: 22740
#include <bits/stdc++.h>
            using namespace std;
            #define rep(i,a,b) for(ll i =a; i<b;++i)
            #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
            #define endl "\n"
            #define pb push_back
            #define F first
            #define S second
            #define print(a)       for(auto x : a) cout << x << " "; cout << endl
            #define print1(a)      for(auto x : a) cout << x.F << " " << x.S << endl
            #define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << endl
            #define mk(x,y)  make_pair(x,y)
            typedef  long long  int ll;
            const int N = ( 2e5 + 5 );
            const int mod = 1e9+7;
            ll  n,k,a[N];
    ll pow_mod_m(ll a , ll n)
    {
        if(!n)
            return 1;
        ll pt =  pow_mod_m(a,n/2);
        pt *= pt ; pt %= mod;
        if(n&1)
            pt *= a , pt %= mod;
        return pt;
    }


    int main()
    {
         IOS;
      //     freopen("a_example (2).txt","r",stdin);
      //     freopen("c.txt","w",stdout);

        int ts =1;
        //cin>>ts;
        rep(t,1,ts+1)
        {
            cin >> n >> k;
            ll ans  =0;
            for(int i= k;i>= 1; i--)
            {
                a[i] = k/i;
                a[i] = pow_mod_m(a[i],n);
                for(int j = 2*i; j <= k; j+=i)
                {
                    a[i] = (a[i] -a[j] + mod) % mod;
                }
                ans  += a[i]*i;
                ans %= mod;
            }
            cout << ans <<endl;
        }
    }


Measured memory_bytes: 4396