akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template
double dp[301][301][301];

int N;

double dfs(int i, int j, int k) {
    if(i < 0 || j < 0 || k < 0) return 0;
    if(dp[i][j][k] != -1) return dp[i][j][k];
//    cout << i << "," << j << "," << k << endl;
    return dp[i][j][k] = dfs(i - 1, j, k) * i / (i + j + k) + dfs(i + 1, j - 1, k) * j / (i + j + k) + dfs(i, j + 1, k - 1) * k / (i + j + k) + (double)N / (i + j + k);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    cin >> N;
    vector<int> A(3);
    rep(i, N) {
        int a;
        cin >> a;
        A[a - 1]++;
    }
    rep(i, 301) rep(j, 301) rep(k, 301) dp[i][j][k] = -1;
    dp[0][0][0] = 0;
    output(dfs(A[0], A[1], A[2]), 10);
    
    
    return 0;
}


Measured memory_bytes: 213376
import sys
from collections import defaultdict as dd
import heapq
input = sys.stdin.buffer.readline
N = int(input())
e = dd(list)
for i in range(1, N):
  n1 = 10 * i
  n2 = i + 1
  e[i].append((n1 % N, 0))
  e[i].append((n2 % N, 1))
class dijkstra:
  def __init__(self, n, e):
    self.e = e
    self.n = n
  def path(self, s, t):
    d = [float("inf")] * (self.n + 1)
    vis = set()
    d[s] = 0
    h = [s]
    while not t in vis and len(h):
      v = heapq.heappop(h)
      v1 = v % (10 ** 6)
      v0 = v // (10 ** 6)
      if v1 in vis: continue
      vis.add(v1)
      for p in self.e[v1]:
        d[p[0]] = min(d[p[0]], d[v1] + p[1])
        if p[0] in vis: continue
        heapq.heappush(h, d[p[0]] * (10 ** 6) + p[0])
    return d[t]
d = dijkstra(N, e)
print(d.path(1, 0) + 1)

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

int main()
{
    ll n;
    ll a;
    scanf("%lld",&n);
    ll cnt=0;

        for(int i=1;i<=n;i++)
        {
            scanf("%lld",&a);
            if(a%2==0)cnt++;
        }
        if(cnt==n)printf("second\n");
        else printf("first\n");

    return 0;
}


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


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        long[] nm = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var n = nm[0];
        var m = nm[1];
        long[] h = Console.ReadLine().Split().Select(long.Parse).ToArray();

        long[] a = new long[m];
        long[] b = new long[m];
        for (int i = 0; i < m; i++)
        {
            long[] tmp = Console.ReadLine().Split().Select(long.Parse).ToArray();
            a[i] = tmp[0];
            b[i] = tmp[1];
        }

        var tbd = new Dictionary<long, long>() { };
        for (int i = 0; i < a.Length; i++)
        {
            if (!tbd.ContainsKey(a[i] - 1))
            {
                tbd.Add(a[i] - 1, h[b[i] - 1]);
            }
            else
            {
                if (tbd[a[i] - 1] < h[b[i] - 1])
                {
                    tbd[a[i] - 1] = h[b[i] - 1];
                }
            }

            if (!tbd.ContainsKey(b[i] - 1))
            {
                tbd.Add(b[i] - 1, h[a[i] - 1]);
            }
            else
            {
                if (tbd[b[i] - 1] < h[a[i] - 1])
                {
                    tbd[b[i] - 1] = h[a[i] - 1];
                }
            }
        }

        long ans = 0;
        for (int i = 0; i < n; i++)
        {
            if (tbd.ContainsKey(i))
            {
                if (tbd[i] < h[i])
                {
                    ans++;
                }
            }
            else
            {
                ans++;
            }
        }

        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 52348
#include <bits/stdc++.h>
using namespace std;
int main()
{
int i;
cin>>i;
if(i%2==0)
{int b;
b=i*i;
b/=4;
cout<<b;

}
else
{int b=i/2;
int c=b*(b+1);
cout<<c;
}
}


