akhauriyash/Code-Regression huggingface dataset:
//Utkarsh.25dec
#include <bits/stdc++.h>
#define ll long long int 
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
using namespace std;
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    ll n,d;
    cin>>n>>d;
    if(n<=(2*d+1))
    {
        cout<<1;
        return;
    }
    ll ans=0;
    for(int i=d+1;;i+=(2*d+1))
    {
        ans++;
        if((i+d)>=n)
            break;
    }
    cout<<ans;
}
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
}

Measured memory_bytes: 12032
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[]ss = S.toCharArray();
        ArrayList<Integer>ans  = new ArrayList<>();
        
        int cou = 0;
        for(int i=0; i<S.length(); i++) {
        	if(ss[i]=='A' || ss[i]=='C' || ss[i]=='G' || ss[i]=='T'){
        		cou++;
        	}else {
        		ans.add(cou);
        		cou = 0;
        	}
        }
        ans.add(cou);
        Collections.sort(ans,Collections.reverseOrder());	
            System.out.println(ans.get(0));
    }
}

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

namespace Competitive
{
    internal class Solution
    {
        public int N, Y;
        public void Run()
        {
            var line = Input.ReadIntArray();
            N = line[0];
            Y = line[1];

            int xx = -1;
            int yy = -1;
            int zz = -1;
            for(int x = 0; x <= N; x++)
            for (int y = 0; y <= N; y++)
            {
                int z = N - x - y;
                if(y < 0 || z < 0) continue;
                if(x * 10000 + y * 5000 + z * 1000 != Y) continue;

                xx = x;
                yy = y;
                zz = z;
            }

            Console.WriteLine("{0} {1} {2}", xx, yy, zz);
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

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

int main(){
  int i;
  string s, ans="";
  cin >> s;
  
  for (i=0; i<s.length(); i++) {
    if ((ans.length() > 0) && (s[i] == 'B')) ans.pop_back();
    else if (s[i] == '0') ans += "0";
    else if (s[i] == '1') ans += "1";
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())

A=[]
for i in range(N):
  a,b,c=map(int,input().split())
  A.append([a,b,c])

d=[ [1,1,1],[1,1,-1],[1,-1,1],[-1,1,1],[1,-1,-1],[-1,1,-1],[-1,-1,1],[-1,-1,-1] ]

ans=0

for a in d:
  A.sort(key=lambda x:a[0] * x[0] + a[1] * x[1] + a[2] * x[2], reverse=True)
  x=0
  y=0
  z=0
  for i in range(M):
    x+=A[i][0]
    y+=A[i][1]
    z+=A[i][2]
  ans=max(ans,abs(x)+abs(y)+abs(z))

print(ans)

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int P[1010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) cin>>P[i];
	sort(P,P+N);
	int ret=0;
	FOR(i,N) {
		if(i==N-1) ret+=P[i]/2;
		else ret+=P[i];
	}
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

#define M 1e9+7
typedef long long ll;
typedef unsigned long long ull;
#define  mem(a) memset(a,0,sizeof a)
#define pi acos(-1.0)
#define inf 0x3f3f3f3f //1.7e9
const double eps = 1e-8;
int n, v,x,y;
const int maxn = 55;const double g = 9.8;
double L[maxn],B[maxn],R[maxn],T[maxn];
double calc(double vy,double t) { return vy*t - g*t*t/2; }
int cmp(double lb,double ub,double a) { return a < lb +eps ? -1: a > ub-eps ? 1: 0;}

bool check(double qx,double qy)
{
        double a = g*g/4, b = g*qy-v*v,c = qx*qx + qy*qy;
        double D = b*b - 4*a*c;
        if(D < 0 && D > -eps )
                D = 0;
        if(D < 0)
                return false;
        for(int d = -1 ; d <= 1 ; d += 2)
        {
                double t2 = (-b + d*sqrt(D))/(2*a);
                if(t2 <= 0)
                        continue;
                double t = sqrt(t2);
                double vx = qx / t ,vy = (qy + g*t*t/2)/t;
                double yt = calc(vy,x/vx);
                if(yt < y - eps)
                        continue;
                bool ok = true;
                for(int j = 0 ; j < n ; j ++)
                {
                        if(L[j] >= x)
                                continue;
                        if(R[j] == x && y <= T[j] && B[j] <= yt)
                                ok = false;
                        int yl = cmp(B[j],T[j],calc(vy,L[j]/vx));
                        int yr = cmp(B[j],T[j],calc(vy,R[j]/vx));
                        int xh = cmp(L[j],R[j],vx*(vy/g));
                        int yh = cmp(B[j],T[j],calc(vy,vy/g));
                        if(xh == 0 && yh >= 0 && yl < 0)
                                ok = false;
                        if(yl * yr <= 0)
                                ok = false;
                }
                if(ok) return true;
        }
        return false;
}
void solve()
{
        for(int i = 0 ; i < n ; i ++)
                if(R[i] > x)
                        R[i] = double(x);
        bool ok = check(x,y);
        for(int i = 0 ; i < n ; i ++)
        {
                ok |= check(L[i],T[i]);
                ok |= check(R[i],T[i]);
        }
        if(ok)
                printf("Yes\n");
        else
                printf("No\n");
}
int main()
{
        while(~scanf("%d %d %d %d",&n,&v,&x,&y))
        {
                for(int i = 0 ; i < n ; i ++)
                        scanf("%lf %lf %lf %lf",&L[i],&B[i],&R[i],&T[i]);
                solve();
        }
        return 0;
}
/*
0 7 3 1

1 7 3 1
1 1 2 2

1 7 2 2
0 1 1 2


*/

Measured memory_bytes: 3228
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main(){
    let n:usize = read();
    let k:usize = read();
    let mut h:Vec<u64> = (0..n).map(|_| read()).collect();

    h.sort();
    let mut h_diff = std::u64::MAX;

    for i in 0..n-k+1{
        h_diff = std::cmp::min(h_diff,h[i+k-1]-h[i]);
    }

    println!("{}",h_diff);
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    bool ans = true;
    sort(a.begin(), a.end());
    for (int i = 0; i < n - 1; i++) {
        if (a.at(i) == a.at(i + 1)) {
            ans = false;
        }
    }
    if (ans) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3984
use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
                assert!(_it.next().is_none());
        }
    };
}

fn main() {
    from_line!(a: u64, b: u64);
    let mut ret = false;
    if a > 8 || b > 8 {
        ret = false;
    }
    else {
        ret = true;
    }
    if ret {
        println!("Yay!");
    }
    else {
        println!(":(");
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;
typedef pair<int, int> P;

int main()
{
	int N;
	string S[2];
	cin >> N >> S[0] >> S[1];
	string T[2];
	T[0].push_back(S[0][0]);
	T[1].push_back(S[1][0]);
	for (int j = 0; j < 2; j++) {
		for (int i = 1; i < S[0].size(); i++) {
			if (S[j][i] != S[j][i - 1]) {
				T[j].push_back(S[j][i]);
			}
		}
	}
	//cout << T[0] << endl << T[1] << endl;
	ll ans = 3;
	bool line = false;
	if (T[0][0] != T[1][0]) {
		ans *= 2;
		line = true;
	}
	for (int i = 1; i < T[0].size(); i++) {
		if (T[0][i] == T[1][i] && line) {
			line = false;
		}
		else if (T[0][i] != T[1][i] && line) {
			ans *= 3;
		}
		else {
			ans *= 2;
			if (T[0][i] != T[1][i]) {
				line = true;
			}
		}
		ans %= mod;
		//cout << ans << endl;
	}
	cout << ans % mod << endl;
}


Measured memory_bytes: 256
S = input()
a=int(S[0])*10+int(S[1])
b=int(S[2])*10+int(S[3])

if((a==0 or a>12) and (b>0 and b<=12) ):
  print("YYMM")
elif((b==0 or b>12) and (a>0 and a<=12)):
  print("MMYY")
elif((a>0 and a<=12) and (b>0 and b<=12)):
  print("AMBIGUOUS")
else:
  print("NA")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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


int main(){
    string S;
    cin >> S;
    ll x=S.size();
    REP(i,x){
        cout << 'x';
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define N 100001
int n,m,Q,a,b;
int dp[N],color[N];
vector<int> e[N];

void paint(int v,int d,int c){
	if(!color[v]) color[v]=c;
	if(dp[v]>=d || d==0)return;
	dp[v]=d;
	rep(i,e[v].size()){
		paint(e[v][i],d-1,c);
	}
}

void solve(int q){
	if(q==0)return;
	int v,d,c;
	scanf("%d %d %d",&v,&d,&c);
	solve(q-1);
	paint(v,d,c);
}

int main(void){
	cin>>n>>m;
	rep(i,m){
		scanf("%d %d",&a,&b);
		e[a].push_back(b);
		e[b].push_back(a);
	}
	cin>>Q;
	solve(Q);
	rep(i,n)cout<<color[i+1]<<endl;
	return 0;
}

Measured memory_bytes: 10360
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        
        // to: 隣接リスト
        List<Integer>[] to = new List[n];
        for (int i = 0; i < n; i++) {
            to[i] = new ArrayList<Integer>();
        }
        
        int[][] data = new int[m][2];
        boolean[][] canPass = new boolean[n][n];
        for (int i = 0; i < m; i++) {
            int s = sc.nextInt() - 1;
            int t = sc.nextInt() - 1;
            to[s].add(t);
            to[t].add(s);
            canPass[s][t] = true;
            canPass[t][s] = true;
            data[i][0] = s;
            data[i][1] = t;
        }
        
        int count = 0;
        int start = 0;
        for (int i = 0; i < m; i++) {
            // 封鎖する
            int tmps = data[i][0];
            int tmpt = data[i][1];
            canPass[tmps][tmpt] = false;
            canPass[tmpt][tmps] = false;
            
            Queue<Integer> que = new ArrayDeque<Integer>();
            que.add(start);
            
            boolean[] visited = new boolean[n];
            visited[start] = true;
            
            boolean ok = true;
            int cnt = 1;
            while (!que.isEmpty()) {
                int p = que.poll();
                
                for (Integer q : to[p]) {
                    // System.out.println(i + " " + (p+1) + " " + (q+1));
                    if (!visited[q]) {
                        if (canPass[p][q]) {
                            que.add(q);
                            visited[q] = true;
                            cnt++;
                            // System.out.println(q+1);
                        }
                    }
                }
            }
            
            if (cnt != n) {
                count++;
                // System.out.println(i);
            }
            
            canPass[tmps][tmpt] = true;
            canPass[tmpt][tmps] = true;
        }
        System.out.println(count);
    }
}

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

int main() {
  int N;
  cin >> N;
  
  bool p = false, w = false, g = false, y = false;
  for (int i = 0; i < N; i++) {
    string str;
    cin >> str;
    if (str == "P")
      p = true;
    else if (str == "W")
      w = true;
    else if (str == "G")
      g = true;
    else
      y = true;
  }
  
  if (p + w + g + y == 3)
    cout << "Three" << endl;
  else
    cout << "Four" << endl;
}


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  auto a = readln.chomp;
  auto b = readln.chomp;
  auto c = readln.chomp;

  int res;
  foreach (i; 0..n) {
    int[char] cnt;
    cnt[a[i]]++;
    cnt[b[i]]++;
    cnt[c[i]]++;
    res += cnt.keys.length.to!int - 1;
  }

  res.writeln;
}


Measured memory_bytes: 380
#include<stdio.h>
 int main(){ 
int a,b; 
while(1){
 scanf("%d%d",&a,&b); 
if(!(a|b))return 0; 
int now=0; if(a<b){ 
int c=a; a=b; b=c;
 } 
while(b!=0){ 
a=a%b; int c=a; a=b; b=c; now++; 
} 
printf("%d %d\n",a,now);
 }

 } 


Measured memory_bytes: 2672
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a.begin(), a.end());
  vector<int> p(n);
  for (int i = 0; i < n; ++i) {
    if (i % 2 == 0) {
      p[i] = 2;
    } else {
      p[i] = -2;
    }
  }
  p[0] /= 2;
  p[n - 1] /= 2;
  sort(p.begin(), p.end());
  int64 ret = 0;
  for (int i = 0; i < n; ++i) ret += (int64)a[i] * p[i];
  for (auto& it : p) it = -it;
  sort(p.begin(), p.end());
  int64 sum = 0;
  for (int i = 0; i < n; ++i) sum += (int64)a[i] * p[i];
  ret = max(ret, sum);
  printf("%lld\n", ret);
  return 0;
}


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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

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

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    cout<<fixed<<setprecision(5);
    double pi=3.14159;
    int r;
    cin>>r;
    double ans=2*pi*r;
    cout<<ans<<'\n';
    return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!


Measured memory_bytes: 3804
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::unordered_set;
using std::map;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

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> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ui n; cin >> n;

