akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pii = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define reps(i,n) for(int i = 1; i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define rreps(i,n) for(int i = (int)(n); i > 0; i--)
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
template <class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = INT_MAX;
const int MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    vi A(N);
    vvi x(N, vi(20)), y(N, vi(20));
    rep(i, N) {
        cin >> A[i];
        rep(j, A[i]) {
            cin >> x[i][j] >> y[i][j];
            x[i][j]--;
        }
    }
    int ans = 0;
    rep(bit, 1<<N) {
        bool flag = true;
        rep(i, N) {
            rep(j, A[i]) {
                if (bit & 1<<i) {
                    if (y[i][j] == 1) {
                        if (!(bit & 1<<x[i][j])) flag = false;
                    } else {
                        if (bit & 1<<x[i][j]) flag = false;
                    }
                }
            }
        }
        if (flag) chmax(ans, __builtin_popcount(bit));
    }
    cout << ans << endl;
}

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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define dump(x) cerr << #x " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define endl '\n'

#ifdef _DEBUG27_
    //#define STRESS 1
#endif

typedef long long llong;

const int INF = 2e9;
const llong LINF = 2e18;

void inv(bool e);
template<typename T> T sign(T a);
template<typename T> void die(T &a);
template<typename T> void umax(T &a, T b);
template<typename T> void umin(T &a, T b);

bool brute, alter;
int cnt_tests = 1;

// Improove atcoder rating

// Code below

llong a, b, c, d, e, f;

void inp() {
    cin >> a >> b >> c >> d >> e >> f;
}

const int S = 5001;

bool can_water[S], can_shugar[S];

void solve() {
    a *= 100;
    b *= 100;
    for (llong i = 0; i * a < S; ++i) {
        for (llong j = 0; i * a + j * b < S; ++j) {
            can_water[i * a + j * b] = true;
        }
    }
    for (llong i = 0; i * c < S; ++i) {
        for (llong j = 0; i * c + j * d < S; ++j) {
            can_shugar[i * c + j * d] = true;
        }
    }
    bool found = false;
    llong ans = a, ans2 = 0;
    for (llong water = 1; water <= f; ++water) {
        for (llong shugar = 1; water + shugar <= f; ++shugar) {
            if (!can_water[water] || !can_shugar[shugar]) {
                continue;
            }
            if (shugar * 100  <= e  * water) {
                if (!found || ans2 * (water + shugar) < ans * shugar) {
                    ans = water + shugar;
                    ans2 = shugar;
                    found = true;
                }
            }
        }
    }
    cout << ans << ' ' << ans2;
}

void stress() {

}

void naive() {

}

void run();
int main() {
    #ifdef _DEBUG27_
        if (1)
            freopen("input.txt", "r", stdin);
    #else
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        if (0) {
            freopen("palindrome.in", "r", stdin);
            freopen("palindrome.out", "w", stdout);
        }
    #endif
    srand(time(0));
    #ifdef STRESS
        brute = true;
    #else
        brute = false;
    #endif

    for (int i = 0; (i < cnt_tests); i++) {
        run();
    }
    cerr << endl << "Time: " << clock() / 1000.0 << " ms";
    return 0;
}

void run() {
    if (!brute) {
        inp();
    }
    else {
        stress();
    }
    solve();
    cout << endl;
}

template<typename T>
void die(T &a) {
    cout << a;
    exit(0);
}

template<typename T>
T sign(T a) {
    if (a == 0)
        return 0;
    if (a < 0)
        return -1;
    return 1;
}

template<typename T>
void umax(T &a, T b) {
    if (b > a)
        a = b;
}

template<typename T>
void umin(T &a, T b) {
    if (b < a)
        a = b;
}

void inv(bool e) {
    if (!e) {
        vector<int> a;
        a[-1] += 1;
    }
}