Measured memory_bytes: 256
input_line = list(map(int,input().split()))
input_hp = list(map(int,input().split()))

if input_line[0] <= input_line[1]:
    print('0')
else:
    input_hp.sort()
    result_input_hp = len(input_hp) - input_line[1]
    sum_total = sum(input_hp[:result_input_hp])
    print(sum_total)

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

int main() {
  int s, w;
  cin >> s >> w;
  if (w >= s)
    cout << "unsafe" << endl;
  else
    cout << "safe" << endl;
}

Measured memory_bytes: 3624
package main

import(
    "fmt"
)



func main() {
    var x,a,b int
    fmt.Scan(&x,&a,&b)
    ans := (x-a)%b
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 0;
int h, w;
char arr[55][55];

int adj[]={1, 0, -1, 0, 1, 1, -1, -1};
int adj1[]={0, 1, 0, -1, -1, 1, 1, -1};

bool cek(int r, int c){
		if(r>0&&r<=h&&c>0&&c<=w&&arr[r][c]=='#'){
			return true;
		}
		return false;
	}

int main(){
	IOS
	cin >> h >> w;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin >> arr[i][j];
		}
	}
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(arr[i][j]=='#') continue;
			int ans=0;
			for(int k=0;k<8;k++){
				int row=i+adj[k];
				int col=j+adj1[k];
				if(cek(row, col)) ans++;
			}
			//cout << i << ' ' << j << ' ' << ans << '\n';
			arr[i][j]=ans+'0';
		}
	}
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cout << arr[i][j];
		}
		cout << '\n';
	}	
}


Measured memory_bytes: 3596
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
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 nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