  ull res{};
  for(ui tmp = 0; tmp < n; ++tmp)
  {
    ull a; cin >> a;
    --a;
    res += a;
  }
  cout << res << CRLF;
  return;
}

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

  solve();

  return 0;
}


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

int dp[105][4][2];
bool vis[105][4][2];
string n;

int go(int i, int left, int can) {
  if(left < 0) return 0;
  if(i == (int) n.size()) return (left ? 0 : 1);
  if(vis[i][left][can]) return dp[i][left][can];

  int& ans = dp[i][left][can] = 0;
  if(can) {
    for(int d = 0; d <= 9; ++d) {
      ans += go(i + 1, left - int(d != 0), can);
    }
  } else {
    for(int d = 0; d <= (n[i] - '0'); ++d) {
      ans += go(i + 1, left - int(d != 0), (d == (n[i] - '0') ? 0 : 1));
    }
  }
  vis[i][left][can] = true;
  return ans;
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int k;
  cin >> n >> k;
  cout << go(0, k, 0) << '\n';
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;

struct node{
    int key;
    node *next, *prev;
};

node *nil;

void init(){
    //初期化
    nil = (node*)malloc(sizeof(node));
    nil -> next =nil;
    nil ->prev =nil;
}
void insert(int key){
    node *x = (node*)malloc(sizeof(node));
    x -> key = key; //番兵の直後に要素を追加
    x -> next = nil -> next;
    nil -> next ->prev = x;
    nil -> next = x;
    x ->prev = nil;
}

node* listsearch(int key){
    node * cur =nil -> next; //番兵の次からたどる
    while(cur != nil && cur -> key != key){
        cur = cur -> next;
    }
    return cur;
}

void del(node *t){
    if( t == nil) return; //tが番兵の場合は処理しない
    t -> prev -> next = t-> next;
    t -> next ->prev = t->prev;
    free(t);
}

void deletef(){
    del(nil -> next);
}

void deletel(){
    del(nil -> prev);
}
void delkey(int key){
    del(listsearch(key));
}
void printList(){
    node *cur = nil -> next;
    int isf = 0;
    while(1){
        if (cur == nil )break;
        if (isf ++ >0) printf(" ");
        printf("%d", cur  ->key);
        cur = cur-> next;
    }
    printf("\n");
}

int main(){
    int n,i;
    int size =0;
    char s[20];
    int np =0, nd=0;
    int key;
    scanf("%d",&n);
    init();
    for(int i =0; i<n;i++){
        scanf("%s%d", s ,&key);
        if (s[0] == 'i') {insert(key); np++; size++;}
        else if (s[0] == 'd'){
            if (strlen(s)>6){
                if (s[6]=='F') deletef();
                else if(s[6]=='L') deletel();
            }else{
                delkey(key); nd++;
            }
            size --;
        } 
        
    }
    printList();
    return 0;
}


Measured memory_bytes: 33956
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main()
{
    int a, b;
    scanf("%d%d", &a, &b);
    int hl=0, hr = 1;
    int i;
    int ans = 0;
    for (i=1; i<=998; i++)
    {
        hl += i;
        hr += i+1;
        if (hr - hl == b - a) ans = hl - a;
    }
    printf("%d\n", ans);
    return 0;
}


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

namespace 課題
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, B, C;
            //整数A,Bの入力
            var word = Console.ReadLine().Split(' ');
            A = int.Parse(word[0]);
            B = int.Parse(word[1]);
            C = int.Parse(word[2]);
            if (A <= C && C <= B)
            { Console.WriteLine("Yes"); }
            else
            { Console.WriteLine("No"); }
            //入力待ちに
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>

int main(void) {
  int a, b, c, d, e, k;
  if (scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&k) && e-a > k) {
    printf(":(");
  } else {
    printf("Yay!");
  }
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <numeric>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int w[n], s[n], v[n];
    for (int i = 0; i < n; i++) cin >> w[i] >> s[i] >> v[i];
    int t[n]; iota(t, t+n, 0);
    sort(t, t+n, [&](int i, int j) { return s[i] + w[i] < s[j] + w[j]; });
    long long dp[n][20001] = {};
    dp[0][w[t[0]]] = v[t[0]];
    for (int ii = 1; ii < n; ii++) {
        int i = t[ii];
        for (int j = 0; j <= 20000; j++) dp[ii][j] = dp[ii-1][j];
        for (int j = 0; j <= s[i] && j + w[i] <= 20000; j++)
            dp[ii][j+w[i]] = max(dp[ii][j+w[i]], dp[ii-1][j] + v[i]);
    }
    cout << *max_element(dp[n-1], dp[n]) << endl;
}