/** CLEARING BUFFER

    cout << VAL << flush;

    OR

    printf(VAL);
    fflush(stdout);
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007

void solve()
{
	string s;
	cin>>s;
	ll ans=0;
	for(ll i=1;i<s.size();i++)
		if(s[i]!=s[i-1])
			ans++;
	cout<<ans;
	
	return;
}

int main()
{
	fast;
	ll q=1;
	// cin>>q;
	while(q--)
		solve();
	return 0;
}



Measured memory_bytes: 3780
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	private static ArrayList<Long> fib = new ArrayList<Long>();

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

         long init = 1;

         for(int i = 0; i < N+1; i++){
        	 if(i==0){fib.add(init);continue;}
        	 if(i==1){fib.add(init);continue;}
        	 fib.add(fib.get(i-2) + fib.get(i-1));
         }

         System.out.println(fib.get(fib.size()-1));
	}
}

Measured memory_bytes: 17244
#include<bits/stdc++.h>
using namespace std;
int main()
{
//freopen("input.txt","r",stdin);
int n,c,i,ans,j;
cin>>n;
int a[n];
ans=n;
for(i=0;i<n;i++)
{
cin>>a[i];
}
sort(a,a+n);
for(j=0;j<n;j++){

for(i=1;i*i<=a[j];i++)
{
if(a[j]%i==0) {
if(j==0)
{
if(binary_search(a+1,a+n,i)||binary_search(a+1,a+n,a[j]/i))
{ans--;
//cout<<a[j]<<" ";
break;
}}
else if(j==n-1)
{
if(binary_search(a,a+n-1,i)||binary_search(a,a+n-1,a[j]/i))
{ans--;
//cout<<a[j]<<" ";
break;
}
}
else
{
 if(binary_search(a,a+j,i)||binary_search(a+j+1,a+n,i))
{ans--;
//cout<<a[j]<<" ";
break;
}
if(binary_search(a,a+j,a[j]/i)||binary_search(a+j+1,a+n,a[j]/i))
{ans--;
//cout<<a[j]<<" ";
break;
}
}
}

}
}
cout<<ans<<endl;
}


Measured memory_bytes: 4344
// 表の行数rと列数c、r × c の要素を持つ表を読み込んで、各行と列の合計を挿入した新しい表を出力するプログラムを作成して下さい。
// 最初の行にrとcが空白区切りで与えられます。続くr行にそれぞれc個の整数が空白区切りで与えられます。
// 各行の最後の列としてその行の合計値を、各列の最後の行としてその列の合計値を、最後の行・列に表全体の合計値を挿入して下さい。
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int r, c;
		String str = null;

		// r, c読み込み
		str = scan.nextLine();
		String[] spl = str.split(" ");
		r = Integer.parseInt(spl[0]);
		c = Integer.parseInt(spl[1]);

		// 各行の列読み込み・変換用変数を定義
		String[] input_data = new String[c];
		int[][] input_trans = new int[(r+1)][(c+1)];

		int i = 0;
		int j = 0;

		// 合計値を格納する要素を初期化
		for(i=0; i<r; i++){
			input_trans[i][c] = 0;
		}
		for(j=0; j<c; j++){
			input_trans[r][j] = 0;
		}
		// r行分ループし行列読み込み
		for(i=0; i<r; i++){
			str = scan.nextLine();
			input_data = str.split(" ");
			for(j=0; j<c; j++){
				input_trans[i][j] = Integer.parseInt(input_data[j]);
				input_trans[i][c] = input_trans[i][c] + input_trans[i][j];
				input_trans[r][j] = input_trans[r][j] + input_trans[i][j];
				input_trans[r][c] = input_trans[r][c] + input_trans[i][j];
			}
		}
		// 行列と各列の合計値を出力
		for(i=0; i<(r+1); i++){
			for(j=0; j<(c+1); j++){
				if(j == c){
					System.out.println(input_trans[i][j]);
				} else{
					System.out.print(input_trans[i][j] + " ");
				}
			}
		}

	}
}


Measured memory_bytes: 33896
object Main extends App {
	val a = scala.io.StdIn.readInt
	val b = scala.io.StdIn.readInt
	val c = scala.io.StdIn.readInt
	val x = scala.io.StdIn.readInt / 50

//	10*a + 2*b + c = x

	var count = 0
	
	for(i<-0 to a){
		for(j<-0 to b){
			for(k<-0 to c){
				if(10*i + 2*j + k == x) count += 1
			}
		}
	}

	println(count)

}

Measured memory_bytes: 27580
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

vector<int> r,g,b;

int n[10];
char c[10][2];

bool check(vector<int> v){
	int N=v.size();
	if(N%3!=0) return false;
	int cnt[10];
	for(int i=0;i<10;i++) cnt[i]=0;
	for(int i=0;i<N;i++) cnt[v[i]]++;
	for(int i=1;i<10;i++){
		if(cnt[i]>=3) cnt[i]-=3;
		if(i+2<=9){
			int tmp=cnt[i];
			if(cnt[i]<tmp||cnt[i+1]<tmp||cnt[i+2]<tmp) return false;
			cnt[i]-=tmp;
			cnt[i+1]-=tmp;
			cnt[i+2]-=tmp;
		}
	}
	for(int i=0;i<10;i++) if(cnt[i]!=0) return false;
	return true;
}

int main(){
	int T;
	scanf("%d",&T);
	for(int datano=0;datano<T;datano++){
		r.clear();
		g.clear();
		b.clear();
		for(int i=0;i<9;i++) scanf("%d",n+i);
		for(int i=0;i<9;i++) scanf("%s",c[i]);
		for(int i=0;i<9;i++){
			if(c[i][0]=='R') r.push_back(n[i]);
			else if(c[i][0]=='G') g.push_back(n[i]);
			else b.push_back(n[i]);
		}
		sort(r.begin(),r.end());
		sort(g.begin(),g.end());
		sort(b.begin(),b.end());
		bool flg=true;
		flg&=check(r);
		flg&=check(g);
		flg&=check(b);
		if(flg) printf("1\n");
		else printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 1036
#include <bits/stdc++.h>
using namespace std;
template<class T, class U> bool chmin(T& a, U b) { if (a > b) { a = b; return 1; } return 0; }
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

int main() {
    int n;
    cin >> n;
    const int m = n * n;
    vector<int> p(m);
    for (int &e : p) { cin >> e; e--; }

    vector<vector<int>> dat(n, vector<int>(n));
    vector<vector<bool>> use(n, vector<bool>(n, false));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            dat[i][j] = min({i, j, n - i - 1, n - j - 1});
        }
    }

    auto bfs = [&] (int i, int j) {
        use[i][j] = true;
        queue<pair<int, pair<int, int>>> que;
        que.emplace(dat[i][j], pair(i, j));
        while (not que.empty()) {
            auto [val, _p] = que.front();
            auto [x, y] = _p; que.pop();
            if (x < 0 or n <= x or y < 0 or n <= y) continue;
            for (int k = 0; k < 4; k++) {
                int nx = x + dx[k], ny = y + dy[k];
                if (nx < 0 or n <= nx or ny < 0 or n <= ny) continue;
                long long cost = val + (not use[x][y]);
                if (chmin(dat[nx][ny], cost)) {
                    que.emplace(cost, pair(nx, ny));
                }
            }
        }
    };

    long long ans = 0;
    for (const int &e : p) {
        int i = e / n, j = e % n;
        ans += dat[i][j];
        bfs(i, j);
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;


int main() {
    double a, b; cin >> a >> b;
    for(double i=1; i<=10000; i++) {
        if(floor(i * 0.08) == a && floor(i * 0.1) == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}


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

int main() {
    ll n, x;
    cin >> n >> x;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0;
    for (int i = 1; i < n; i++) {
        ll sum = a[i - 1] + a[i];
        if (sum > x) {
            ll toeat = sum - x;
            if (toeat > 0) {
                if (a[i] < toeat) {
                    a[i - 1] -= toeat - a[i];
                    a[i] = 0;
                    if (a[i - 1] < 0) {
                        puts("-1");
                        return 0;
                    }
                } else
                    a[i] -= toeat;
            }
            ans += toeat;
        }
    }
    cout << ans << endl;
}

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

int main()
{
    int a,b;
    cin >> a >> b;
    if(a==b)    printf("0");
    else
    {
        long long k = a+b;
        if(k%2==0)  printf("%d",k/2);
        else    printf("IMPOSSIBLE");
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////


//////////////////////////////////////

int main() {
    
    ll a, b;
    cin >> a >> b;
    
    ll x = a * b;
     if(a<b){
       ll tmp = a;
       a = b;
       b = tmp;
     }
     ll r = a % b;
     while(r != 0){
       a = b;
       b = r;
       r = a % b;
     }
    cout << x / b << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

void trace(int a[],int n)
{
    int i;
    for(i=0;i<n;i++)
    {
        if(i>0)
        {
            printf(" ");
        }
        printf("%d",a[i]);
    }
    printf("\n");
}

void insertSort(int a[],int n)
{
    int i,j,v;
    for(i=1;i<n;i++)
    {
        v = a[i];
        j = i - 1;
        while(j>=0 && a[j]>v)
        {
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        trace(a,n);
    }
}

int main()
{
    int n,i,j;
    int a[100];
    
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    trace(a,n);
    insertSort(a,n);
    return 0;
}

Measured memory_bytes: 604
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int N, H, W;

int solve(vector<pair<int, int>>& ab) {
  int ret{};
  REP(i, N) {
    if (ab[i].first >= H && ab[i].second >= W)
      ++ret;
  }
  return ret;
}


int main() {
  cin >> N >> H >> W;
  vector<pair<int, int>> ab(N);
  REP(i, N) {
    int a, b;
    cin >> a >> b;
    ab[i] = make_pair(a, b);
  }
  cout << solve(ab) << endl;
}


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

typedef long long int lli;
#define pb push_back
#define gcd __gcd
#define MOD 1000000007
#define mod2 998244353
#define forz(i,n) for(long long int i=0;i<n;i++)
char A[51][51];
set<pair<lli,lli>> s1,s2;
set<pair<lli,lli>>::iterator i1,i2;

lli mod(lli a){
    if(a<0) return -1*a;
    return a;
}

bool comp(pair<lli,lli> a,pair<lli,lli> b){
    return 0;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli t=1,u,j;
    //cin>>t;
    for(u=1;u<=t;u++){
        lli n,m,i,j,p=0,c,q=0,k,a,b,x,y,ne=0,p1=0,q1=0;
        string s1,s2;
        cin>>s1>>s2;
        for(i=0;i<s1.size();i++) if(s1[i]!=s2[i]) p++;
        cout<<p<<endl;
    }
}

Measured memory_bytes: 3752
//AcFreak

#include<bits/stdc++.h>
#define lint long long int 
#define mp make_pair
#define pb push_back
#define f first
#define INF (lint )(1e9)
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define s second
#define endl '\n'
#define pii pair<int,int >
using namespace std;


int main()
{__
      vector<int >arr(3);
      cin>>arr[0]>>arr[1]>>arr[2];

      sort(arr.begin(), arr.end());
      //reverse(arr.begin(), arr.end());

      cout<<arr[2]-arr[0]<<endl;
      return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define MAX 100001
int main(void){
  char s[MAX];
  int i;
  scanf("%s",s);
  for(i=0;i<strlen(s);i++){
    if(i % 2 == 0){
      printf("%c",s[i]);
    }
  }
  return 0;
}

Measured memory_bytes: 1684
using System;

class Test
{
    public static void Main()
    {
        int i = int.Parse(Console.ReadLine());
        
        int h = i / 3600;
        int m = i % 3600 / 60;
        int s = i % 3600 % 60;
        
        Console.WriteLine(h + ":" + m + ":" + s);
        
    }
    
}


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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VL a(n);
  ll sum = 0;
  ll osum = 0;
  ll esum = 0;
  rep(i, n) {
    cin >> a[i];
    sum += a[i];
    if(i != 0 && i%2 == 0) esum += a[i];
    else if(i != 0 && i%2 == 1) osum += a[i];
  }
  sum = sum / 2;
  rep(i, n) {
    if(i % 2 == 0) {
      cout << 2 * (sum - osum) << " ";
      osum = osum - a[(i+1)%n] + a[(i+n)%n];
    }
    else {
      cout << 2 * (sum - esum) << " ";
      esum = esum - a[(i+1)%n] + a[(i+n)%n];
    }
  }
  cout << endl;

  return 0;
}


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

ll two[50];

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    unordered_map<ll, int> mp;
    rep(i, n) {
        cin >> a[i];
        mp[a[i]]++;
    }
    rep(i, 33) {
        two[i] = powl(2, i);
    }
    sort(a.rbegin(), a.rend());
    ll ans = 0;


    rep(i, n) {
        if (mp[a[i]] <= 0) continue;
        for (int j=32; j>=0; --j) {
            ll tmp = two[j];
            if (tmp < a[i]) continue;
            else {
                if (tmp-a[i] == a[i]) {
                    if (mp[a[i]] >= 2) {
                        ans++;
                        mp[a[i]] -= 2;
                        break;
                    }
                }
                else {
                    if (mp[tmp-a[i]] > 0) {
                        ans++;
                        mp[a[i]]--;
                        mp[tmp-a[i]]--;
                        break;
                    }
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 41744
#include<stdio.h>
int main(void){
	int n,i;
	int p,d1,d2;
	int tmp,ans,max=-1;
	while(1){
		scanf("%d",&n);
		if(n==0) break;
		max=-1;
		for(i=0;i<n;i++){
			scanf("%d %d %d",&p,&d1,&d2);
			if(d1+d2>max){
				tmp=p;
				max=d1+d2;
			}
		}
		printf("%d %d\n",tmp,max);
	}
	return 0;
}

Measured memory_bytes: 1028
import java.io.*;

public class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		while(true){
			String s=reader.readLine();
			String[] t;
			t=s.split(" ");
			int n,m;
			n=Integer.parseInt(t[0]);
			m=Integer.parseInt(t[1]);
			if(n==0 &&m==0){
				System.exit(0);
			}
			int ansta=0;
			int ansha=0;
			int[] Sta=new int[n];
			int[] Sha=new int[m];
			for(int i=0;i<n;i++){
				Sta[i]=Integer.parseInt(reader.readLine());
			}
			for(int j=0;j<m;j++){
				Sha[j]=Integer.parseInt(reader.readLine());
			}
			int Sumsta=0;
			int Sumsha=0;
			for(int k=0;k<n;k++){
				Sumsta+=Sta[k];
			}
			for(int l=0;l<m;l++){
				Sumsha+=Sha[l];
			}
			int dif;
			if(Sumsha<Sumsta){
				dif=Sumsta-Sumsha;
			}else{
				dif=Sumsha-Sumsta;
			}
			label:
			for(int p=0;p<n;p++){
				for(int q=0;q<m;q++){
					if(Sumsha==Sumsta){
						if(Sta[p]==Sha[q]){
							ansta=Sta[p];
							ansha=Sha[q];
							break label;
						}
					}
					if(Sumsha<Sumsta){
						if(Sha[q]<Sta[p]){
							if((Sta[p]-Sha[q])*2==dif){
								ansta=Sta[p];
								ansha=Sha[q];
								break label;
							}
						}
					}else{
						if(Sha[q]>Sta[p]){
							if((Sha[q]-Sta[p])*2==dif){
								ansta=Sta[p];
								ansha=Sha[q];
								break label;
							}
						}
					}
				}
			}
			if(ansta==0 &&ansha==0){
				System.out.println("-1");
			}else{
				System.out.println(ansta+" "+ansha);
			}
		}
	}
}	

Measured memory_bytes: 16964
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    x = int(readline())
    
    if x < 1200:
        print('ABC')
    else:
        print('ARC')
    
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9036
#include<bits/stdc++.h>
#define mem(dp,a) memset(dp,a,sizeof(dp))
#define pb(x) push_back(x)
#define m_p(x,y) make_pair(x,y)
#define f(n) for(ll i=0;i<n;i++)
#define r(n) for(ll j=0;j<n;j++)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define pi 3.14159265359
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
typedef long double ld;
ll ESP=1e18;
ll INF=1e9+7;

int main()
{
 hs;
 ll r;
 cin>>r;
 ld ans=2*acos(-1)*r;
 cout <<fixed<<setprecision(20)<<ans<<"\n";
 return 0;

}


Measured memory_bytes: 3796
#include<iostream>

using namespace std;

const int MAX = 50;
int n, m;
int a[MAX], b[MAX];

bool graph[MAX][MAX];
bool visited[MAX];

void dfs(int v){
	visited[v] = true;
	for(int v2 = 0; v2 < n; v2++){
		if(graph[v][v2] == false) continue;
		if(visited[v2] == true) continue;
		dfs(v2);
	}
}

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

	for(int i = 0; i < m; i++){
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}

	int ans = 0;
	for(int i = 0; i < m; i++){
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;

		for(int j = 0; j < n; j++) visited[j] = false;

		dfs(0);

		bool bridge = false;
		for(int j = 0; j < n; j++) if(visited[j] == false) bridge = true;
		if(bridge) ans++;

		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}

	cout << ans << endl;

	return 0;
}


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

using namespace std;

int main() {
//        freopen("input.txt", "r", stdin);
//        freopen("output.txt", "w", stdout);
        int n, k;
        scanf("%d%d", &n, &k);
        vector<int> h(n);
        for (int i = 0; i < n; i++) {
                scanf("%d", &h[i]);
        }
        const int INF = (int) 1e9 + 100;
        vector<int> dp(n + 10, INF);
        dp[0] = 0;
        for (int i = 0; i < n; i++) {
                for (int j = 1; j <= k; j++) {
                        if (i + j < n) {
                                dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
                        }
                }
        }
        printf("%d\n", dp[n - 1]);
        return 0;
}


Measured memory_bytes: 1024
if __name__ == '__main__':
    abc = list(map(int, input().split()))
    K = int(input())
    for _ in range(K):
        abc_sorted = sorted(abc, reverse=True)
        for num in abc_sorted:
            #if num*2 <= 50:
                abc[abc.index(num)] = num*2
                break
    print(sum(abc))

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

int main(){

    int n;
    cin >> n ;
    if(n == 0){
        cout << 0 << endl ;
        return 0 ;
    }
    vector<int> ans ;

    while(n){
        if(n < 0){
            int x = 0 - n ;
            ans.push_back(x % 2) ;
            n = (x + 1) / 2 ;
        }
        else{
            ans.push_back(n % 2) ;
            n = 0 - n / 2 ;
        }
    }

    reverse(ans.begin(), ans.end()) ;
    for(auto i : ans)
        cout << i;
    cout << endl ;

    return 0 ;
}


Measured memory_bytes: 256
#include<stdio.h>

using namespace std;

int main(){
    int a[5];
    scanf("%d%d%d%d%d", &a[0], &a[1], &a[2], &a[3], &a[4]);

    int now = 0;

    int max = 0;

    for(int i = 0; i < 5; i++){
        if(10 - a[i] % 10 > max && 10 - a[i] % 10 != 10){
            max = 10 - a[i] % 10;
        }
    }

    for(int i = 0; i < 5; i++){
        now += a[i];
        if(now % 10 != 0){
            now += 10 - (now % 10);
        }
    }

    now -= max;

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

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, D;
  cin >> N >> D;
  double X[N][D];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < D; j++)
      cin >> X[i][j];
  int ans = 0;
  for (int i = 0; i < N; i++){
    for (int j = i+1; j < N; j++){
      int num = 0;
      for (int k = 0; k < D; k++)
        num += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
      int q = sqrt(num);
      if (q*q == num)
        ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main(void) {
  string s,_s;
  long long k;
  cin >> s >> k;

  long long ans = 0;
  _s = s + s;
  long long con = 1;
  if(s.size() == 1){
    cout << k / 2 << endl;
  }
  else {
    if(k == 1){
      for(int i = 0;i < s.size() - 1;i++){
        if(s[i] != s[i + 1]){
          if(con == 2 || con == 3){
            ans += 1;
          }
          else if(con > 3){
            ans += (con / 2);
          }
          con = 1;
        }
        else{
          con++;
        }
        if(i == s.size() - 2) {
          if(con == 2 || con == 3){
            ans += 1;
          }
          else if(con > 3){
            ans += (con / 2);
          }
        }
      }
    }
    else {
      long long plus = 0;
      int i;
      for(i = 0;i < _s.size() - 1;i++){
        if(_s[i] != _s[i + 1]){
          if(con == 2 || con == 3){
            ans += 1;
          }
          else if(con > 3){
            ans += (con / 2);
          }
          con = 1;
        }
        else{
          con++;
        }
        if(i == s.size() - 2) {
          if(con == 2 || con == 3){
            plus = ans + 1;
          }
          else if(con > 3){
            plus = ans + (con / 2);
          }
          else plus = ans;
        }
        else if(i == _s.size() - 2){
          if(con == 2 || con == 3){
            ans += 1;
          }
          else if(con > 3){
            ans += (con / 2);
          }
          else{}
        }
      }
      if(con == _s.size()) ans = s.size() * k / 2; 
      else ans += ((k - 2) * (ans - plus));
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n , m = gets.split.map(&:to_i)
a = []
b = []
roads = []
point = []

n.times do |p|
  a << gets.chomp.split.map(&:to_i)
  roads << 10000000000
end

m.times do
  b << gets.chomp.split.map(&:to_i)
end

n.times do |x|
  m.times do |y|
    road = ( a[x][0] - b[y][0]).abs + ( a[x][1] - b[y][1] ).abs
    if roads[x] != [roads[x], road].min
      roads[x] = [roads[x], road].min
      point[x] = y + 1
    end
  end
end
puts point


Measured memory_bytes: 1788
n, k = map(int, input().split())
a = list(map(int, input().split()))
alr = [0 for i in range(n)]
now = 1
path = [now]

for i in range(k):
    now = a[now-1]
    # if now in path:
    #     now = path[path.index(now) + (k-i-1)%(len(path) - path.index(now))]
    #     break
    if alr[now-1] != 0:
        now = path[path.index(now) + (k-i-1)%(len(path) - path.index(now))]
        break
    path.append(now)
    alr[now-1] += 1

print(now)


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF (1e10)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x) { cout << setprecision(12) << x << endl; }
template<class T, class... A> void print(const T& first, const A& ... rest) { cout << first << " "; print(rest...); }
struct PreMain { PreMain() { cin.tie(0); ios::sync_with_stdio(false); } } premain;

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

	int N = S.length();

	int K = N;
	REP(i, N) {
		if (S[i] == S[i+1]) {
			K--;
			i += 2;
		}
	}

	print(K);
}


Measured memory_bytes: 1356
#include <stdio.h>

int main(void)
{
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if (a+b==c || b+c==a || c+a==b) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>

int main(void){
    double n,k,kk=0,ans=0;
    int a[2001]={0};

    scanf("%lf %lf",&n,&k);
    for (int i = 0; i < n; i++) scanf("%d",&a[i]);

    for (double i = 1; i <= k-1; i++)
    {
        kk+=i;
        if(kk>1000000007) kk-=1000000007;
    }
    
    for (int i = 0; i < n - 1; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if(a[i]>a[j]){
                ans+=kk+k;
                if(kk+k>1000000007) ans-=1000000007;
            } 
            if(a[i]<a[j]) ans+=kk; 
            if(ans>1000000007) ans-=1000000007;
        }       
    }

    printf("%.0f",ans);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

   ll n,a,b;
   cin>>n>>a>>b;
   ll sum=0;
   for(int i=1;i<=n;i++)
   {
       ll now=0;
       ll ok=i;
       ll okk=i;
       while(okk!=0)
       {
          now+=okk%10;
           okk/=10;
       }
       if(now>=a and now<=b)
       {
           sum+=ok;
       }

   }
   cout<<sum<<endl;



}










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

int main(){
	int a[100];
	int n;
	cin >> n;
	
	for (int i = 0; i < n;i++){
		cin >> a[i];
	}
	while (n > 1){
		n--;
		cout << a[n]<< " ";
		
	}
	cout << a[0] << endl;
}

Measured memory_bytes: 1160
X = int(input())

if X <= 599:
    print(8)
elif X <= 799:
    print(7)
elif X <= 999:
    print(6)
elif X <= 1199:
    print(5)
elif X <= 1399:
    print(4)
elif X <= 1599:
    print(3)
elif X <= 1799:
    print(2)
elif X <= 1999:
    print(1)


Measured memory_bytes: 9172
#define    ll           long long
#define    dd           double
#define    mp           make_pair
#define    pb           push_back
#define    se           second
#define    fi           first
#define    mod          10000007
#define    sob(v)       v.begin(),v.end()
#define    sobr(v)      v.rbegin(),v.rend()
#define    fr(i,a,b)    for(int i=a;i<=b;++i)
#define    frr(i,a,b)   for(int i=a;i>=b;--i)
#define    pi           acos(-1.00)
#define    check        cout<<"*"<<endl
#define    ffix(x)      cout<<fixed<<setprecision(x)
#define    fast         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef map<int,int> mii;
typedef pair<int,int> pii;
typedef pair<int,vi> pp;

int dr[4]= {0,0,-1,1};
int dc[4]= {-1,1,0,0};

const int N=100;


int main()
{
    ll n,q,a,b;
    cin>>n;
    ll sum=0,x;
    map<ll,ll>mm;
    fr(i,1,n)
    {
        cin>>x;
        sum+=x;
        mm[x]++;
    }
    cin>>q;
    while(q--)
    {
        cin>>a>>b;
        sum-=(a*mm[a]);
        sum+=(b*mm[a]);
        mm[b]+=mm[a];
        mm[a]=0;
        cout<<sum<<endl;
    }
    return 0;
}


Measured memory_bytes: 9528
#include <bits/stdc++.h>
using namespace std;
void print() {
    cout << endl;
}
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail) != 0)
        cout << " ";
    print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
    for (auto &a : vec) {
        cout << a;
        if (&a != &vec.back())
            cout << " ";
    }
    cout << endl;
}
template <class T>
void print(vector<vector<T>> &df) {
    for (auto &vec : df) {
        print(vec);
    }
}
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define xrep(i, a, b) for (int i = int(a); i < int(b); ++i)
using ll = long long;
const int INF = 1001001001;

int main() {
    int N, M;
    cin >> N >> M;
    
    print(N*(N-1)/2+M*(M-1)/2);
    
    return 0;
}

Measured memory_bytes: 3552
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <string>
#include <cstring>
#include <math.h>
using namespace std;


int main() {
   int n,m;
 
   cin >> n >> m;
  
   if(n==m){
     cout << "Yes" << endl;
   }else{
cout << "No" << endl;
   }
   
   
  return 0;
}

Measured memory_bytes: 256
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = myconv(next(),4);
  var N = one[0];
  var M = one[1];
  var K = one[2];
  if(K % M == 0 || K % N == 0){
     myout("Yes");
    return;
  }
  for(var i = 1; i <= N; i++){
    for(var j = 1; j <= M; j++){
      var count = (M * i) + (N * j) - 2 * (i * j);
      if(count == K){
         myout("Yes");
        return;
      }
    }
  }
  myout("No");
}

Measured memory_bytes: 7496
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }

const int maxn = 1e5 + 5;
vi g[maxn];
int res = 1, k;

void dfs(int u, int p, int kk){
	res = mul(res, kk);
	int child = 0;
	for(int v : g[u]){
		if(v == p) continue;
		dfs(v, u, k - 1 - child - (u != 1));
		child++;
	}
}

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

	int n;
	cin >> n >> k;
	for(int i = 0; i < n - 1; i++){
		int u, v;
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs(1, 1, k);	
	cout << res;
}

/*
6 4
1 2
1 3
1 4
4 5
2 6
*/

