akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

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

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/

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




void solve()
{
    int r; cin >> r;
    nout(3*r*r);
}

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

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{
	class Program
	{
		static void Main(string[] args)
		{
			var inputNum = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

			var A = inputNum[0];
			var B = inputNum[1];
			var C = inputNum[2];
			var K = inputNum[3];

			var answer = 0;

			var now = 0;
			var nokori = K;

			// Aの判定
			if(A < K)
			{
				nokori = K - A;
				answer += A;
			}
			else
			{
				nokori = 0;
				answer += K;
			}

			if(nokori > 0)
			{
				// Bの判定
				if (B < nokori)
				{
					nokori = nokori - B;
				}
				else
				{
					nokori = 0;
				}

				if(nokori > 0)
				{
					if(C < nokori)
					{
						answer = answer - C;
					}
					else
					{
						answer = answer - nokori;
					}
				}				
			}

			Console.WriteLine(answer);

		}
	}
}

Measured memory_bytes: 28236
// 深さ優先探索
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func genid(a, b int) int {
	if b < a {
		a, b = b, a
	}
	return a*100000 + b
}

func main() {
	N := readInt()

	ab := make([][2]int, N-1)
	edges := make([][]int, N)
	for i := 0; i < N-1; i++ {
		a := readInt() - 1
		b := readInt() - 1
		ab[i][0], ab[i][1] = a, b
		edges[a] = append(edges[a], b)
		edges[b] = append(edges[b], a)
	}

	colors := make(map[int]int)
	q := make([][3]int, 0, N)
	q = append(q, [3]int{0, -1, -1})
	for len(q) != 0 {
		currentNode, usedColor, parentNode := q[len(q)-1][0], q[len(q)-1][1], q[len(q)-1][2]
		q = q[:len(q)-1]
		color := 1
		for _, childNode := range edges[currentNode] {
			if childNode == parentNode {
				continue
			}
			if color == usedColor {
				color++
			}
			colors[genid(currentNode, childNode)] = color
			q = append(q, [3]int{childNode, color, currentNode})
			color++
		}
	}

	K := -1
	for i := 0; i < N; i++ {
		t := len(edges[i])
		if t > K {
			K = t
		}
	}
	fmt.Println(K)

	for i := 0; i < N-1; i++ {
		fmt.Println(colors[genid(ab[i][0], ab[i][1])])
	}
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


Measured memory_bytes: 14976
#include <iostream>
#include <fstream>

using namespace std;
ifstream fin("date.in");

int a[1001], n, m, k, sumaMax;

void interschimbare(int poz1,int poz2,int vect[])
{
    if(vect[poz1]>vect[poz2]) swap(vect[poz1],vect[poz2]);
}

void interclasare(int poz1,int poz2,int poz3,int vect[])
{
    int v[10001]={0},nrElemente=0;
    int i=poz1,j=poz2;
    while(i<=poz2 && j<=poz3)
        {
         if(vect[i]<vect[j]) v[++nrElemente]=vect[i++];
          else v[++nrElemente]=vect[j++];
        }
    while(i<poz2) v[++nrElemente]=vect[i++];
    while(j<poz3) v[++nrElemente]=vect[j++];

    for(int i=poz1;i<=poz3;++i) vect[i]=v[i];
}

void mergeSort(int li,int ls,int vect[])
{
    if((ls-li)<2) interschimbare(li,ls,vect);
     else{
          int mij=(li+ls)/2;
          mergeSort(li,mij,vect);
          mergeSort(mij+1,ls,vect);
          interclasare(li,mij,ls,vect);
         }
}

int main()
{
    while(1)
    {
    cin>>n>>m;
    if(n==0 && m==0)
        return 0;
    for(k=1; k<=n; ++k)
        cin>>a[k];

    //mergeSort(1,n,a);
    for(int i=1; i<n; ++i)
        {
         for(int j=i+1;j<=n;++j)
            {
             if(a[i]>a[j]) swap(a[i],a[j]);
            }
        }
    int i=1, j=n;
    sumaMax=-1;

    while(i<j)
    {
        if(a[i]+a[j]<=m)
            {
                sumaMax=max(sumaMax,a[i]+a[j]);
                i++;
            }
        else if(a[i]+a[j]>m)
            j--;
    }
    if(sumaMax==-1)
        cout<<"NONE\n";
    else
        cout<<sumaMax<<'\n';
    }
    return 0;
}



Measured memory_bytes: 3084
#![allow(dead_code)]
#![allow(unused_imports)]
#![allow(unused_variables)]

use proconio::*;

fn main() {
    input! {
        k: usize,
    }
    if k % 2 == 0 || k % 5 == 0 {
        println!("-1");
        return;
    }
    let mut cnt: usize = 1;
    let mut sevens: usize = 7;
    while sevens % k != 0 {
        sevens *= 10;
        sevens += 7;
        sevens %= k;
        cnt += 1;
    }
    println!("{}", cnt);
}


Measured memory_bytes: 2108
#include <stdio.h>

int main(void)
{
	int hand[] = {
		0, 0, 0, 0, 0, 
		0, 0, 1, 1, 1, 
		1, 1, 1, 1, 1, 
		1, 0, 0, 0, 0, 
		1, 0, 0, 0, 1, 
		0
	};
	
	char str[512];
	int i, num;
	
	while (scanf("%s", str), str[0] != '#'){
		num = 0;
		i = 1;
		while (str[i] != '\0'){
			if (hand[str[i - 1] - 'a'] != hand[str[i] - 'a']){
				num++;
			}
			i++;
		}
		
		printf("%d\n", num);
	}
	
	return (0);
}

Measured memory_bytes: 540
#include <iostream>
using namespace std;
int main() {
    int a, b, c, k; cin >> a >> b >> c >> k;
    int m = 0;
    while (a >= b) { b *= 2; m++; }
    while (b >= c) { c *= 2; m++; }
    cout << (m <= k ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3156
import java.util.*;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        char[] chars = sc.next().toCharArray();
        long K = sc.nextLong();

        for (int i = 0; i < Math.min(chars.length, K); i++) {
            if (chars[i] != '1') {
                System.out.println(chars[i]);
                return;
            }
        }
        System.out.println('1');
    }
}


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

public class Main{
    public static void main(String args[]) throws Exception{
    	Scanner sc= new Scanner(System.in);
    	int tot= sc.nextInt();
    	int Ncoin= sc.nextInt();
    	int[] coin= new int[Ncoin];
    	int[] min= new int[tot+1];
    	for(int i=0;i<Ncoin;i++){
    		coin[i]= sc.nextInt();
    	}
    	for(int i=1;i<=tot;i++){
    		min[i]= -1;
    	}
    	Queue<Integer> query= new LinkedList<Integer>();
    	query.add(0);
    	while( min[tot]<0 ){
    		int rep= query.size();
    		for(int i=0;i<rep;i++){
    			int q= query.remove();
    			for(int j=0;j<Ncoin;j++){
    				if( q+coin[j]<=tot && min[ q+coin[j] ]<0 ){
    					min[ q+coin[j] ]= min[q]+1;
    					query.add(q+coin[j]);
    				}
    			}
    		}
    	}
		System.out.println(min[tot]);
    }
}

Measured memory_bytes: 24520
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int n, m; 
	int a, b, c, d, e;
	string s, t;
	
	char c1, c2, c3;
	
	static int x[1000] = {};
	static int y[1000] = {};
	
	vector<int> v, u;
	pair<int,int> p;
	
	int r[30] = {};
	
	
	int N, M;
	
	cin>>N>>M;
	
	vector<string> A(N), B(N);
	
	
	for(int i = 0; i < N; i++){
		cin>>A[i];
	}
	
	for(int i = 0; i < N; i++){
		cin>>B[i];
	}
	
	int con = 0;
	
	for(int i = 0; i < N; i++){
		for(int j = 0; j < M ;j++){
			if(A[i][j] != B[i][j]) con++;
		}
	}
	
	cout<<con<<endl;
	return 0;
}