Measured memory_bytes: 156544
#include<iostream>
#include<string.h>
#include<math.h>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	string s;
	cin >> s;
	s[b - 1] -= 'A';
	s[b - 1] += 'a';
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n = int(input())
  lr = sorted([list(map(int, input().split())) for _ in range(n)])
  lb = sorted([list(map(int, input().split())) for _ in range(n)])
  
  cnt = 0
  for b in lb:
    cands = sorted([r for r in lr if r[0] < b[0] and r[1] < b[1]], key = lambda x:x[1])
    if len(cands) == 0:
      continue
    cnt += 1
    lr.remove(cands[-1])
  print(cnt)

if __name__=='__main__':
  main()



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

#define pi 0.017456
int main(){
    int a,b,h,m;
    cin>>a>>b>>h>>m;
    if(h>=12){
        h-=12;
    }

    float s1,s2;
    s1 = h*30 + 30*(m/60.0);
    s2 = m*6;

    long double s = fabs(s1-s2);
    /*if(s1-s2>0){
        s = s1-s2;
    }
    else {
        s = s2-s1;
    }*/
   long  double c;
    s<180?c=s:c=360-s;
    long double ans;
    
    ans = sqrt(a*a + b*b - 2*a*b*cos(3.1415926535897932384626433/180*c));
    
    cout<<setprecision(20)<<ans;
    

    return 0;




}