Measured memory_bytes: 9216
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder08
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            if(a == 3 || a == 5 || a == 7)
            {
                Console.WriteLine("YES");
            }
            else Console.WriteLine("NO");
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define F first
#define S second
#define INF 1 << 30

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

typedef struct POINT_tag{
  int x, y;
}POINT_t;

typedef struct LINE_tag{
  POINT_t a, b;
}LINE_t;

typedef struct TRIANGLE_tag{
  POINT_t a, b, c;
}TRIANGLE_t;

int side(POINT_t *p, LINE_t *e){
  POINT_t p1 = *p;
  POINT_t p2 = e->a;
  POINT_t p3 = e->b;

  const int n = p1.x * (p2.y - p3.y) + p2.x * (p3.y - p1.y) + p3.x * (p1.y - p2.y);
  if(n > 0) return 1;
  else return -1;
}

int solve(POINT_t *p, TRIANGLE_t *t){
  LINE_t ab, bc, ca;
  ab.a = t->a; ab.b = t->b;
  bc.a = t->b; bc.b = t->c;
  ca.a = t->c; ca.b = t->a;
  const int pab = side(p, &ab);
  const int pbc = side(p, &bc);
  const int pca = side(p, &ca);

  if((0 < pab) && (0 < pbc) && (0 < pca)) return 1;
  if((0 > pab) && (0 > pbc) && (0 > pca)) return 1;
  return 0;
}