int main(void){
    int n;
    cin >> n;
    string s;
    cin >> s;

    if(n % 2 != 0){
        cout << "No" << endl;
    } else {
        if(s.substr(0, n / 2) == s.substr(n / 2, n)){
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(m), edge(m - 1);
    for (int& x : a)
    {
        cin >> x;
    }
    if (n >= m)
    {
        cout << 0 << endl;
        return 0;
    }

    sort(a.begin(), a.end());
    for (int i = 1; i < m; ++i)
    {
        edge.at(i - 1) = a.at(i) - a.at(i - 1);
    }
    sort(edge.begin(), edge.end());
    for (int i = 0; i < n - 1; ++i)
    {
        edge.pop_back();
    }
    int ans = 0;
    for (int i = 0; i < edge.size(); ++i)
    {
        ans += edge.at(i);
    }

    cout << ans << endl;
}


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.9f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<int, int> P;

const int N = 1e6+5;
string s,t = "Yes";
vector<int> v[N];
ll w,h,x,y,result;
// int a[N];



int main () {
  cin >> w >> h >> x >> y;
  pd(1.0 * w * h / 2.0);
  pi(x*2 == w && y* 2 == h ? 1 : 0);br();
}


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

using namespace std;

const int N = 1e5 + 5;

long long a, b;
map <long long, int> mm;

bool checkpr (long long x) {
    if (x < 2) return false;
    if (x < 4) return true;
    for (int i = 2; 1LL * i * i <= x; i++) {
        if (x % i == 0) return false;
    }
    
    return true;
}

void factorize (long long x) {
    for (int i = 2; 1LL * i * i <= x; i++) {
        if (x % i == 0) {
            mm[i]++;
            while (x % i == 0) {
                x /= i;
            }
        }
    }
    
    if (x >= 2) mm[x]++;
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> a >> b;
    factorize(a); factorize(b);
    
    long long ans = 0;
    for (auto i: mm) if (i.second == 2 && checkpr(i.first)) ans++;
    cout << ans + 1;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <sstream>
#include <complex>
#include <ctime>
#include <cassert>
#include <functional>

using namespace std;

typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> PII;

#define REP(i,s,t) for(int i=(s);i<(t);i++)
#define FILL(x,v) memset(x,v,sizeof(x))

const int INF = (int)1E9;
#define MAXN 100005

int N;
VI adj[MAXN];
int dfs(int x, int p) {
  int sg = 0;
  REP(i,0,adj[x].size()) {
    int y = adj[x][i];
    if (y == p) continue;
    sg ^= dfs(y, x) + 1;
  }
  return sg;
}
int main() {
  cin >> N;
  REP(i,0,N-1) {
    int x,y;
    scanf("%d%d", &x, &y); x--; y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  puts(dfs(0, -1) ? "Alice" : "Bob");
  return 0;
}


Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }

class Solver {
  public:
    int R, N;
    vector<int> XL, XR, H;
    int get_height(double x) {
        int res = 0;
        rep(i, N) if(XL[i] <= x and x <= XR[i]) set_max(res, H[i]);
        return res;
    }
    bool check(double t) {
        rep(i, 80 + 1) {
            for(int j = -1; j <= 1; j++) {
                double x = (i - 40) / 2.0 + 1e-5 * j;
                double h = sqrt(R * R - x * x) - R + t;
                if(get_height(x) <= h) return false;
            }
        }
        return true;
    }
    bool solve() {
        cin >> R >> N;
        if(R == 0) return false;
        XL.resize(N); XR.resize(N); H.resize(N);        
        rep(i, N) cin >> XL[i] >> XR[i] >> H[i];

        double l = 0, r = 21;
        while(r - l > 1e-8) {
            double m = (l + r) / 2.0;
            (check(m) ? l : r) = m;
        }
        printf("%.10lf\n", l);
        return true;
    }
};

int main() {
    while(Solver().solve());
    return 0;
}

Measured memory_bytes: 3212
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000000000009
#define int long long
using P = pair<int,int>;

vector<P> prime_factorize(int a){
    vector<P> res;
    for(int i = 2;i*i <= a;i++){
        int num = 0;
        while(a % i == 0){
            num++;
            a /= i;
        }
        res.push_back(make_pair(i,num));
    }
    if(a != 0) res.push_back(make_pair(a,1));
    return res;
}
signed main(){
    int n,p;
    cin >> n >> p;
    auto res = prime_factorize(p);
    int ans = 1;
    /*for(auto u:res){
        cout << u.first << u.second << endl;
    }*/
    for(auto u:res){
        for(int i = 1;i <= u.second/n;i++){
            ans *= u.first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 9964
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int n,p,sum[10005];
int a[200005];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	char c;
	cin>>n>>p;
	FOR(i,1,n){
		cin>>c;
		a[n-i+1]=c-'0';
	}
	if(10%p==0){
		int ans=0;
		FOR(i,1,n)if(a[i]%p==0)ans+=n-i+1;
		cout<<ans;RE 0;
	}
	sum[0]=1;
	int t=0,powt=1;
	FOR(i,1,n){
		t=(t+powt*a[i])%p;
		sum[t]++;
		powt=powt*10%p;
	}
	int ans=0;
	rep(i,0,p)ans=ans+sum[i]*(sum[i]-1)/2;
	cout<<ans;
	RE 0;
}




Measured memory_bytes: 1920
#include<iostream>
#include<string>
#include<cctype>
using namespace std;

int main(){

    string line;
    int n;//シャッフルの回数
    int num;//シャッフルごとの枚数

    while(1){
        cin >> line;
        if(line[0]=='-') break;

        cin >> n;

        for(int i=0; i<n; i++){ //シャッフル
            cin >> num;
            line.insert(line.size(), line.substr(0,num));
            line.erase(0,num);
        }
        cout << line <<endl;
    }

    return 0;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
  
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
typedef long long ll;

const ll MOD=1000000007ll;
const int MAX=5100000;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

ll fact[MAX], fact_inv[MAX];

ll power(ll a, ll b){
	ll res=1;
	while(b>0){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

// nCr
ll comb(ll n, ll r){
	ll t=1000000;
	fact[0]=1;
	REP(i, t) fact[i+1]=fact[i]*(i+1)%MOD;
	fact_inv[t]=power(fact[t], MOD-2);
	FORR(i, 0, t) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
	return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}
  
int main()
{
  int i,n; cin >> n;
  int a[n] = {0};
  int tmp;
  rep(i,n-1){cin >> tmp; a[tmp-1]++;}
  rep(i,n){cout << a[i] << endl;}

  return 0;
}


Measured memory_bytes: 4416
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int N = 1e5 + 11;
int n, a[N], m, f[N];
priority_queue<int> q;
int read(){
    int x = 0;
    char ch = getchar();
    while(ch > '9' || ch < '0')ch = getchar();
    while(ch >= '0' && ch <= '9')x = 10 * x + ch - 48, ch = getchar();
    return x;
}
int main(){
    n = read(), m = read();
    for(int i = 1;i <= n; i++)a[i] = read(), q.push(a[i]);
    while(m--){
        int now = q.top();
        q.pop();
        now /= 2;
        q.push(now);
    }
    LL ans = 0;
    while(q.size()){
        ans += 1LL * q.top();
        q.pop();
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1148
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    int n, m;
    cin >> n >> m;
    vector<int> height(n);
    vector<bool> biggest(n, 1);
    for (int i = 0; i < n; i++) {
        cin >> height[i];
    }
    for (int i = 0; i < m; i++) {
        int obv1, obv2;
        cin >> obv1 >> obv2;
        obv1--;
        obv2--;
        if (height[obv1] < height[obv2]) {
            biggest[obv1] = 0;
        }
        else if (height[obv2] < height[obv1]) {
            biggest[obv2] = 0;
        }
        else {
            biggest[obv1] = 0;
            biggest[obv2] = 0;
        }
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (biggest[i]) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3728
n=int(input())

a=list(map(int,input().split()))
ans=[0]*n

for i in range(n):
    if i % 2 == 0:
        ans[0] += a[i]
    else:
        ans[0] -= a[i]
        

for i in range(1,n):
    ans[i] = 2*a[i-1] - ans[i-1]
    
for i in range(n):
    print(ans[i], end=" ")

Measured memory_bytes: 14028
N,K=map(int,input().split())
D=list(input().split())

while True:
    A=str(N)
    count = 0
    for i in range(len(A)):
        if A[i] in D:
            N+=1
            break
        else:
            count +=1
            if count == len(A):
                print(N)
                exit()


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    long W = scanner.nextInt();
    long H = scanner.nextInt();
    int x = scanner.nextInt();
    int y = scanner.nextInt();

    System.out.printf("%f %d\n", W * H * 0.5d, (W % 2 == 0 && W / 2 == x && H % 2 == 0 && H / 2 == y) ? 1 : 0);
  }
}


Measured memory_bytes: 23764
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if ((c == 'L' && i % 2 == 0) || (c == 'R' && i % 2 == 1)) {
        System.out.println("No");
        return;
      }
    }
    System.out.println("Yes");
  }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




int main() {
  ll x,y;
  cin>>x>>y;

  ll a,b,c,d;
  cin>>a>>b>>c>>d;

  if(a<c) {
    swap(a,c);
    swap(b,d);
  }

  ll sa=a*x+b*y-c*x-d*y;

  if(sa==0) {
    cout << "infinity" << endl;
    return 0;
  }

  if(sa>0) {
    cout << 0 << endl;
    return 0;
  }

  sa*=-1;
  ll dis=(a-c)*x;

  if(dis%sa==0) cout << 2*(dis/sa) << endl;
  else cout << 2*(dis/sa)+1 << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n,cnt = 0;
  string s,str;
  cin >> n;
  cin >> s;
  while(n--) {
    cin >> str;
    int strl = str.size(),sl = s.size();
    for(int i=0;i<strl;i++){
      for(int j=1;j<strl;j++){
        string ss;
        for(int k=0;k<sl;k++){
          if(i + j*k < strl) ss += str[i+j*k];
        }
        if(ss == s){
          cnt++;
          goto exit;
        }
      }
    }
  exit:;
  }
  cout << cnt << endl;
}

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


int main(){
  long counter=0;
  int a,b,c;
  cin >> a >> b >>c;
  if(a+b>=c-1){
    counter=b+c;
  }else{
    counter=b+a+b+1;
  }
  cout << counter << endl;
}


Measured memory_bytes: 256
N, X = [int(str) for str in input().strip().split()]
x = [int(str) for str in input().strip().split()]

fix_x = sorted([abs(i - X) for i in x])

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

ans = fix_x[0]
for i in range(len(fix_x)):
    ans = gcd(ans, fix_x[i])

print(ans)

Measured memory_bytes: 14228
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
#include <bitset>

using ll = long long int;
using ul = unsigned long long int;

namespace lamlib
{
	// Absolute
	template<class T> inline T abs(const T &a){ return (a>0) ? a : -a; }
	// GCD: a > b
	ul gcd(ul a,ul b) { return (!b) ? a : gcd(b,a%b); }
}

int main(int argc,char *argv[])
{
	ll n,m;
	std::cin >> n >> m;

	std::vector<ll> wa_ans(n,0);
	std::vector<bool> ac_ans(n,false);
	for(ll i = 0;i < m;++i)
	{
		ll p;
		std::string s;
		std::cin >> p >> s;
		if(s == "AC") ac_ans[p-1] = true;
		else if(!ac_ans[p-1]) ++wa_ans[p-1];
	}

	ll ac_cnt = 0, wa_cnt = 0;
	for(ll i = 0;i < n;++i)
	{
		if(ac_ans[i])
		{
			++ac_cnt;
			wa_cnt += wa_ans[i];
		}
	}

	std::cout << ac_cnt << " " << wa_cnt << std::endl;

	return 0;
}

Measured memory_bytes: 1152
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var S = sc.next().ToCharArray();
        for (int i = 1; i < 4; i++) {
            if (S[i-1] == S[i]) {
                WriteLine("Bad");
                return;

            }
        }
        WriteLine("Good");
    }
}

class Combination {
    static int mod = 1000000007;

    public static long Calc(int a, int b) {
        if (b > a - b) return Calc(a, a - b);

        long ansMul = 1;
        long ansDiv = 1;
        for (int i = 0; i < b; i++) {
            ansMul *= (a - i);
            ansDiv *= (i + 1);
            ansMul %= mod;
            ansDiv %= mod;
        }
        return ansMul * ModPow(ansDiv, mod - 2) % mod;
    }

    private static long ModPow(long a, int p) {
        if (p == 0) return 1;
        if (p % 2 == 0) {
            long half = ModPow(a, p / 2);
            return half * half % mod;
        } else {
            return a * ModPow(a, p - 1) % mod;
        }
    }
}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N,M;
    cin >> N >> M;
    if(N > M)swap(N,M);
    if(M - N > 1){
        cout << "0\n";return 0;
    }
    ll n = 1,m = 1;
    for(ll i = 1;i <= N;i++){
        ll k = i;
        k %= mod;
        n *= k;
        n %= mod;
    }
    for(ll i = 1;i <= M;i++){
        ll k = i;
        k %= mod;
        m *= k;
        m %= mod;
    }
    if(M - N == 1){
        cout << (n * m) % mod << endl;
    }
    else{
        cout << (n * m) % mod * 2 % mod << endl;
    }
}

Measured memory_bytes: 3640
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;
typedef double D;

struct P {
    D x, y;
    P(D x, D y) : x(x), y(y) { }
    P() { }
};


P operator +(P a, P b) {
    a.x += b.x, a.y += b.y;
    return a;
}

P operator -(P a, P b) {
    a.x -= b.x, a.y -= b.y;
    return a;
}

// ???????????????
P operator *(P p, D s) {
    p.x *= s, p.y *= s;
    return p;
}

D inp(P a, P b) {
    return a.x*b.x + a.y*b.y;
}

D norm(P p) {
    return inp(p, p);
}

struct L : vector<P> {
    L(P a, P b) {
        this->push_back(a);
        this->push_back(b);
    }

    L() {
        this->resize(2);
    }
};

// abs???????????????norm??????
P projection(L l, P p) {
    P a = l[1] - l[0];
    P b = p - l[0];
    double t = inp(b, a) / norm(a);
    return l[0] + a * t;
}

int main() {
    double x, y;

    cin >> x >> y;
    P p0(x, y);

    cin >> x >> y;
    P p1(x, y);

    L l(p0, p1);

    int Q; cin >> Q;
    while(Q--) {
        cin >> x >> y;
        P p2(x, y);
        P p = projection(l, p2);
        printf("%.10f %.10f\n", p.x, p.y);
    }
}

Measured memory_bytes: 1248
# C - H and V
def get_grid(H):
	grid = []
	
	for i in range(H):
		grid.append(input())

	return grid


def get_combis(n):
	import itertools
	numbers = list(range(n))
	combis = []

	for i in range(n + 1):
		arr = list(itertools.combinations(numbers, i))
		
		for a in arr:
			combis.append(set(a))
	
	return combis


def count_black(h, w):
	global grid
	global H
	global W
	
	count = 0
	
	for i in range(H):
		for j in range(W):
			if grid[i][j] == '#':
				if not i in h and not j in w:
					count += 1
	
	return count


H, W, K = map(int, input().split())
grid = get_grid(H)

h_combis = get_combis(H)
w_combis = get_combis(W)
ans = 0

for h in h_combis:
	for w in w_combis:
		if count_black(h, w) == K:
			ans += 1

print(ans)
		

Measured memory_bytes: 9168
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<ll, llP> llPP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

//********************************template END****************************************//

ll memo[3][1010][1010];

void solve(void){

	int N, M;
	cin >> N >> M;

	matll as(N, vecll(3, 0));

	rep(N, i) rep(3, j)
	{
		cin >> as[i][j];
	}

	ll ans = 0;

	rep((1<<3), b)
	{
		vecll xs(N, 0);
		rep(N, i)
		{
			rep(3, j)
			{
				xs[i] += as[i][j]*(b >> j & 1 ? -1 : 1);
			}
		}

		sort(all(xs));
		reverse(all(xs));

		ll res = 0;
		rep(M, i)
		{
			res += xs[i];
		}

		ans = max(ans, res);

	}

	cout << ans << endl;
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


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

int c[10][10005];
const int INF = (int)1e9+1;

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    int ans = INF;
    rep(div, 1<<(h-1)){
        int g = 0;
        vector<int> id(h);
        rep(i, h){
            id[i] = g;
            if(div>>i&1)g++;
        }
        g++;
        rep(i, h)rep(j, w) c[id[i]][j] = 0;
        rep(i, h)rep(j, w)c[id[i]][j] += (s[i][j] - '0');

        int num = g-1;
        vector<int> now(g);
        auto add = [&](int j){
            rep(i, g)now[i] += c[i][j];
            rep(i, g)if(now[i]>k) return false;
            return true;
        };
        rep(j, w){
            if(!add(j)){
                num++;
                now = vector<int>(g);
                if(!add(j)){
                    num = INF;
                    break;
                }
            }
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
    return 0;
}

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

class unionfind {
  vector<int> par, s;
  
public:
  unionfind(int n) {
    for (int i = 0; i < n; i++) {
      par.push_back(i);
      s.push_back(1);
    }
  }
  
  int find(int n) {
    if (par.at(n) == n) return n;
    return find(par.at(n));
  }
  
  void merge(int m, int n) {
    m = find(m);
    n = find(n);
    if (m == n) return;
    if (s.at(m) > s.at(n)) swap(m, n);
    par.at(m) = n;
    s.at(n) += s.at(m);
  }
};

int main() {
  int n, q;
  cin >> n >> q;
  unionfind tr(n);
  for (int i = 0; i < q; i++) {
    int t, u, v;
    cin >> t >> u >> v;
    if (t == 0) {
      tr.merge(u, v);
    } else {
      cout << (tr.find(u) == tr.find(v)) << endl;
    }
  }
}


Measured memory_bytes: 4700
X = input()
lis = []
if X[0] == 'S':
    lis.append(0)
cnt = 1
for i in range(1,len(X)):
    if X[i] != X[i-1]:
        lis.append(cnt)
        cnt = 0
    cnt += 1
lis.append(cnt)
if X[-1] == 'T':
    lis.append(0)
else:
    lis += [0,0]
#print(lis)
ans = lis[0]
for i in range(1,len(lis)-2,2):
    if lis[i] < lis[i+1]:
        ans += lis[i+1]-lis[i]
        lis[i+1] -= lis[i]
    else:
        lis[i+2] += lis[i] - lis[i+1]
        lis[i+1] = 0
ans += (lis[-1] + lis[-2])
#print(lis)
print(ans)


Measured memory_bytes: 78236
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <boost/sort/spreadsort/string_sort.hpp>
  
using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
//#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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

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

    int n;
    cin >> n;

    vector<string> s(n);

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

    boost::sort::spreadsort::string_sort(all(s));
    map<string,bool> flg;

    rep(i,n){
        if(mp[s[i]] == maxv && !flg[s[i]]){
            cout << s[i] << '\n';
            flg[s[i]] = true;
        }
    }


    return 0;
}


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

int main() {
    string s, t;
    cin >> s >> t;
    if(s[0]==t[2] && s[1]==t[1] && s[2]==t[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


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

int main()
{
    string s1, s2;
    cin>>s1>>s2;
    int len1 = int(s1.length()), len2 = int(s2.length());
    vector<int> arr1(len1 + 1, 0);
    vector<int> arr2(len2 + 1, 0);
    for(int i = 1; i<=len1; i++) arr1[i] = arr1[ i - 1] + (s1[i - 1] - 'A' + 1);
    for(int i = 1; i<=len2; i++) arr2[i] = arr2[i - 1] + (s2[i - 1] - 'A' + 1);
    
    int count;
    cin>>count;
    while(count > 0)
    {
        int a, b, c, d;
        cin>>a>>b>>c>>d;
        int u = (arr1[b] - arr1[a - 1])%3, v = (arr2[d] - arr2[c - 1])%3;
        if(u == v) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
        count --;
    }
    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main(void){
  int n, i, sum=0;
  cin>>n;
  int a[n];
  for(i=0; i<n; i++)
    cin>>a[i];
  sort(a, a+n, greater<int>());
  for(i=0; i<n; i++)
    sum+=i%2?-a[i]:a[i];
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define loop(i, a, n) for(int i = (a); i < (n); i++)
#ifdef _DEBUG
#define dd(x) cout << #x << " : " << x << endl
#else
#define dd(x)
#endif
using namespace std;
using ll = int64_t;

int main(){
    int x, n; cin >> x >> n;
    set<int> p;
    rep(i, n) {
        int tmp; cin >> tmp;
        p.insert(tmp);
    }

    int diff = 105;
    int ans = 105;
    for(int i = -1; i <= 101; i++) {
        if(p.find(i) != p.end()) continue;
        if(diff > abs(x-i)) {
            ans = i;
            diff = abs(x-i);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<string.h>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

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

  while(1){
    cin>>n;
    if(n==0)break;
    int matrix[15][15]={};

    rep(i,n){
      int sum=0;
      rep(j,n){
	scanf("%d",&matrix[i][j]);
	sum+=matrix[i][j];
      }
      matrix[i][j]=sum;
    }
    rep(j,n+1){
      int sum=0;
      rep(i,n)
	sum+=matrix[i][j];
      matrix[i][j]=sum;
    }

    rep(i,n+1){
      rep(j,n+1)
	printf("%5d",matrix[i][j]);
      puts("");
    }
  }
}

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

namespace abc061_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            int c = int.Parse(input[2]);

            if (c>=a && c<=b)
            {
                Console.Write("Yes");
            }
            else
            {
                Console.Write("No");
            }
            Console.Read();
        }
    }
}


Measured memory_bytes: 11092
def main():
    n = int(input())
    l = [input().split() for _ in [0]*n]
    name = input()
    l = [[i, int(j)] for i, j in l]
    flag = 0
    ans = 0
    for i, j in l:
        if flag == 1:
            ans += j
        if i == name:
            flag = 1
    print(ans)


main()

Measured memory_bytes: 3316
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
const long long MOD = 998244353;

using namespace std;

void solve()
{
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    int sum = 0;
    int i;
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    int tmp=sum / n;

    ll ans = LINF;
    int k;
    for (k = -1; k <= 1; k++) {
        int tmp2 = tmp + k;
        ll sum = 0;
        for (i = 0; i < n; i++) {
            sum += ((ll)a[i] - tmp2)*((ll)a[i] - tmp2);
        }
        ans = MIN(ans, sum);
    }
    printf("%lld\n", ans);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        //printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main(void){
    int n,m,c,ans = 0;
    cin >> n >> m >> c;
    int b[m],a[n][m];
    for(int i = 0;i < m;i++) cin >> b[i];
    for(int i = 0;i < n;i++){
        for(int j = 0;j < m;j++) cin >> a[i][j];
    }
    for(int i = 0;i < n;i++){
        int tmp = c;
        for(int j = 0;j < m;j++){
            tmp += a[i][j]*b[j];
        }
        if(tmp > 0) ans++;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int n, k;
    cin >> n >> k;
    vector pre(n+1, 0LL);
    for (int i = 0; i < n; i++) cin >> pre[i];


    for (int i=0; i<k; i++) {
        vector c(n+1, 0LL);
        for (int j = 0; j < n; j++) {
            c[max(0LL, j-pre[j])]++;
            c[min(n-1LL, j+pre[j])+1]--;
        }
        for (int j=0; j<n; j++) c[j+1] += c[j];

        pre = c;
        if (all_of(pre.begin(), pre.end()-1, [&](const int& x){return x==n;})) {
            break;
        }
    }


    for (int j = 0; j < n; j++) {
        cout << pre[j] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 5988
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,Z,W;
  cin>>N>>Z>>W;
  ll A[N];
  REP(i,N) cin>>A[i];
  
  if(N==1){
    cout<<abs(A[0]-W)<<endl;
  }
  else{
    cout<<max(abs(A[N-1]-W),abs(A[N-1]-A[N-2]))<<endl;
  }
  return 0;
}

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

#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef tuple<int, int, int> TP;
typedef vector<int> VI;
typedef double T;
typedef vector<T> VT;
typedef vector<VT> VVT;

const LL MOD = 1e9 + 7;
const double EPS = 1e-10;
mt19937 rng(7); // random generator using 7 for seed

int dp[3011][3011] = {};
string s, t;

void print(int i, int j) {
    if(i > 0 && j > 0) {
        if(s[i-1] == t[j-1]) {
            print(i-1, j-1);
            printf("%c", s[i-1]);
        } else {
            if(dp[i-1][j] > dp[i][j-1]) {
                print(i-1, j);
            } else {
                print(i, j-1);
            }
        }
    }
}

int main() {
        int n, m;
        // cin >> n >> m;
        cin >> s >> t;
        n = s.size();
        m = t.size();
        for(int i=1;i<=n;i++) {
            for(int j=1;j<=m;j++) {
                if(s[i-1] == t[j-1]) {
                    dp[i][j] = dp[i-1][j-1] + 1;
                } else {
                    dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
                }
            }
        }
        // printf("%d\n", dp[n][m]);
        print(n, m);
}

Measured memory_bytes: 35840