Measured memory_bytes: 4164
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<29)

using namespace std;

int main()
{
  int  T;
  while(cin >> T)
    {
      while(T--)
	{
	  int cards[2][9];
	  rep(i,2)rep(j,9)cin >> cards[i][j];
	  sort(cards[0],cards[0]+9);
	  double frac = 0,denom = 0;
	  do
	    {
	      int sum0 = 0, sum1 = 0;
	      rep(i,9)if(cards[0][i] > cards[1][i])sum0 += cards[0][i] + cards[1][i];
	              else                         sum1 += cards[0][i] + cards[1][i];
	      if(sum0 > sum1)frac++;
	      denom++;
	    }
	  while(next_permutation(cards[0],cards[0]+9));
	  cout << setiosflags(ios::fixed) << setprecision(5) << (frac/denom) << " " << ((denom-frac)/denom) << endl; 
	}
    }
  return 0;
}

Measured memory_bytes: 1252
A, B, K = list(map(int,input().split()))

# A から Kを引く
A = A - K
# Aが負なら，その負の大きさの分だけBから引く
if A < 0:
    B = B + A
    A = 0
# Bが負なら0にする
if B < 0: B = 0

print(A,B)

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  ll a,b;
  cin>>a>>b;

  if(a==b){
    cout<<a<<endl;
    return 0;
  }

  if(a+1==b){
    cout<<(a^b)<<endl;
    return 0;
  }

  int ak = a % 2;
  int bk = b % 2;

  if (ak == 0 && bk == 1) {
    ll cnt = ((b - a) + 1) / 2;
    if(cnt % 2 == 0) {
      cout<<0<<endl;
    }else{
      cout<<1<<endl;
    }
    return 0;
  }

  if (ak == 0 && bk == 0) {
    ll cnt = (b - a) / 2;
    if(cnt % 2 == 0) {
      cout<<b<<endl;
    } else {
      cout<<(1^b)<<endl;
    }
    return 0;
  }

  if (ak == 1 && bk == 1) {
    ll cnt = (b - a) / 2;
    if(cnt % 2 == 0) {
      cout<<a<<endl;
    }else{
      cout<<(1^a)<<endl;
    }
    return 0;
  }


  if (ak == 1 && bk == 0) {
    ll cnt = (b - a - 1) / 2;
    if(cnt % 2 == 0) {
      cout<<(b^a)<<endl;
    }else{
      cout<<(b^a^1)<<endl;
    }
    return 0;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; ++i)