int main(){
  int n;
  scanf("%d", &n);
  while(n--){
    TRIANGLE_t t;
    POINT_t k, s;
    scanf("%d%d%d%d%d%d%d%d%d%d", &t.a.x, &t.a.y, &t.b.x, &t.b.y, &t.c.x, &t.c.y, &k.x, &k.y, &s.x, &s.y);
    if(solve(&k, &t) != solve(&s, &t)) puts("OK");
    else puts("NG");
  }
  return 0;
}

Measured memory_bytes: 1168
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        long n = Long.parseLong(sc.next());
        long a = Long.parseLong(sc.next());
        long b = Long.parseLong(sc.next());

        // 主処理
        long result = 0;

        long diff = b - a;
        if (diff % 2 == 0) {
            result = diff / 2;

        } else {
            long diffA = a - 1; // aから最下卓までの距離
            long diffB = n - b; // bから最上卓までの距離
            if (diffA < diffB) {
                result += diffA; // aを最下卓まで動かす
                result += (b - diffA) / 2; // 残りはお互いに近づく
            } else {
                result += diffB; // bを最上卓まで動かす
                result += (n - a - diffB + 1) / 2; // 残りはお互いに近づく
            }
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 23764
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int foo(int x) {
	if (x < 0) return 0;
	else if (x > 255) return 255;
	else return x;
}

int main() {
	for (;;) {
		int N, M; cin >> N >> M;
		if (N == 0 && M == 0) break;
		vector<int> C(M);
		for (int j = 0; j < M; j++) cin >> C[j];
		vector<int> x(N);
		for (int i = 0; i < N; i++) cin >> x[i];
		vector<int> dp(256, INT_MAX);
		dp[128] = 0;
		for (int i = 0; i < N; i++) {
			vector<int> _dp(256, INT_MAX);
			for (int k = 0; k < 256; k++) {
				if (dp[k] == INT_MAX) continue;
				for (int j = 0; j < M; j++) {
					int _k = foo(k + C[j]);
					_dp[_k] = min(_dp[_k], dp[k] + (x[i] - _k) * (x[i] - _k));
				}
			}
			dp = _dp;
		}
		int mini = INT_MAX;
		for (int k = 0; k < 256; k++)
			mini = min(mini, dp[k]);
		cout << mini << endl;
	}
}

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

int main(){
  string s;
  cin>>s;
  int n=s.size();
  for(int i=0;i<n;i++){
    if(s[i]=='1'){ 
      s[i]='9';
    
    }
    
    else{
      s[i]='1';
    }
  }
  cout<<s<<endl;
}


Measured memory_bytes: 256
import java.io.*;
  
public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
    int W,H,x,y,r;
    String s = buf.readLine();
    String[] strlAry =s.split(" ");
    for(int i=0;i<strlAry.length;i++){
    }
    W= Integer.parseInt(strlAry[0]);
    H= Integer.parseInt(strlAry[1]);
    x= Integer.parseInt(strlAry[2]);
    y= Integer.parseInt(strlAry[3]);
    r= Integer.parseInt(strlAry[4]);
  
    if(((x+r) <=W && 0<=(x-r)) && ((y+r) <=H) &&( 0<=(y-r)) ){
            System.out.println("Yes");
    }
    else{
            System.out.println("No");
    }
}
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int k,s;
  cin >> k >> s;
  int ans=0;
  for(int i=0;i<=k;i++){
    for(int j=0;j<=k;j++){
      if(0<=s-i-j&&s-i-j<=k){
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=1000000007;
	static void Main(){
		Sc sc=new Sc();
		long[] s=sc.La;
		long[,] g=new long[s[0],s[0]];
		long[,] b=new long[s[0],1];
		for(int i = 0;i<s[0];i++) {
			int[] q=sc.Ia;
			for(int j = 0;j<s[0];j++) {
				g[j,i]=q[j];
				b[j,0]+=q[j];
			}
		}
		long[,] c=Mp(b,g,s[1]-1);
		long ans=0;
		for(int i = 0;i<s[0];i++) {ans+=c[i,0];}
		Console.WriteLine("{0}",ans%mod);
	}
	static long[,] Mp(long[,] r,long[,] x,long e){
		while(e>0){
			if((e&1)>0){r=Mm(x,r);}
			x=Mm(x,x);
			e>>=1;
		}
		return r;
	}
	static long[,] Mm(long[,] a,long[,] b){
		long[,] q=new long[a.GetLength(0),b.GetLength(1)];
		for(int i=0;i<b.GetLength(1);i++){
			for(int j=0;j<a.GetLength(0);j++){
				for(int k=0;k<a.GetLength(1);k++){q[j,i]=(q[j,i]+a[j,k]*b[k,i])%mod;}
			}
		}
		return q;
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

Measured memory_bytes: 14176
'use strict'

function main(input) {
  input = input.split(/\n|\s/).map(v => ~~v)
  const n = input.shift()
  const T = input.shift()

  let mincost

  while (input.length >= 1) {
    let c = input.shift()
    let t = input.shift()
    if (t <= T) {
      mincost = mincost ? Math.min(mincost, c) : c
    }
  }
  if (mincost) {
    console.log(mincost)
  } else {
    console.log('TLE')
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N, M;
    while(cin >> N >> M, N) {
        int R;
        cin >> R;
        vector<vector<int>> T(M, vector<int>(1261));
        for (int i = 0; i < R; i++) {
            int t, n, m, s;
            cin >> t >> n >> m >> s;
            m--;
            if (s == 1) {
                T[m][t]++;
            } else {
                T[m][t]--;
            }
        }
        for(int i = 0; i < M; i++) {
            ll sum = 0;
            for(int j = 0; j < 1261; j++) {
                sum += T[i][j];
                T[i][j] = sum;
            }
        }
        int Q;
        cin >> Q;
        for (int q = 0; q < Q; q++) {
            int ts, te, m;
            cin >> ts >> te >> m;
            m--;
            int ans = 0;
            for(int j = ts; j < te; j++) {
                if (T[m][j] > 0) {
                    ans++;
                }
            }
            cout << ans << endl;
        }

    }
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();

    #ifdef LOCAL_ENV
    assert(cin.rdstate() & ios_base::eofbit);
    #endif
}


Measured memory_bytes: 50996
splitline()=split(readline())
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
    n = parseInt(readline())
    a = parseInt.(split(readline()))

    ans = 0
    for i in 1:n
        while a[i]%2 == 0
            a[i] /= 2
            ans += 1
        end
    end

    println(ans)
end

main()


Measured memory_bytes: 136208
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
using namespace std;

#define MAX_N 100
#define INF (INT_MAX/2)

int edges[MAX_N][MAX_N];
int dp[MAX_N][MAX_N];

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


    for (int i=0; i<MAX_N; i++) {
        for (int j=0; j<MAX_N; j++) {
            dp[i][j] = INF;
            edges[i][j] = INF;
        }
    }
    for (int i=0; i<MAX_N; i++) dp[i][i] = 0;

    for (int i=0; i<M; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        edges[a - 1][b - 1] = c;
        edges[b - 1][a - 1] = c;
        
        dp[a - 1][b - 1] = c;
        dp[b - 1][a - 1] = c;
    }

    for (int k=0; k<N; k++) {
        for (int i=0; i<N; i++) {
            for (int j=0; j<N; j++) {
                if (dp[i][k] != INF && dp[k][j] != INF) {
                    dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
                }
            }
        }
    }

    int ans = 0;
    for (int i=0; i<N; i++) {
        for (int j=i+1; j<N; j++) {
            if (edges[i][j] != INF && dp[i][j] < edges[i][j]) {
                ans++;
            }
        }
    }

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

Measured memory_bytes: 384
object Main extends App {
  val lines = io.Source.stdin.getLines().toList
  val params = for (line <- lines) yield {
    line.split(" ").map(_.toLong)
  }

  if (params(0)(0) <= params(1).sum) {
    println("Yes")
  } else {
    println("No")
  }
}


Measured memory_bytes: 42768