Measured memory_bytes: 11396
#!/usr/bin/env python3
import fractions
a, b, c, d = map(int, input().split())
h = abs(a - c)
w = abs(b - d)
if h == 0 or w == 0:
    ans = 0
else:
    h1 = h // fractions.gcd(h, w)
    w1 = w // fractions.gcd(h, w)
    ans = (h1 + w1 - 1) * fractions.gcd(h, w)
print(ans)


Measured memory_bytes: 5604
N = int(input())
P = list(map(int, input().split()))

count = 0

for i in range(N):
  if P[i] == i + 1:
    if i + 1 == N:
      P[i - 1], P[i] = P[i], P[i - 1]      
    else:
      P[i], P[i + 1] = P[i + 1], P[i]
    count += 1

print(count)    

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

typedef long long ll;
const ll MOD = (ll)(1e9+7);

ll memo[5050][5050];
bool done[5050][5050];

ll comb(int n, int k){
	if(n < k){
		return 0ll;
	}
	if(done[n][k]){
		return memo[n][k];
	}
	done[n][k] = true;
	if(k==0 || k==n){
		return memo[n][k] = 1ll;
	}
	memo[n][k] = (comb(n-1,k-1)+comb(n-1,k))%MOD;
	return memo[n][k];
}

int main(void){
	int N,A,B,C,b,x,y,z,m;
	ll ans=0ll,tmp;
	cin >> N >> A >> B >> C;
	if(B&1){
		cout << 0 << endl;
		return 0;
	}
	b = B>>1;
	for(x=0; x*3<=C; ++x){
		m = min(A,C-x*3);
		for(y=0; y<=m; ++y){
			z = C - x*3 - y;
			tmp = comb(A+b+x,x);
			tmp *= comb(A+b,b); tmp %= MOD;
			tmp *= comb(A,y); tmp %= MOD;
			if(b){
				tmp *= comb(z+b-1,z); tmp %= MOD;
			}else if(z){
				tmp = 0ll;
			}
			ans += tmp; ans %= MOD;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 223360
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
using namespace std;

double X[100], Y[100];

double sq(double x) {
    return x * x;
}

double sqsum(double a, double b) {
    return sq(a) + sq(b);
}

int main() {
    int n;
    while (cin >> n, n) {
        char c;
        for (int i=0; i<n; ++i) {
            cin >> X[i] >> c >> Y[i];
        }
        int ans = 1;
        for (int i=0; i<n; ++i) {
            for (int j=i+1; j<n; ++j) {
                if (sqsum(X[i] - X[j], Y[i] - Y[j]) > 4.0) continue;
                double cx = (X[i] + X[j]) / 2.0;
                double cy = (Y[i] + Y[j]) / 2.0;
                double w = hypot(X[i] - X[j], Y[i] - Y[j]);
                double h = sqrt(1.0 - sq(w / 2.0));
                double dx = (Y[i] - Y[j]) * h / w;
                double dy = (X[j] - X[i]) * h / w;
                int cnt1 = 2, cnt2 = 2;
                for (int k=0; k<n; ++k) {
                    if (k == i || k == j) continue;
                    if (sqsum(cx + dx - X[k], cy + dy - Y[k]) <= 1.0) cnt1 ++;
                    if (sqsum(cx - dx - X[k], cy - dy - Y[k]) <= 1.0) cnt2 ++;
                }
                ans = max(ans, max(cnt1, cnt2));
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1252
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define INF (ll)1e18+7
#define mk make_pair
#define pb emplace_back 
#define all(s) s.begin(),s.end()
typedef vector<int> vi;

void solve(){
int x=0,y=0,n=0,m=0,k=0,q=0,r=0,d=0;
cin>>n;
if(n%1000==0){
	cout<<0<<"\n";
	return;
}
cout<<(1000-(n%1000))<<"\n";

}
int main(){
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0);
   int t=1;
  // cin>>t;
     while(t--){
     	solve();
	 }
     return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main(){
	int a;
	scanf("%d",&a);
	while(a--){
		int ax,bx,cx,dx,ex;
		int ay,by,cy,dy,ey;
		scanf("%d%d%d%d%d%d%d%d%d%d",&ax,&ay,&bx,&by,&cx,&cy,&dx,&dy,&ex,&ey);
		int count=0;
		int p=(dx-ax)*(by-ay)-(dy-ay)*(bx-ax);
		int q=(dx-bx)*(cy-by)-(dy-by)*(cx-bx);
		int r=(dx-cx)*(ay-cy)-(dy-cy)*(ax-cx);
		if(p>=0&&q>=0&&r>=0)count++;
		else if(p<=0&&q<=0&&r<=0)count++;
		p=(ex-ax)*(by-ay)-(ey-ay)*(bx-ax);
		q=(ex-bx)*(cy-by)-(ey-by)*(cx-bx);
		r=(ex-cx)*(ay-cy)-(ey-cy)*(ax-cx);
		if(p>=0&&q>=0&&r>=0)count++;
		else if(p<=0&&q<=0&&r<=0)count++;
		if(count==1)printf("OK\n");
		else printf("NG\n");
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll ;
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 const ll inf=1e9+7;
ll dp[50][3000];
int main()
{
    fast;
    
    ll a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    
    if(a[2]==a[0]+a[1])
    cout<<"Yes";
    else
    cout<<"No";

}

		
	
	
	
	


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 10000000000000;
#define all(v) v.begin(), v.end()
 
int main(){
  ll R,C,K;
  cin >> R >> C >> K;
  vector<vector<vector<ll>>> A(R,vector<vector<ll>>(C,vector<ll>(4,0)));
  vector<vector<ll>> B(R,vector<ll>(C,0));
  rep(i,K){
    ll a,b,c;
    cin >> a >> b >> c;
    B.at(a-1).at(b-1)=c;
  }
  rep(i,R){
    rep(j,C){
      if(i==0&&j==0){
        A.at(i).at(j).at(1)=B.at(i).at(j);
      }else if(i==0){
        A.at(i).at(j).at(0)=A.at(i).at(j-1).at(0);
        A.at(i).at(j).at(1)=max(A.at(i).at(j-1).at(1),A.at(i).at(j-1).at(0)+B.at(i).at(j));
        A.at(i).at(j).at(2)=max(A.at(i).at(j-1).at(2),A.at(i).at(j-1).at(1)+B.at(i).at(j));
        A.at(i).at(j).at(3)=max(A.at(i).at(j-1).at(3),A.at(i).at(j-1).at(2)+B.at(i).at(j));
      }else if(j==0){
        A.at(i).at(j).at(0)=max(A.at(i-1).at(j).at(0),A.at(i-1).at(j).at(1));
        A.at(i).at(j).at(1)=A.at(i).at(j).at(0)+B.at(i).at(j);
      }else{
        A.at(i).at(j).at(0)=max(A.at(i).at(j-1).at(0),max(A.at(i-1).at(j).at(0),max(A.at(i-1).at(j).at(1),max(A.at(i-1).at(j).at(2),A.at(i-1).at(j).at(3)))));
        A.at(i).at(j).at(1)=max(A.at(i).at(j-1).at(1),max(A.at(i).at(j).at(0)+B.at(i).at(j),A.at(i).at(j-1).at(0)+B.at(i).at(j)));
        A.at(i).at(j).at(2)=max(A.at(i).at(j-1).at(2),A.at(i).at(j-1).at(1)+B.at(i).at(j));
        A.at(i).at(j).at(3)=max(A.at(i).at(j-1).at(3),A.at(i).at(j-1).at(2)+B.at(i).at(j));
      }
    }
  }
  cout << max(A.at(R-1).at(C-1).at(0),max(A.at(R-1).at(C-1).at(1),max(A.at(R-1).at(C-1).at(2),A.at(R-1).at(C-1).at(3)))) << endl;
}

Measured memory_bytes: 706064
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>

#define SIZE 100005
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
using namespace std;


int main()
{	
	ll H, W, N;
	scanf("%lld %lld %lld", &H, &W, &N);
	ll sr, sc;
	scanf("%lld %lld", &sr, &sc);

	char S[200001];
	char T[200001];			//まず文字列を読み込む
	scanf("%s", &S);
	scanf("%s", &T);
	
	ll xmin, xmax, ymin, ymax;
	xmin=0;
	xmax=H-1;
	ymin=0;
	ymax=W-1;
	ll answer=1;	//YESが1の想定
	for(ll i=N-1;i>=0;i--)
	{
		//まず青木がのがれる
		if(T[i]=='U')
		{
			if(xmax<H-1){xmax++;}
		}
		
		if(T[i]=='D')
		{
			if(xmin>0){xmin--;}
		}
		
		if(T[i]=='L')
		{
			if(ymax<W-1){ymax++;}
		}
		
		if(T[i]=='R')
		{
			if(ymin>0){ymin--;}
		}
		
		//次に高橋が追い詰める
		if(S[i]=='U')
		{
			xmin++;
		}
		
		if(S[i]=='D')
		{
			xmax--;
		}
		
		if(S[i]=='L')
		{
			ymin++;
		}
		
		if(S[i]=='R')
		{
			ymax--;
		}
		
		if((ymax<ymin)||(xmax<xmin))
		{
			answer=0;
		}
	}
	
	if((answer==1)&&(sr-1>=xmin)&&(sr-1<=xmax)&&(sc-1>=ymin)&&(sc-1<=ymax))
	{	printf("YES");
	}
	else
	{	printf("NO");
	}
	
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const int maxN = 200; int n;
int dist[maxN];
vector<int> graph[maxN];

bool bfs(int origin)
{
  memset(dist, -1, sizeof(dist));
  queue<int> q; q.push(origin), dist[origin] = 0;
  while (!q.empty())
  {
    int u = q.front(); q.pop();
    for (int v: graph[u])
      if (dist[v] == -1)
        q.push(v), dist[v] = dist[u] + 1;
      else if (dist[u] == dist[v])
        return false;
  }
  return true;
}

int main()
{
  scanf("%d", &n);
  for (int i = 0; i < n; i ++)
    for (int j = 0; j < n; j ++)
    {
      int has; scanf("%1d", &has);
      if (has) graph[i].push_back(j);
    }

  bool can = true;
  int ans = 0;
  for (int i = 0; i < n && can; i ++)
  {
    can = bfs(i);
    ans = max(ans, *max_element(dist, dist+n) + 1);
  }
  if (can) bfs(max_element(dist, dist+n) - dist);
  printf("%d\n", !can ? -1 : ans);

  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main () {
	int A,B,C,D;
	cin >>A>>B>>C>>D;
	if(A + B == C+D){
		cout << "Balanced" << endl;
	}else if(A+B > C+D){
		cout << "Left" << endl;
	}else{
		cout << "Right" << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int i=1,k;
		int n = sc.nextInt();

		while(i<=n){
			if(i%3==0){
				System.out.printf(" %d",i);
			}else{
				k=i;
				while(k!=0){
					if(k%10==3){
						System.out.printf(" %d",i);
						break;
					}else{
						k=k/10;
					}
				}
			}
			i++;
		}
		System.out.printf("\n");
	}
}

Measured memory_bytes: 33872
#include <iostream>
#include <algorithm>
using namespace std;
const int INF=1 << 29;

int main(){

  //initialization
  int N;
  int T, A;
  int min = INF;
  int ans = 0; 

  //input 
  cin >> N;
  cin >> T >> A;
  int H[N]; 
  int temparature[N];
  
  T*=1000;
  A*=1000;

  //solver
  for(int i=0; i<N; i++){
    cin >> H[i];
    temparature[i] = abs(A - (T - H[i] * 6));

    if(min > temparature[i]){
	min = temparature[i];
   	ans = i+1;
    }
    //cout << temparature[i] << " ";
  }
 // cout << "\n";
  cout << ans << "\n"; 
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define sor(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
#define vi vector<int>
#define vl vector<long long>
#define vii vector<int,vector<int>>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;



int main()
{
    int a,b;
    cin>>a>>b;
    if(a <= b) out(a);
    else out(a-1);



    return 0;
}


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

int main() {
    int n;
    cin >> n;
    
    vector<int> vec(n * 2);
    rep(i, n * 2){
        cin >> vec[i];
    }
    
    int sum = 0;
    for(int i = 0; i < n * 2; i += 2){
        sum += vec[i+1] - vec[i] + 1;
    }
    cout << sum << endl;
    
}

Measured memory_bytes: 3632
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

ll dp[510][5][2];
//dp[i][j][k] は　iけためまでで　jこ0でない数存在している k = 0は未満確定　時の個数

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

  // 上のくらいから順番に追っていく
  dp[0][0][1] = 1;
  rep(i,N){
    ll d = s[i] - '0';
    rep(j,K + 1){
      // 元から未満確定　と　今確定
      if(d == 0){
        // 元から未満確定
        dp[i + 1][j + 1][0] += dp[i][j][0] * 9;
        // 0を選ぶ
        dp[i + 1][j][0] += dp[i][j][0];

        // まだ同じ可能性
        dp[i + 1][j][1] += dp[i][j][1];
      }
      else{
        // 元から未満確定　と　今確定
        dp[i + 1][j + 1][0] += dp[i][j][0] * 9 + dp[i][j][1] * (d - 1);
        // まだ同じ可能性
        dp[i + 1][j + 1][1] += dp[i][j][1];
        // 0を選べば j は増えない　、未満が確定する
        dp[i + 1][j][0] += dp[i][j][0] + dp[i][j][1];
      }
    }
  }
  
  cout << dp[N][K][0] + dp[N][K][1] << endl;
}


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

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

  int ans = 40000001;
  for (int i = -100; i <= 100; i++) {
    int cost = 0;
    for (int j = 0; j < N; j++) {
      cost += (a[j] - i) * (a[j] - i);
    }

    ans = min(cost, ans);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
X = int(input())
if 400 <= X <= 599:
    print('8')
elif 600 <= X <= 799:
    print('7')
elif 800 <= X <= 999:
    print('6')
elif 1000 <= X <= 1199:
    print('5')
elif 1200 <= X <= 1399:
    print('4')
elif 1400 <= X <= 1599:
    print('3')
elif 1600 <= X <= 1799:
    print('2')
elif 1800 <= X <= 1999:
    print('1')

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a, b, c, d;
	scanf("%d%d%d%d", &a, &b, &c, &d);
	int cnt=0;
	for(int i=0;i<=100;i++){
		if(a<=i&&i<b&&c<=i&&i<d)cnt++;
	}
	printf("%d\n", cnt);
}



Measured memory_bytes: 256
/**
*   Bismillahir Rahmanir Rahim.
*   Imtiaz_rafi
*   PCIU, CHITTAGONG
**/
#include<bits/stdc++.h>
using namespace std;
#define speed() ios::sync_with_stdio(0);cin.tie(0);
#define file() freopen ("input.txt", "r", stdin);freopen ("output.txt", "w", stdout);
#define rep(i,a) for(ll i=0;i<a;i++)
#define rep1(i,begin,end) for(ll i=begin;i<=end;i++)
#define trace(x) cerr << #x << " = " << x << endl
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(v)   v.begin(),v.end()
#define rall(v)   v.rbegin(),v.rend()
#define pb push_back
#define pf push_front
#define mp make_pair
#define F first
#define S second
#define pi acos(-1)
#define en '\n'
// bitshift (1LL<<(3)) *2^3
typedef long long int ll;
typedef vector<ll>vi;
typedef map<ll,ll>mi;
typedef pair<ll,ll>pll;
typedef vector<pll> vll;
typedef set<ll>st;
typedef set<char>sc;
ll dx[] = {-1,+1,0,0,+1,-1,+1,-1};
ll dy[] = {0,0,-1,+1,+1,+1,-1,-1};
const ll mx = 1e5+123;
const ll MOD = 1e9+7;

template <class T> T power(T a,T b){a%=MOD;if(!a) return 0;T p=1;while(b>0){if(b&1){p*=a;p%=MOD;}a*=a;a%=MOD;b=b>>1;}return p;}
template <class T> void print(vector<T> &v){for(T u:v){cout<<u<<" ";}cout<<endl;}
template <class T> T gcd(T a, T b){return (b!=0?gcd<T>(b,a%b):a);}
template <class T> T lcm(T a, T b){return (a/gcd<T>(a,b)*b);}

int main()
{
    speed();
    string s,t;
    ll i,j,k=0,ans=0,m = INT_MAX;
    cin>>s>>t;
    if(s.size()==t.size())
    {
        for(j=0;j<s.size();j++)
        {
            if(s[j]!=t[j])
                ans++;
        }
    }
    else
    {
        for(i=0;i<=(s.size()-t.size());i++)
        {
            ans = 0;
            for(j=0;j<t.size();j++)
                if(s[i+j]!=t[j])
                    ans++;
            m = min(m,ans);
        }
        ans = m;
    }
    cout<<ans<<endl;




return 0;
}



Measured memory_bytes: 3596
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace atcoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var buffer = Console.ReadLine().Split();
            var N = int.Parse(buffer[0]);
            var R = int.Parse(buffer[1]);

            if (N >= 10)
                Console.WriteLine(R);
            else
                Console.WriteLine(R + 100 * (10 - N));
        }
    }
}


Measured memory_bytes: 27452
#include<iostream>
#include<vector>

using namespace std;

typedef long long int llint;

int N;

int main() {
	cin >> N;
	vector<int> A(N);
	vector<llint> table(N, 0);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		table[A[i] - 1]++;
	}
	llint ans = 0;
	for (int i = 0; i < N; i++) {
		ans += table[i] * (table[i] - 1) / 2;
	}
	for (int i = 0; i < N; i++) {
		int n = table[A[i] - 1];
		cout << ans - (n - 1) << endl;
	}
}

Measured memory_bytes: 4992
#include<math.h>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include <array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
//AtCoderC++.cpp

using namespace std;


int main() {
	int N, K, X, Y; cin >> N >> K >> X >> Y;
	cout << min(N, K)*X + max(0, N - K)*Y << endl;
}


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

#define sswap(x, y) { x+=y; y=x-y; x-=y; }
#define LSOne(S) ((S) & (-S))

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
	int n, m;
	cin >> n >> m;
	int v[n+12];
	vi h;
	for (int i = 0; i < n; i++) {
		int e; cin >> e;
		h.pb(e);
	}
	mset(v, 0);
	while (m--) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		if (!v[b] && (h[a] >= h[b])) {
			v[b] = 1;
			n--;
		}
		if (!v[a] && (h[b] >= h[a])) {
			v[a] = 1; 
			n--;
		}
	}
	cout << n << ende;
  return 0;
}


Measured memory_bytes: 4216
module Main where

import Control.Applicative
import Control.Monad

main :: IO ()
main = do
    [a, b, c, x, y] <- fmap read . words <$> getLine
    let uxy = min (a + b) (2 * c)
    let ux = min a (2 * c)
    let uy = min b (2 * c)
    let amt1 = uxy * (min x y)
    let amt2 = case x `compare` y of
            EQ -> 0
            LT -> uy * (y - x)
            GT -> ux * (x - y)
    print $ amt1 + amt2

Measured memory_bytes: 508
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <map>
#include <functional>
#include <limits>
#include <set>
#include <stack>
#include <cctype>
#define rep(i,a,b) for((i)=a;i<(int)(b);i++)

#define AAA (1000000007) 


using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pairII;


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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll powD(ll a, ll b) {
	ll ans = 1;
	a %= AAA;
	for (int i = 0; i < b; i++)
	{
		ans *= a;
		ans %= AAA;
	}
	return ans;
}



int main() {
//	int i, j, k;

	int N, M, K;

	int A, B;
	cin >> A >> B;

	if ((A + B) % 2 == 1) {
		cout << "IMPOSSIBLE\n";
		return 0;
	}
	cout << (A + B) / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
	int x;
	cin>>x;
	for(int i=1;i<1000000000;i++){
		if((1+i)*i/2>=x){
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
// スタックサイズ: 100MB

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }


int main() {
	
	ll a, b, x;
	cin >> a >> b >> x;
	cout << (a <= x && x <= a + b ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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

























int main(){
    ll n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> e(m);
    REP(i, m){
        ll a, b;
        cin >> a >> b;
        a--; b--;
        e[i] = {a, b};
    }
    
    ll ans = 0;
    REP(i, m){
        vector<vector<ll>> g(n);
        REP(j, m){
            if(i == j) continue;
            ll a = e[j].first, b = e[j].second;
            g[a].push_back(b);
            g[b].push_back(a);
        }
        vector<bool> used(n);
        used[0] = true;
        queue<ll> que;
        que.push(0);
        while(!que.empty()){
            ll now = que.front(); que.pop();
            for(ll to : g[now]){
                if(!used[to]){
                    used[to] = true;
                    que.push(to);
                }
            }
        }
        REP(j, n){
            if(!used[j]){
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int N;
	
	cin >> N;

	cout << N * N * N << endl;

	
	return 0;
}


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

int main(){
  int N;
  cin >>N;
  vector<int> vec(N-1);
  vector<int> ans(N); 
  for(int i=0;i<N-1;i++){
    cin >>vec[i];
    ans[vec[i]-1]++;
  }
  for(int i=0;i<N;i++){
    cout << ans[i] <<endl;
  }
}

Measured memory_bytes: 4836
s=input()
b1=1 <= int(s[:2]) <= 12
b2=1 <= int(s[2:]) <= 12
if b1 and b2:
    ans="AMBIGUOUS"
elif b1 and not b2:
    ans="MMYY"
elif not b1 and b2:
    ans="YYMM"
else:
    ans="NA"
print(ans)


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

int h,w;
char mp[111][111];
int nmp[111][111];
int ans;

int nx[] = { 0,-1, 0, 1};
int ny[] = {-1, 0, 1, 0};

typedef pair<int, int> P;
queue<P> que;

int main(){
  ios_base::sync_with_stdio(false);

  for(int i=0;i<111;i++){
    for(int j=0;j<111;j++){    
      nmp[i][j] = -1;
    }
  }

  cin >> h >> w;
  for(int i=0;i<h;i++){
    cin >> mp[i];
    for(int j=0;j<w;j++){
      if(mp[i][j] == '.')ans++;
    }
  }

  que.push(make_pair(0, 0));
  nmp[0][0] = 1;
  mp[0][0] = '#';
  while(!que.empty()){
    P n = que.front();
    que.pop();
    int x = n.first;
    int y = n.second;
   
    if(x == (w-1) && y == (h-1)){
      break; 
    } 
      
    for(int i=0;i<4;i++){
      int gx = x + nx[i];
      int gy = y + ny[i];
      if(gx >= 0 && gx < w && gy >= 0 && gy < h && mp[gy][gx] != '#'){
        mp[gy][gx] = '#';
        nmp[gy][gx] = nmp[y][x] + 1;
        que.push(make_pair(gx, gy));
      }
    } 
  }
  
  if(nmp[h-1][w-1] == -1){
    cout << -1 << endl;
  } else {
    cout << ans-nmp[h-1][w-1] << endl;
  } 

  return 0;
}

Measured memory_bytes: 384
from itertools import product


def f(n):
    tmp = [range(3)] * n
    return product(*tmp)


a, b, c = map(int, input().split())
K = int(input())
flag = 0
for I in f(K):
    x, y, z = a, b, c
    for i in I:
        if i == 0:
            x *= 2
        elif i == 1:
            y *= 2
        else:
            z *= 2

    if x < y < z:
        flag = 1
        break

print(['No', 'Yes'][flag])

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

void print_times(string s, unordered_map<string, int> &u_map) {
  cout << s << " x " << u_map[s] << endl;
}

int main() {
  unordered_map<string, int> u_map;
  u_map["AC"] = 0;
  u_map["WA"] = 0;
  u_map["TLE"] = 0;
  u_map["RE"] = 0;
  
  int N;
  string s;
  
  cin >> N;
  
  for (int i = 0; i < N; ++i) {
    cin >> s;
    u_map[s]++;
  }
  
  print_times("AC", u_map);
  print_times("WA", u_map);
  print_times("TLE", u_map);
  print_times("RE", u_map);
  
  return 0;
}




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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

typedef pair<long long, long long> ii;
vector<ii> vec;
long long a[100005], n, dp[100005];
vector<int> graph[100005];

int main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        vec.pb(mp(a[i], i));
    }
    for(int i = 1; i <= n - 1; i++){
        int u, v;
        cin >> u >> v;
        graph[u].pb(v);
        graph[v].pb(u);
    }
    sort(vec.begin(), vec.end());
    for(int i = 0; i < vec.size(); i++){
        if(dp[vec[i].se] == 0){
            for(int j = 0; j < graph[vec[i].se].size(); j++){
                int v = graph[vec[i].se][j];
                if(a[v] > a[vec[i].se])
                    dp[v] = 1;
            }
        }
    }
    for(int i = 1; i <= n; i++){
        if(dp[i])
            cout << i << " ";
    }
}


Measured memory_bytes: 2816
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;

#define MAXN 200000
int N,M;
char S[MAXN+5],T[MAXN+5];
vector<int> pos[30];

int main(){
    scanf("%s%s",S+1,T+1);
    N=strlen(S+1),M=strlen(T+1);
    for(int i=1;i<=M;i++)
        pos[T[i]-'a'].push_back(i);
    for(int i=0;i<26;i++){
        for(int j=1;j<int(pos[i].size());j++){
            int t1=pos[i][j],t2=pos[i][j-1];
            if(S[t1]!=S[t2]){
                puts("No");
                return 0;
            }
        }
        pos[i].clear();
    }
    for(int i=1;i<=N;i++)
        pos[S[i]-'a'].push_back(i);
    for(int i=0;i<26;i++){
        for(int j=1;j<int(pos[i].size());j++){
            int t1=pos[i][j],t2=pos[i][j-1];
            if(T[t1]!=T[t2]){
                puts("No");
                return 0;
            }
        }
    }
    puts("Yes");
}


Measured memory_bytes: 2676
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <array>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back

const int dx[]={1,1,1,0,0,-1,-1,-1};
const int dy[]={-1,0,1,-1,1,-1,0,1};
inline bool in(int x, int y){ return 0<=x&&x<4&&0<=y&&y<4; }
int n;
char board[4][5];
int v[100],w[100],c[100]={};
string word[100];
bool used[4][4]={};
int dp[10001]={};

void dfs(int i,int x,int y,int si){
    const string& s=word[si];
    if(i==(int)s.size()-1){
        c[si]++;
    } else {
        used[y][x]=1;
        rep(d,8){
            int nx=x+dx[d], ny=y+dy[d];
            if(in(nx,ny) && s[i+1]==board[ny][nx] && !used[ny][nx])
                dfs(i+1,nx,ny,si);
        }
        used[y][x]=0;
    }
}

int main(){
    cin>>n;
    rep(i,n){
        cin>>word[i];
        cin>>v[i];
        w[i]=word[i].size();
    }
    rep(i,4) cin>>board[i];
    rep(si,n)rep(y,4)rep(x,4){
        if(word[si][0]==board[y][x]) dfs(0,x,y,si);
    }
    int sum;cin>>sum;
    rep(i,n){
        if(c[i]==0) continue;
        for(int j=sum; j>=0; j--){
            for(int k=1; k<=c[i] && j-w[i]*k>=0; k++){
                dp[j]=max(dp[j],dp[j-w[i]*k]+v[i]*k);
            }
        }
    }
    cout<<dp[sum]<<endl;
}

Measured memory_bytes: 1248
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	int N;
	cin >> N;
	vector <pair<ll, int>> vec;
	map<int, int> mp;
	rep( i, 0, N ){
		int input;
		cin >> input;
		mp[input]++;
	}
	int num = 0;
	for(auto m:mp){
		if (m.second >= 4){
			vec.push_back(P(m.first, 1));
			num += 4;
		}
		else if (m.second >= 2){
			vec.push_back(P(m.first, 0));
			num += 2;
		}
	}
	sort_desc( vec );
	if (num >= 4){
		if (vec[0].second == 1){
			cout << vec[0].first*vec[0].first << endl;
		}
		else
			cout << vec[0].first*vec[1].first << endl;
	}
	else{
		cout << "0\n";
	}

}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Measured memory_bytes: 4992
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
ans = a[0]
i = 1
j = 1
while i < n - 1:
    for x in range(2):
        ans += a[j]
        i += 1
        if i == n - 1:
            print(ans)
            exit()
    j += 1
print(ans)

Measured memory_bytes: 31404
W, H, x, y, r = map(int, input().split())
checker = [False, False, False, False, False]
checker[0] = (2*r) <= W and (2*r) <= H
checker[1] = x >= r
checker[2] = (x+r) <= W
checker[3] = y >= r
checker[4] = (y+r) <= H
if all(checker):
    print("Yes")
else:
    print("No")


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

#define GET_MACRO(a, b, c, d, NAME, ...) NAME
#define REP(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define REP2(i, a) REP3(i, 0, a)
#define REP3(i, a, b) REP4(i, a, b, 1)
#define REP4(i, a, b, s) for (int i = (a); i < (int)(b); i += (s))
#define REPR(...) GET_MACRO(__VA_ARGS__, REPR4, REPR3, REPR2)(__VA_ARGS__)
#define REPR2(i, a) REPR3(i, 0, a)
#define REPR3(i, a, b) REPR4(i, a, b, 1)
#define REPR4(i, a, b, s) for (int i = (b)-1; i >= (int)(a); i -= (s))
#define ALL(c) (c).begin(), (c).end()
#define DUMP(x) (std::cerr << #x << ':' << ' ' << x << '\n')
#define TMPL_T template <typename T>
#define TMPL_TU template <typename T, typename U>
#define mut auto
#define let const auto

using Int = long long;
// clang-format off
namespace extio {
std::string delimiter=" ",pdelimiter=" ";
std::string bracket_b="",bracket_e="";
void chdelim(const std::string&s){delimiter=s;}
void chpdelim(const std::string&s){pdelimiter=s;}
void chbracket(const std::string&b,const std::string&e){bracket_b=b,bracket_e=e;}
TMPL_T  void pcont(std::ostream&os,const T&x){int c=0;for(const auto&a:x){if(c++)os<<delimiter;os<<a;}}
TMPL_TU void ppair(std::ostream&os,const std::pair<T,U>&p){os<<bracket_b<<p.first<<pdelimiter<<p.second<<bracket_e;}
}
namespace std {
TMPL_T ostream& operator<<(ostream&os,const vector<T>&x){extio::pcont(os,x);return os;}
TMPL_T ostream& operator<<(ostream&os,const set<T>&x){extio::pcont(os,x);return os;}
TMPL_T ostream& operator<<(ostream&os,const multiset<T>&x){extio::pcont(os,x);return os;}
TMPL_T ostream& operator<<(ostream&os,const deque<T>&x){extio::pcont(os,x);return os;}
TMPL_TU ostream& operator<<(ostream&os,const map<T,U>&x){extio::pcont(os,x);return os;}
TMPL_TU ostream& operator<<(ostream&os,const pair<T,U>&x){extio::ppair(os,x);return os;}
}
TMPL_TU inline bool chmax(T&x,U a){return x<a&&(x=a,1);}
TMPL_TU inline bool chmin(T&x,U a){return a<x&&(x=a,1);}

inline int in(){int x;std::cin>>x;return x;}

struct Initializer_ {
  Initializer_(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(0);
    std::cout << std::setprecision(10);
    std::cerr << std::setprecision(10);
  }
} precalc;
// clang-format on
// }}}

using namespace std;

signed main() {
  int a, b;
  while (cin >> a >> b) {
    cout << to_string(a + b).size() << endl;
  }
  return 0;
}

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

int main(){
    int h, w;
    while(true){
        cin >> h >> w;
        if(h == 0)
            break;
        int ah = 1e9, aw;
        int val = h*h + w*w, val_ = 1e9;
        for(int i=1; i<=150; i++){
            for(int j=i+1; j<=150; j++){
                int v = i*i + j*j;
                if(v >= val){
                    if(v == val){
                        if(i > h){
                            ah = i;
                            aw = j;
                            val_ = val;
                            i = 200;
                            j = 200;
                        }
                    }else {
                        if(v == val_ && i < ah){
                            ah = i;
                            aw = j;
                            j = 200;
                        }
                        if(v < val_){
                            ah = i;
                            aw = j;
                            val_ = v;
                            j = 200;
                        }
                    }
                }
            }
        }
        cout << ah << ' ' << aw << endl;
    }
  
    return 0;
}

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

int main(){
  int d, t, s;
  cin >> d >> t >> s;
  cout << (s*t >=d ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3620
import sys


def prepare(n, MOD):
    f = 1
    factorials = [1]
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv

    solo_invs = [0] + [f * i % MOD for f, i in zip(factorials, invs[1:])]

    return factorials, invs, solo_invs


def decompose_inverses(solo_invs, MOD):
    # 各整数 g に対して、g の約数である各 i について dcm[i] を全て足すと 1/g になるような数列を作成
    n = len(solo_invs)
    dcm = solo_invs[:]
    for i in range(1, n):
        d = dcm[i]
        for j in range(2 * i, n, i):
            dcm[j] -= d
    for i in range(1, n):
        dcm[i] %= MOD
    return dcm


n, *aaa = map(int, sys.stdin.buffer.read().split())
MOD = 998244353
LIMIT = max(aaa)
count = [0] * (LIMIT + 1)
double = [0] * (LIMIT + 1)
for a in aaa:
    count[a] += a
    double[a] += a * a
_, _, solo_invs = prepare(LIMIT, MOD)
dcm = decompose_inverses(solo_invs, MOD)

ans = 0
inv2 = solo_invs[2]
for d in range(1, LIMIT + 1):
    ans = (ans + dcm[d] * (sum(count[d::d]) ** 2 - sum(double[d::d])) * inv2) % MOD
print(ans)


Measured memory_bytes: 152012
//Multiple Clocks

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using garph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    nvarep(n,t);
    ll ans = t[0];
    rep(i,1,n){
        ans = lcm(ans,t[i]);
    }
    cout<<ans<<nnn;
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 8080
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;

typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

long long int MOD = 1000000007;
int N,K,L;

int main(){
	ll A,B,C;
	int X,Y;
	cin>>A>>B>>C>>X>>Y;
	ll ans=(ll)X*A+(ll)Y*B;
	for(int i=0;i<=max(X,Y);i++){
		ans=min(ans,(max((ll)0,(ll)X-(ll)i))*A+(max((ll)0,(ll)Y-(ll)i))*B+(ll)2*(ll)i*C);
	}
	cout<<ans<<endl;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int N, M; cin >> N >> M;
  int a, b, c;
  int ans = 0;
  vector<vector<int>> G(N, vector<int>(N, mod));
  rep(i,N) G[i][i]=0;
  rep(i,M) {
    cin >> a >> b >> c; a--; b--;
    G[a][b] = G[b][a] = c;
  }
  vector<vector<int>> H = G;
  rep(k,N) rep(i,N) rep(j,N) G[i][j] = min(G[i][k]+G[k][j], G[i][j]);
  rep(i,N) rep(j,N) if(H[i][j]!=1e9+7 && G[i][j]!=H[i][j]) ans++;
  //rep(i,N) { rep(j,N) cout << G[i][j] << " "; cout << endl;}
  //rep(i,N) { rep(j,N) cout << H[i][j] << " "; cout << endl;}

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


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

using namespace std;

#define N 120000
#define LL long long

LL n,m,ans,a[N],b[N],pre[N],suf[N],q[N];

int main(){
	scanf("%lld%lld",&n,&m);
	for (LL i=1;i<=n;++i) scanf("%lld%lld",&a[i],&b[i]);
	for (LL i=1;i<=n;++i) pre[i]=pre[i-1]+b[i];
	for (LL i=n;i;--i) suf[i]=suf[i+1]+b[i];
	LL tt=1,ww=0;
	for (LL i=1;i<=n;++i){
		ans=max(ans,suf[i]-(m-a[i]));
		for (;tt<=ww&&suf[q[ww]]-(m-a[q[ww]])*2<=suf[i]-(m-a[i])*2;--ww);
		q[++ww]=i;
	}
	for (LL i=1;i<=n;++i){
		for (;tt<=ww&&q[tt]<=i;++tt);
		if (tt<=ww) ans=max(ans,suf[q[tt]]-(m-a[q[tt]])*2+pre[i]-a[i]);
	}
	tt=1,ww=0;
	for (LL i=n;i;--i){
		ans=max(ans,pre[i]-a[i]);
		for (;tt<=ww&&pre[q[ww]]-a[q[ww]]*2<=pre[i]-a[i]*2;--ww);
		q[++ww]=i;
	}
	for (LL i=n;i;--i){
		for (;tt<=ww&&q[tt]>=i;++tt);
		if (tt<=ww) ans=max(ans,pre[q[tt]]-a[q[tt]]*2+suf[i]-(m-a[i]));
	}
	printf("%lld\n",ans);
	
	return 0;
}
			

Measured memory_bytes: 4480