const ll mod = 1e9+7;
using namespace std;

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

  int n, m; cin >> n >> m;
  vector<bool> broken(n+1, true);
  rep(i, m) {
    int a; cin >> a;
    broken[a] = false;
  }
  vector<int> dp(n+1);
  dp[0] = 1;
  if(broken[1]) dp[1] = 1;
  for(int i = 2; i <= n; ++i) {
    if(broken[i-2]) dp[i] += dp[i-2];
    if(broken[i-1]) dp[i] += dp[i-1];
    dp[i] %= mod;
  }
  cout << dp[n] << '\n';
  return 0;
}


Measured memory_bytes: 640
let () =
    let main () =
        let h = int_of_string (read_line ()) in
        let w = int_of_string (read_line ()) in
        let n = int_of_string (read_line ()) in
        let v = max h w in
        let r = (n + (v - 1)) / v in
        Printf.printf "%d\n" r

    in
    main ()

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

vector <int> A, dp, au;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	A.resize(n);
	dp.resize(n);
	au.resize(n);
	int ans = 1;
	for (int i = 0; i < n; i++){
		cin >> A[i];
	}
	dp[0] = A[0];
	au[n - 1] = A[n - 1];
	for (int i = 1; i < n; i++){
		dp[i] = __gcd(dp[i - 1], A[i]);
	}
	for (int i = n - 2; i >= 0; i--){
		au[i] = __gcd(au[i + 1], A[i]);
	}
	ans = max(ans, au[1]);
	ans = max(ans, dp[n - 2]);
	for (int i = 1; i <= n - 2; i++){
		ans = max(ans, __gcd(dp[i - 1], au[i + 1]));
	}
	cout << ans;
}

Measured memory_bytes: 1408
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>

int c[1000000];

int main()
{
    int n;
    while(cin>>n)
    {
        memset(c,0,sizeof(c));
        int a,b;
        int sum=0;
        for(int i=0;i<n;i++)
        {
            cin>>a>>b;
            for(int i=a;i<=b;i++)
            {
                if(!c[i])
                    sum++;
                c[i]=1;
            }
        }
        cout<<sum<<endl;
    }
    return 0;
}


Measured memory_bytes: 4096
a,b = gets.split.map(&:to_i)
s = gets.chomp.split('')
count = 0
check = 0
s.each do |i|
  if i == '-'
    if a == count
      count = 0
    else
      check += 1
    end
  end
  if i =~ /[0-9]/
    count += 1
  end
end
if check >= 1 || count != b
  puts :No
else
  puts :Yes
end

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

int main(void){
	int N,K,a[5000],need=0;
	cin>>N>>K;
	rep(i,N)cin>>a[i];
	sort(a,a+N,greater<int>());
	rep(i,N){
		int sum=0;
		rep(j,N)if(i<=j)if((sum+=a[j])>=K){
			need = max(need,j+1);
			sum -= a[j];
		}
	}
	cout<<N-need<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
int a[100100],b[100100];
signed main() {
  int N, M; cin >> N >> M;
  int asum = 0, bsum = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    asum += a[i];
  }
  for (int i = 0; i < M; i++) {
    cin >> b[i];
    bsum += b[i];
  }
  
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += a[i]*bsum;
  }
  
  cout << ans << endl;
}



Measured memory_bytes: 4656
#include<bits/stdc++.h>
#define mod 1000000009
#define ll long long
using namespace std;
int main()
{
    char s[15],t[15];
    scanf("%s",&s);
    scanf("%s",&t);
    int flag=0;
    for(int i=0; i<strlen(s); i++)
    {
        if(t[i]!=s[i])
        {
            flag=1;
            break;
        }
    }
    if(flag==0)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 3764
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = 2147483647;
const ll LLINF = 1LL<<60;

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

int x;
cin >> x;
int temp=0;
int i;
for(i=1;temp<x;i++){
    temp += i;
}
fin(i-1);

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <iostream>

bool dist[8][8];

int dfsPath(int visited[], int n, int cur) {
  bool isAllVisited = true;
  for (int i = 0; i < n; i++) {
    if (visited[i] != 1) {
      isAllVisited = false;
    }
  }
  if (isAllVisited) {
    return 1;
  }
  int ret = 0;
  for (int i = 0; i < n; i++) {
    if (i == cur) continue;
    if (dist[cur][i] == true && visited[i] == 0) {
      visited[i] = 1;
      ret += dfsPath(visited, n, i);
      visited[i] = 0;
    }
  }
  return ret;
}

int main() {
  int n, m;
  std::cin >> n >> m;
  int visited[8];
  for (int i = 0; i < m; i++) {
    int a, b;
    std::cin >> a >> b;
    dist[a - 1][b - 1] = dist[b - 1][a - 1] = 1;
  }
  for (int i = 0; i < n; i++) {
    dist[i][i] = 0;
    visited[i] = 0;
  }
  visited[0] = 1;
  std::cout << dfsPath(visited, n, 0) << "\n";
  return 0;
}

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

int aux_x[4] = {0,0,1,-1};
int aux_y[4] = {1,-1,0,0};
typedef pair<int,int> ii;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int r,c,w;
    int d[55][55];
    string M[55];
    queue<ii> q;
    while(cin >> r >> c)
    {
        w = 0;
        for(int i = 0; i < r; i++)
        {
            cin >> M[i];
            for(int j = 0; j < c; j++)
                if(M[i][j] == '#')
                    w++;
        }
        while(!q.empty()) q.pop();
        memset(d, -1, sizeof d);
        d[0][0] = 1;
        q.push({0,0});
        while(!q.empty())
        {
            int x = q.front().first, y = q.front().second;
            q.pop();
            for(int k = 0; k < 4; k++)
            {
                int nx = x + aux_x[k];
                int ny = y + aux_y[k];
                if(nx > -1 && ny > -1 && nx < r && ny < c && M[nx][ny] == '.' && d[nx][ny] == -1)
                {
                    d[nx][ny] = d[x][y] + 1;
                    q.push({nx,ny});
                }
            }
        }
        cout << (d[r-1][c-1] == -1? -1 : r*c - w - d[r-1][c-1]) << '\n';
    }
    return 0;
} 

Measured memory_bytes: 256
#include <iostream>

using namespace std;


void weather_predicition()
{
  string s;
  cin >> s;

  if (s == "Sunny") cout << "Cloudy\n";
  else if (s == "Cloudy") cout << "Rainy\n";
  else if (s == "Rainy") cout << "Sunny\n";
}


int main()
{
  weather_predicition();
}

Measured memory_bytes: 256
import java.util.Scanner;

// https://atcoder.jp/contests/abc087/tasks/abc087_b
public class Main {

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

        int A, B, C;

        A = scanner.nextInt();
        B = scanner.nextInt();
        C = scanner.nextInt();

        int X = scanner.nextInt();

        //helper(0, A, B, C, X);

        int result = 0;

        for (int i = 0; i <= A; i++) {
            for (int j = 0; j <= B; j++) {
                for (int k = 0; k <= C; k++) {
                    if (500 * i + 100 * j + 50 * k == X) {
                        result++;
                    }
                }
            }
        }

        System.out.println(result);
    }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
random_device rnd;
mt19937 mt(rnd());

const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;
string ans = "";

void dfs(string s)
{
    if (s == "ABC")
    {
        cout << "Yes" << endl;
        exit(0);
    }
    string t = "";
    char c = '@';
    rep(i, s.size())
    {
        if (i + 2 < s.size() && s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
        {
            if (i == 0)
            {
                c = 'A';
            }
            else if (i + 2 == s.size() - 1)
            {
                c = 'C';
            }
            else if (s[i - 1] == 'A')
            {
                c = 'B';
            }
            else if (s[i - 1] == 'B')
            {
                c = 'C';
            }
            else if (s[i - 1] == 'C')
            {
                c = 'A';
            }
            break;
        }
    }
    if (c == '@')
    {
        cout << "No" << endl;
        exit(0);
    }
    ans += c;
    rep(i, s.size())
    {
        if (i + 2 < s.size() && s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
        {
            t += c;
            i += 2;
        }
        else
        {
            if (s[i] == c)
            {
                cout << "No" << endl;
                exit(0);
            }
            t += s[i];
        }
    }
    dfs(t);
}

int main()
{
    string s;
    cin >> s;
    if (s.size() < 3)
    {
        cout << "No" << endl;
        return 0;
    }
    dfs(s);
    return 0;
}


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

string s,b[10] = {" ", "',.!?", "abcABC", "defDEF", "ghiGHI",
                "jklJKL", "mnoMNO", "pqrsPQRS", "tuvTUV",
                "wxyzWXYZ" };

string conv(int p,int t) {
    if(p == s.length()) return "";
    int c = 0;
    while(p < s.length() && s[p] == t + '0') c++,p++;

    return string((t==0)?(c-1):1,b[t][(c-1)%(b[t].length())]) + conv(p,s[p]-'0');
}

int main() {
    while(cin>>s) cout<<conv(0,s[0]-'0')<<endl;
}

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

int main() {
  string S;
  cin >> S;
  int ans = 1000;
  for (int i = 0; i < S.size() - 2; i++) {
    int comp;
    comp = 100*(S.at(i) - '0') + 10*(S.at(i+1) - '0') + (S.at(i+2) - '0');
    ans = min(ans,abs(comp-753));
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
n=int(input())
m=input().split()

int_m=[]
tmp =0

for x in m:
  int_m.append(int(x))
  
int_m.sort()
for y in range (0,len(int_m)):
  tmp+=int_m[y]
  if y !=0:
    tmp /= 2
print(tmp)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
using namespace std;
vector<int>v[200001];
int arr[200001];
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
		if(a==n)
		{
			arr[b]=1;
		}
		else if(b==n)
		{
			arr[a]=1;
		}
	}
	for(int i=0;i<v[1].size();i++)
	{
		if(arr[v[1][i]]==1)
		{
			cout<<"POSSIBLE";
			return 0;
		}
	}
				cout<<"IMPOSSIBLE";

	return 0;
}

Measured memory_bytes: 12784
#include<bits/stdc++.h>
#define int long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;

signed main(){
	ios_base::sync_with_stdio(0);
	string n;
	cin>>n;
	if((n[0]==n[1]&&n[1]==n[2])||(n[1]==n[2]&&n[2]==n[3])) cout<<"Yes";
	else cout<<"No";
	re 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#define int long long
using namespace std;
signed main() {
    int N;
    cin>>N;
    int a,b;
    bool ans=false;
    vector<int>A(N);
    for(int i=0;i<N;i++){
        A[i]==1;
    }

    for(int i=0;i<N;i++){
        cin>>a>>b;

        if(a==b){
            A[i]=2;
        }
    }
    for(int i=0;i<N;i++){
        if(A[i]==2&&A[i+1]==2&&A[i+2]==2){
            ans=true;
            break;
        }
    }
    if(ans==true){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3632
def answer():
    import sys
    input = sys.stdin.readline
    wield = 0
    l = []
    N, H = map(int, input().split())
    for i in range(N):
        a, b = map(int, input().split())
        l.append(b)
        wield = max(a, wield)
    l.sort(reverse=True)
    ret = 0
    for a in l:
        if H <= 0:
            break
        if a > wield:
            ret += 1
            H -= a
        else:
            break
    if H > 0:
        ret += (H + wield - 1) // wield
    print(ret)
  
answer()

Measured memory_bytes: 7384
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;
// spring s; cin >> s;
// cout << res << endl;
// --------write my code!!!!!----------//

// I'm trying to ~~~
int main(){
    int A; cin >> A;
    cout << A/3 << endl;
}


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

#define mp make_pair

using namespace std;

typedef int32_t i32;
typedef uint32_t u32;
typedef int64_t i64;
typedef uint64_t u64;
typedef pair<int,int> pii;
typedef pair<i64,int> pli;
typedef pair<int,i64> pil;
typedef pair<i64,i64> pll;
typedef vector<int> vi;
typedef vector<i64> vl;

template <typename T>
T id(T b) {return b;};
template <class It>
bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It>
bool any(It f,It l){return std::any_of(f,l,id<bool>);}

typedef tuple<int,int,int> triple;
const int MAX_H = 50, MAX_W = 50;
int h,w;
char grid[MAX_H][MAX_W];
bool vis[MAX_H][MAX_W] = {};
int dx[4] = {0,1,0,-1};
int dy[4] = {-1,0,1,0};

bool is_confined(int x, int y) {
  return 0 <= x && x < h && 0 <= y && 0 <= w;
}

int bfs()
{
  queue<triple> q({make_tuple(0,0,1)});
  vis[0][0] = true;
  while (!q.empty()) {
    int x,y,d;
    tie(x,y,d) = q.front(); q.pop();
    for (int i = 0; i < 4; i++) {
      int new_x = x+dx[i], new_y = y+dy[i];
      if (new_x + 1 == h && new_y + 1 == w) return d+1;
      if (is_confined(new_x,new_y) && !vis[new_x][new_y] && grid[new_x][new_y] == '.') {
        vis[new_x][new_y] = true;
        q.push(make_tuple(new_x,new_y,d+1));
      }
    }
  }
  return -1;
}

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

  int res = bfs();

  if (res < 0)
    cout << -1 << endl;
  else
    cout << wc - res << endl;

  return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((abs(a - b) <= d && abs(b - c) <= d) || abs(a - c) <= d)
        OP("Yes");
    else
        OP("No");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using namespace std;

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

    vector<string> A(n);
    vector<string> B(m);
    rep(i, n) cin >> A.at(i);
    rep(i, m) cin >> B.at(i);

    for (int i = 0; i < n - m + 1; i++) {
        for (int j = 0; j < n - m + 1; j++) {
            bool is_in = true;
            for (int k = 0; k < m; k++) {
                for (int l = 0; l < m; l++) {
                    if (A[i + k][j + l] != B[k][l]) {
                        is_in = false;
                    }
                }
            }

            if (is_in) {
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
}

Measured memory_bytes: 3528