akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int read() { return readln.chomp.to!int; }
int[] reads() { return readln.split.to!(int[]); }


void main() {
    int n, m, Q; readf("%d %d %d\n",&n,&m,&Q);

    int[][] a = new int[][](n+1, n+1);
    foreach (i; 0..m) {
        int l, r; readf("%d %d\n", &l, &r);
        a[l][r]++;
    }

    foreach (i; 1..n+1) foreach (j; 1..n+1) {
        a[i][j] += a[i-1][j];
        a[i][j] += a[i][j-1];
        a[i][j] -= a[i-1][j-1];
    }

    debug {
        writeln(a);
    }

    foreach (i; 0..Q) {
        int l, r; readf("%d %d\n",&l,&r);
        int ans = a[r][r]
            - a[r][l-1]
            - a[l-1][r]
            + a[l-1][l-1];
        writeln(ans);
    }
}

Measured memory_bytes: 1916
/*package whatever //do not write package name here */

import java.io.*;
import java.util.Scanner;


public class Main {
	public static void main (String[] args) {
// 		System.out.println("GfG!"); 
Scanner sc = new Scanner(System.in);
String s= sc.next();
int a=0;
int b= 0;
for(int i=0;i<3;i++){
    char ch = s.charAt(i);
    if(ch=='A')
    a++;
    else
    b++;
    
}
if(a!=0 && b!=0)
System.out.println("Yes");
else
System.out.println("No");

	}
}

Measured memory_bytes: 23636
//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
//#pragma GCC optimize(4)
//#pragma GCC optimize("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define fi first
#define se second
#define db double
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define vi vector<int>
#define mod 998244353
#define ld long double
//#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define ull unsigned long long
//#define base 1000000000000000000
#define fin freopen("a.txt","r",stdin)
#define fout freopen("a.txt","w",stdout)
#define fio ios::sync_with_stdio(false);cin.tie(0)
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void sub(ll &a,ll b){a-=b;if(a<0)a+=mod;}
inline void add(ll &a,ll b){a+=b;if(a>=mod)a-=mod;}
template<typename T>inline T const& MAX(T const &a,T const &b){return a>b?a:b;}
template<typename T>inline T const& MIN(T const &a,T const &b){return a<b?a:b;}
inline ll qp(ll a,ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod,b>>=1;}return ans;}
inline ll qp(ll a,ll b,ll c){ll ans=1;while(b){if(b&1)ans=ans*a%c;a=a*a%c,b>>=1;}return ans;}

using namespace std;

const ull ba=233;
const db eps=1e-8;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int N=200000+10,maxn=200000+10,inf=0x3f3f3f3f;

char s[N];
int main()
{
    scanf("%s",s);
    int n=strlen(s);
    ll sum=0,ans=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='B')sum++;
        else ans+=sum;
    }
    printf("%lld\n",ans);
    return 0;
}
/********************

********************/


Measured memory_bytes: 384
<?php
$dsCount = trim(fgets(STDIN));
$stdin = array();

$i = 0;
$outCount = 0;
$hitCount = 0;
$roopNo = 0;
$score = 0;
$scores = array($dsCount);

while (true) {
  // ?¨??????\???????????????
  $stdin[$i] = trim(fgets(STDIN));

  // HIT?????´???
  if ($stdin[$i] == "HIT") {
    // ????????????????????¨?????????????????????
    $hitCount++;

    // ????????????????????¨???4????¶?????????????????????¢???1?¶??????????????????????????????????3????????????
    if ($hitCount >= 4) {
      $hitCount = 3;
      $score += 1;
    }

  // OUT?????´???
  } elseif ($stdin[$i] == "OUT") {
    // ??¢?????????????????¨?????????????????????
    $outCount++;

  // HOMERUN?????´???
  } elseif ($stdin[$i] == "HOMERUN") {
  	$score += ($hitCount + 1);
  	$hitCount = 0;
  }

  // 3??¢??????
  if ($outCount >= 3) {

  	// ????????????????????°????¶??????????
    if ($roopNo >= ($dsCount - 1)) {
      // ????????¢????¨????
      $scores[$roopNo] = $score;

      // ???????????????
      break;

    // ?????????????????????????????????????????´???
    } else {
      // ????????¢????¨????
      $scores[$roopNo] = $score;

      // ????????¢?????????????????????????????¢??????????????????????????????????????????????¶??¶?
      $score = 0;
      $hitCount = 0;
      $outCount = 0;
    }

    // roopNo?????????????????????
    $roopNo++;
  }
}

// ????????????
foreach ($scores as $key => $value) {
  print $value . PHP_EOL;
}

Measured memory_bytes: 15104
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1e9 + 7;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C;
    cin >> A >> B >> C;
    int a = A;
    rep(i, 0, 1e5) {
        a += A;
        if (a % B == C) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+7;
vector<int> adj[maxn];
int dp[maxn];

int dfs(int a) {
	if(dp[a] != -1) return dp[a];	
	int mx = 0;
	for(int b : adj[a]) {
		mx = max(mx, dfs(b) + 1);
	}
	return dp[a] = mx;
}

int main() {

	int n, m;
	cin >> n >> m;

	for(int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		adj[a].push_back(b);
	}

	for(int i = 0; i < n; i++) {
		dp[i] = -1;
	}

	for(int i = 0; i < n; i++) {
		if(dp[i] == -1) {
			dfs(i);
		}
	}

	int ans = 0;
	for(int i = 0; i < n; i++) {
		ans = max(ans, dp[i]);
	}

	cout << ans << endl;

	return 0;
}


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


using namespace std;
const long long INF = 1LL <<60;

int main(void){
  string s,t;
  long long s_len,tmp;
  long long i,j,k;
  
  cin>>s;
  cin>>t;
  
  s_len=size(s);
  tmp=s_len;
    
  for(i=0;i<s_len;i++){
    if(s[i]==t[i]){
      tmp--;
    }
  }
  
  cout<<tmp<<endl;
  
}    

Measured memory_bytes: 3848
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  int N = 0;
  cin >> N;
  vector<int>A(N);
  rep(i,N){
    cin >> A[i];
  }
  vector<int>B(N);
  rep(i,N){
    cin >> B[i];
  }
  int ans = 0,Ans = 0;
  rep(i,N){
    ans = 0;
    for(int j = 0;j <= i; j++){
      ans += A[j];
    }
    for(int k = i;k < N; k++){
      ans += B[k];
    }
    Ans = max(ans,Ans);
  }
  cout << Ans;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b int
	var S string
	fmt.Scan(&a, &b, &S)

	flg := false
	for i, Si := range S {
		if i == a {
			if Si != '-' {
				flg = true
			}
		} else {
			if Si == '-' {
				flg = true
			}
		}
	}
	if flg {
		fmt.Print("No")
	} else {
		fmt.Print("Yes")
	}

}


Measured memory_bytes: 512
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

TPL<class T> inline void OUT(const T &x) { cout << x << "\n"; }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }

int main(void) {
	ll N;
	cin >> N;
	vec<ll> A(N);
	REP(i, N)cin >> A[i];
	ll ans = 0;
	REP(i, N) {
		ans += A[i] - 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        X: u64,
    }
    println!("{}", if X<1200{"ABC"}else{"ARC"});
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
char a,b;
cin >> a >> b;
if (a == 'H' && b == 'H') cout << 'H' << endl;
else if (a == 'H' && b == 'D') cout << 'D' << endl;
else if (a == 'D' && b == 'H') cout << 'D' << endl;
else if (a == 'D' && b == 'D') cout << 'H' << endl;




return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  if(a > b){
    cout << "a > b" << endl;
  }else if(a < b){
    cout << "a < b" << endl;
  }else{
    cout << "a == b" << endl;
  }
}



Measured memory_bytes: 3128
import java.util.Scanner;

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

       double x1 =scan.nextDouble();
       double y1 =scan.nextDouble();
       double x2 =scan.nextDouble();
       double y2 =scan.nextDouble();

       System.out.println(Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)));

       }
   }


Measured memory_bytes: 28000
def f(L,res):
    for i in range(1,N+1):
        #print(i,L[i])
        if len(L[i]) == 1:
            L[L[i][0]].remove(i)
            L[i] = []
            res = f(L,res+1)
    return res


N,M = map(int,input().split())
L = [[] for _ in range(N+1)]

for i in range(M):
    a,b = map(int,input().split())
    L[a].append(b)
    L[b].append(a)
print(f(L,0))

Measured memory_bytes: 3064
#include <iostream>
#include <numeric>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




int main() {

	int A,B;
	cin >> A>>B;
	string s = "Impossible";
	if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) {
		s = "Possible";
	}


	cout << s<< endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)
typedef long long ll;

// 配列初期化テンプレ
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}


int main() {

	int N;
	cin >> N;

	int N_order1 = N % 10;
	if (N_order1 == 3) {
		cout << "bon" << endl;
	}
	else if (N_order1 == 0|| N_order1 == 1|| N_order1 == 6|| N_order1 == 8) {
		cout << "pon" << endl;
	}
	else {
		cout << "hon" << endl;
	}

	return 0;

}


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

int main(void){
    string s;
    cin >> s;
    
    int num1, num2 = 0, ans = 753;
    for(int i = 0; i < s.length() - 2; i++){
        num1 = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
        if(abs(num1 - 753) < abs(num2 - 753)){
            ans = abs(num1 - 753);
            num2 = num1;
        }
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		//????????£????????????????????°?????????????????£?¨?
		Scanner sc = new Scanner(System.in);

		//a??????
		int intA = sc.nextInt();
		//b??????
		int intB = sc.nextInt();

		//a?????????
		//????????????
		double dbF; //?????°?????£?¨?
		//f???????????????????????°???????????§???????¨????
		dbF = (double) intA /  (double) intB;
		 //?¨??????????db????????°??????string???????????????
		 String f2 = String.format("%.5f", dbF);
		//?¨??????????????????????a/b = d
		System.out.println(intA / intB + " " + intA % intB + " " + f2);
	}
}

Measured memory_bytes: 26228
function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});
	let D = parseInt(input[0][0], 10);
	let T = parseInt(input[0][1], 10);
	let S = parseInt(input[0][2], 10);
	if (D / S <= T) console.log('Yes');
	else console.log('No');


}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29648
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = a; i < n; i++)
#define Repr(i, n, a) for (int i = n; i >= a; i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

int Abs(int a) { return (a > 0 ? a : -a); }

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

    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    vector<int> dp(n);
    rep(i, n) dp[i] = INF;
    dp[0] = 0;
    Rep(i, 1, n)
    {
        rep(j, k)
        {
            if (i - j <= 0)
                break;
            dp[i] = min(dp[i], dp[i - j - 1] + Abs(h[i] - h[i - j - 1]));
        }
    }
    cout << dp[n - 1] << endl;
}

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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  ll n;
  string stone;
  cin >> n >> stone;
  ll r_count = count(stone.cbegin(), stone.cend(), 'R');

  ll count = 0;
  REP(i, r_count) {
    if(stone[i] == 'R') {
      count++;
    }
  }
  COUT(r_count - count);
  
}

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

/*
4 5
0 5
-2 4
3 4
4 -4
*/


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	string s;
	cin >> s;
	cout << (s == "ABC" ? "ARC" : "ABC") << endl;
    
    return 0;
}


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

#define ull unsigned long long
#define ll long long


int main(){
    int n;
    cin >> n;
    vector<pair<int, int> > ans;
    int x;
    for(int i=1; i<=n; ++i){
        cin >> x;
        ans.push_back({x, i});
    }

    sort(ans.begin(), ans.end());

    for(auto z:ans)
        cout << z.second << " ";
}

Measured memory_bytes: 4196
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define fir first
#define sec second
#define mod 998244353
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
int add(int x,int y){return x+y>mod?x+y-mod:x+y;}
int sub(int x,int y){return x-y<0?x-y+mod:x-y;}
#define N 100005
struct Node
{
	int x,l;
};
Node a[N];
bool cmp(Node x,Node y)
{
	if(x.x-x.l!=y.x-y.l) return x.x-x.l<y.x-y.l;
	return x.x<y.x;
}
map<int,int> f;
signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int n=read();
	for(int i=1;i<=n;i++) a[i].x=read(),a[i].l=read();
	sort(a+1,a+n+1,cmp);
	f[a[1].x-a[1].l-1]=0;
	for(int i=1;i<=n;i++)
	{
		auto r=--f.upper_bound(a[i].x-a[i].l);
//		printf("%d %d\n",r->fir,r->sec);
		int pl=a[i].x+a[i].l,dat=r->sec+1;
		if(--f.upper_bound(pl)->sec>=dat) continue;
		r=f.upper_bound(pl);
		while(r!=f.end()&&r->sec<dat)
		{
			auto p=r;
			r++;
			f.erase(p);
		}
		f[pl]=dat;
	}
	auto ans=--f.end();
	cout<<ans->sec<<endl;
#ifdef __LOCAL__
	cout<<"Time Used : "<<clock()<<endl;
#endif
	return 0;
}



Measured memory_bytes: 5760
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;

const ll linf = 1LL << 62;
const int inf = 99999999;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };
const ll atcoder = 1e9 + 7;

#define Endl endl
#define mp make_pair
#define all(v) v.begin(),v.end()
#define pb push_back
#define pr(x) cout << x << endl
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define rep(i,n) for(int i= 0;i<n;i++)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

ll gcd(ll a, ll b) {//最大公約数
	if (a < b)swap(a, b);
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	if (a < b)swap(a, b);
	return (a / gcd(a, b))*b;
}

int main() {

	int n;
	cin >> n;
	bool flag = false;

	rep(i, n) {
		char c;
		cin >> c;
		if (c == 'Y')flag = true;
	}

	if (flag)pr("Four");
	else pr("Three");

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>

using namespace std;
typedef long long ll;
inline int getint(){
  char c; int res = 0;
  for(c = getchar();c < '0' || c > '9';c = getchar());
  for(;c >= '0' && c <= '9';c = getchar()) res = res * 10 + (c - '0');
  return res;
}
int n,a;
int gcd(int x,int y){
	if(y == 0) return x;
	return gcd(y,x % y);
}
int main(){
	scanf("%d",&n);
	int ans = 0;
	for(int i = 1;i <= n;i++){
		scanf("%d",&a);
		ans = gcd(ans,a);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
#define rrep(i,n)for(int i=n-1;i>=0;i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
const ll mod = pow(10, 9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;
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; }
ll dp[110][110000];
int main() {
    int N, W; cin >> N >> W;
    int w[110], v[110];
    for (int i = 1; i <= N; i++) {
       cin >> w[i] >> v[i];
   }
    rep(i, N+1) {
        rep(j, W+1) {
            dp[i][j] = 0;
        }
    }
    for(int i=1;i<=N;i++){
        for (int sum_w = 0; sum_w <=W; sum_w++) {
            if (sum_w - w[i]>=0) {
                chmax(dp[i][sum_w], dp[i-1][sum_w-w[i]] + v[i]);
            }
            chmax(dp[i][sum_w], dp[i - 1][sum_w]);
           
        }
        
       
    }

    cout << dp[N][W] << endl;

    
}





























































































































































































































































































































Measured memory_bytes: 88192
def even(x):
    flag1 = False
    if x % 2 == 0:
        flag1 = True
    return flag1


def multiple_of_4(x):
    flag2 = False
    if x % 2 == 0:
        x //= 2
        if x % 2 == 0:
            flag2 = True
    return flag2


def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    flag = False

    multiple_of_4_count = 0
    for i in range(n):
        if multiple_of_4(a_lst[i]):
            multiple_of_4_count += 1

    if multiple_of_4_count >= n // 2:
        flag = True
    else:
        even_count = 0
        for i in range(n):
            if even(a_lst[i]):
                even_count += 1
        tmp = n - 2 * multiple_of_4_count
        even_count -= multiple_of_4_count

        if even_count >= tmp:
            flag = True

    if flag:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Measured memory_bytes: 20148
#include "bits/stdc++.h"

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(ll)(n);i>0;i--)
#define REP(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
#define mp make_pair

int main() {
  ll n, k;
  cin >> n >> k;
  if (k % 2 == 1) {
    cout << (n / k) * (n / k) * (n / k) << endl;
  }
  else {
    ll ans = (n / k) * (n / k) * (n / k);
    ll num = (n / (k / 2)) - (n / k);
    ans += num*num*num;
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;

public class Main {

  private void solve(InputReader in, PrintWriter out) {
    int d = in.nextInt();
    int n = in.nextInt();
    int c = (int) Math.pow(100, d);
    int[] arr = new int[101];
    for (int i = 1; i < 101; i++) {
      arr[i] = c * i;
    }
    out.println(n != 100 ? arr[n] : arr[n] + c);
  }


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

  private void run() {
    try (
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out)) {
      solve(in, out);
    }
  }


  static class InputReader implements AutoCloseable {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    @Override
    public void close() {

    }
  }

}


Measured memory_bytes: 23124
#https://atcoder.jp/contests/abc136/tasks/abc136_d

s = list(str(input()))
n = len(s)
t = []
u = []
v = [0] * n
for i in range(n):
    if i == 0:
        for j in range(i, n):
            if s[j] == 'L':
                t.append(j - 1)
                u.append(j - i - 1)
                break

    else:
        if s[i] == s[i-1]:
            t.append(t[i-1])
            u.append(u[i-1] + 1)
        elif s[i] == 'R':
            for j in range(i, n):
                if s[j] == 'L':
                    t.append(j - 1)
                    u.append(j - i - 1)
                    break
        else:
            
            for j in reversed(range(i)):
                if s[j] == 'R':
                    t.append(j)
                    u.append(i - j)
                    break
            '''
            t.append(i-1)
            u.append(0)
            '''
    a = u[i] % 2
    v[t[i] + a] += 1


print(' '.join(map(str, v)))


Measured memory_bytes: 15992
s = input()

eList = []
oList = []
for i in range(len(s)):
  if (i+1) % 2 == 0:
    eList.append(s[i])
  else:
    oList.append(s[i])

if eList.count('R') > 0 or oList.count('L') > 0:
  print("No")
else:
  print("Yes")


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>

using namespace std;

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


int main(){
    int k;
    string s;
    cin >> k >> s;
    if(s.size() > k){
        rep(i, k){
            cout << s[i];
        }
        cout << "..." << endl;
    }else{
        cout << s << endl;
    }
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(),v.end()

// 階乗
ll facctorialMethod(ll k)
{
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum %= 1000000007;
    }
    return sum;
}

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    cout << facctorialMethod(n) << endl;
}

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

int main() {
  int N,j=0,cnt=0,k=0;
  cin >> N;
  vector<int> btn(N);
  for (int i = 0; i < N; i++) {
    cin >> btn.at(i);
  }
  while (true){
    if(btn.at(j) == 2){
      cnt++;
      break;
    }
    else if(btn.at(j) == 0){
      cnt=-1;
      break;
    }
    else{
      cnt++;
      k=j;
      j=btn.at(j)-1;
      btn.at(k)=0;
    }
  }
  cout << cnt;
}

Measured memory_bytes: 768
#include <iostream>

using namespace std;

int main () {
   int N;
   cin>>N;
   int x=0,y=0;
   for(int i=0;i<N;i++){
       int L;
       cin>>L;
       x=max(x,L);
       y+=L;
   }
   if (x<(y-x)){
       cout<<"Yes";}
   else{
       cout<<"No";}
   return 0;}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

int mylg(ll x){
  int r = 0;
  while(x){
    x>>=1;
    r++;
  }
  return r-1;
}

ll solve(ll a,ll b){
  if(a==b)return 1ll;
  // log b
  int lgb = mylg(b);
  ll b2 = 1ll<<lgb;
  if((a&b2)==0){
    ll ret = b2-a;        // a <= x < b2
    b = b2 + solve(b2,b) - 1;
    if(a+b2 <= b){
      ret += b2;
    }else{
      ret += (b2-a) + (b-b2+1);
    }
    return ret;
  }else{
    return solve(a^b2, b^b2);
  }
}

int main(){
  ll a,b;
  cin>>a>>b;
  cout<<solve(a,b)<<endl;
  return 0;
}


Measured memory_bytes: 256
def solve():
    mod = 10**9+7
    N = int(input())
    s1 = input()
    s2 = input()
    lis = []
    i=0
    while i<N-1:
        if s1[i]==s1[i+1]:
            lis.append(2)
            i += 2
        else:
            lis.append(1)
            i += 1
    if i==N-1:
        lis.append(1)
    if N==1:
        lis = [1]
    if lis[0]==1:
        ans = 3
    else:
        ans = 6
    for i in range(len(lis)-1):
        if lis[i]==1:
            ans *= 2
            ans %= mod
        if lis[i]==2 and lis[i+1]==2:
            ans *=3
            ans %= mod
    return ans
print(solve())

Measured memory_bytes: 3064
import java.util.*;

class UnionFind{
	//親の番号を格納する配列
	//自分が根のときは、-(自身の木のサイズ)を格納して置くと、結合時に小さい方を大きい方に繋ぐことができる。
	private int[] parent;
	
	//constructor
	//親の初期値を存在しない-1とすることで全てバラバラになる。
	UnionFind(int N){
		parent = new int[N];
		Arrays.fill(parent, -1);
	}
	
	//xの属する木の根を返す
	int root(int x) {
		if(parent[x]<0)return x;
		return parent[x]=root(parent[x]);//"point"：parent[x]を根に更新した上で、返す
	}
	
	//属する木の頂点数を調べる。parent[]における根の要素が-(超点数)になっている。
	int size(int x) {
		return - parent[root(x)];//−をかけるのを忘れない
	}
	
	//２数x,yの根を結合する
	boolean unite(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		if(rx == ry) return false;
		//属する木が大きい方をxにする。
		if(size(rx)<size(ry)) {
			int tmp = rx;
			rx = ry;
			ry = tmp;
		}
		//yの根をxの根にする
		parent[rx] += parent[ry]; 
		parent[ry] = rx;
		return true;
	}
	
	//２数x,yが同一木に属するならtrue
	boolean same(int x, int y) {
		return root(x)==root(y);
	}
	
}

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int v[][] = new int[M][2];
		for(int i=0;i<M;i++) {
			int A = sc.nextInt();
			int B = sc.nextInt();
			A--;
			B--;
			v[i][0]=A;
			v[i][1]=B;
		}
		sc.close();
		
		//不便さを格納する配列
		long inc[] = new long[M+1];//工夫して１つ大きく出している。
		
		//iを後ろから処理して、橋を繋いでいく。
		
		//最初は不便さがNC2
		long ans = (long)N*(N-1)/2;
		inc[M] = ans;
		
		UnionFind uf = new UnionFind(N);
		for(int i=M-1;i>=0;i--) {
			int A = v[i][0];
			int B = v[i][1];
			//if(uf.same(A,B))continue;
			long tmpA = uf.size(A);
			long tmpB = uf.size(B);
			long tmp = 0;
			if(uf.unite(A, B)) {
				tmp = tmpA * tmpB;
			}
			inc[i] = inc[i+1] - tmp;
		}
		
		long tmp = inc[0];
		for(int i=0;i<M;i++) {
			inc[i]-=tmp;
		}
		
		StringBuilder sb =  new StringBuilder();
		for(int i=1;i<M+1;i++) {
			sb.append(inc[i]+"\n");
		}
		System.out.println(sb.toString());
	}
}

Measured memory_bytes: 95720
s = gets.chomp.to_i
n = []
n[1] = s
i = 2
res = 0
 
while true
  if n[i - 1] % 2 == 0
    n[i] = n[i - 1] / 2
  else
    n[i] = 3 * n[i - 1] + 1
  end
  
  for j in 1..(i - 1)
    if n[i] == n[j]
      res = i
      break
    end
  end
  
  if res != 0
    puts res
    break
  end
  
  i += 1
end

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

struct element
{
   int val, poz, tip;
};

int n;
int A[200005], B[200005], C[200005];
long long S[200005];
long long sa, sb;
int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(0);
   cin >> n;
   for (int i = 1; i <= n; i++)
   {
      cin >> A[i] >> B[i];
      sa += A[i]; sb += B[i];
      C[2 * i - 1] = A[i];
      C[2 * i] = B[i];
   }

   long long rez = min(sa, sb);

   sort(C + 1, C + 2 * n + 1);

   for (int i = 1; i <= 2 * n; i++)
      S[i] = S[i - 1] + C[i];

   for (int i = 1; i <= n; i++)
   {
      int merg = n;
      long long sum = 0;
      if (A[i] >= C[merg])
         merg--, sum += A[i];
      if (B[i] >= C[merg])
         merg--, sum += B[i];

      rez = min(rez, sum + S[merg]);
   }
   cout << rez;
   return 0;
}


Measured memory_bytes: 3456
#include <stdio.h>

int main(){
	int A;
	int B;
	scanf("%d",&A);
	scanf("%d",&B);
	int C=A+B;
	if(C<(A-B)){
		C=A-B;
	}
	if(C<(A*B)){
		C=A*B;
	}
	printf("%d",C);
	return 0;
}

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

using namespace std; 

int n, a[20]; 

map < pair <pair <int, int>, pair <long long, long long> > , long long> f, vis; 

long long dp(int l, int r, long long x, long long y) {
  if (vis[{{l, r}, {x, y}}] != 0) return f[{{l, r}, {x, y}}];
  long long ret = 1e18; 
  vis[{{l, r}, {x, y}}] = 1; 
  if (r == l + 1) {
    ret = a[l] * x + a[r] * y; 
  }
  else {
    for (int m = l + 1; m <= r - 1; m++) {
      ret = min(ret, dp(l, m, x, x + y) + dp(m, r, x + y, y) - 1ll * a[m] * (x + y)); 
    }
  }
  return f[{{l, r}, {x, y}}] = ret; 
}

int main() {
  cin >> n; 
  for (int i = 1; i <= n; i++) {
    cin >> a[i]; 
  }  
  cout << dp(1, n, 1, 1) << endl; 
  return 0; 
}

Measured memory_bytes: 83968
#include<bits/stdc++.h>
#pragma GCC optimize ("-O3")
    using namespace std;
    #define ll long long
    #define ld long double
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define pll pair<ll,ll>
    #define ff first
    #define ss second
    #define pb push_back
    #define deb(x) cout<<#x<<" : "<<x<<endl;
    #define deb2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
    #define deb3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;
    #define deb4(w,x,y,z) cout<<#w<<" : "<<w<<"\t"<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;
    #define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define printv(a)  for(ll i=0;i<a.size();i++)  cout<<a[i]<<" ";
   
   
    const int mod=1e9+7;
    const int N=1e6+5; 
   
    bool sortbysec(const pair<pair<ll,ll>,ll> &a, 
                      const pair<pair<ll,ll>,ll> &b) 
        { 
            return (a.second > b.second); 
        } 
        ll powermod(ll x, ll y, ll p)
        {
            ll res = 1;
            x = x % p;
            while (y > 0)
            {
                if (y & 1) res = (res*x) % p;
                y = y>>1;
                x = (x*x) % p;
            }
            return res;
        }
       
        bool isprime(int n) 
        { 
            if (n <= 1)  return false; 
            if (n <= 3)  return true; 
            if (n%2 == 0 || n%3 == 0) return false; 
            for (int i=5; i*i<=n; i=i+6) 
                if (n%i == 0 || n%(i+2) == 0) 
                   return false; 
           return true; 
        }
       
        
     
        int main()
    {
        FAST;
        ll n,k;
        cin>>n>>k;
        vll a(n);
        for(ll i=0;i<n;i++)
        cin>>a[i];
       vector< bool> dp(k+1);
        for(ll stones=0;stones<=k;stones++){
       for(ll i=0;i<n;i++)
       {
           if(stones-a[i]>=0 && !dp[stones-a[i]])
           {
               dp[stones]=1;
           }
       }
       
       
        }
        if(dp[k])
       cout<<"First";
       else cout<<"Second";
        return 0;
    }

Measured memory_bytes: 256
// 模板
// #include "bits/stdc++.h"
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include <queue>
#include <map>
#include <deque>
#include <stack>
#include <cmath>
using namespace std;
#define mm(a,n) memset(a, n, sizeof(a))
#define gcd(a,b) __gcd(a,b) 
#define INF 0x3f3f3f3f  
#define EXP 1e-8  
#define lowbit(x) (x&-x)
typedef long long ll;
typedef unsigned long long ull;
 
void Main();
 
int main() {
    //应清除注释
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w", stdout);
    Main();
    // fclose(stdin);
    // fclose(stdout);
    //system("pause");  //应注释
    return 0;
}
 
void Main() {
    int num;
    cin >> num;
    if(num >= 30) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 3644
import numpy as np

N,K,Q = map(int,input().split())
A = []
for i in range(Q):
	A.append(int(input()))

A = np.array(A)
p = np.zeros(N)
res = np.full_like(p,K)

for a in A:
	p[a-1] = p[a-1] + 1
	
p = p - Q
res = res + p

for i in res:
	if i <= 0:
		print('No')
	else:
		print('Yes')

Measured memory_bytes: 17076
import re
s=input()
if re.match("^keyence.*",s) or re.match(".*keyence$",s) or re.match("^k.*eyence$",s)  or re.match("^ke.*yence$",s) or re.match("^key.*ence$",s) or re.match("^keye.*nce$",s) or re.match("^keyen.*ce$",s)or re.match("^keyenc.*e$",s) or re.match("^keyence$",s) :
    print("YES")
else:print("NO")

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int theta = 90;
        double x = 0;
        double y = 0;
        int d = 0;
        int a = 0;
        while(sc.hasNext()){
            String[] str = sc.nextLine().split(",");
            d = Integer.parseInt(str[0]);
            a = Integer.parseInt(str[1]);
            if(d == 0 && a == 0){
                break;
            }
            x += (double)d * Math.cos((double)theta*Math.PI/180);
            y += (double)d * Math.sin((double)theta*Math.PI/180);
            theta -= a;
        }
        System.out.println((int)x + "\n" + (int)y);
    }
}

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

int main(){
    int N, A, B;

    cin >> N;
    cin >> A;
    cin >> B;

    if(N * A < B){
        cout << N * A << endl;
    }else{
        cout << B << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
a1 = gets.split.map(&:to_i)
a2 = gets.split.map(&:to_i)
max = 0
0.upto(n-1) do |i|
  i.upto(n-1) do |j|
    s = a1[0..i].reduce(:+) + a2[i..n-1].reduce(:+)
    max = s if max < s
  end
end
puts max


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

int main() {
	int i;
	double d;
	int ans;
	
	cin >> d;
	
	ans = d;
	d = d / 2;
	i = d;
	
	if(i < d){
		cout << ans * 2 << endl;
	}
	else if (i == d){
		cout << ans << endl;
	}
}

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

int main()
{
  double P=3.1415926535;
  double A,B;
  double H,M;
  cin >> A >> B >> H >> M;
  double lenjo;
  double Hdo=(H*30.000000000)+(30.000000000*(M/60.0000000000));
  double Mdo=6.00000000000*M;
  double dodo;
  if(Hdo>Mdo)
  {
    dodo=Hdo-Mdo;
  }
  else
  {
    dodo=Mdo-Hdo;
  }
  if(dodo>180.0000000000)
  {
    dodo=360.0000000000-dodo;
  }
  double co=cos(dodo*(P/180.0000000000));
  lenjo=A*A+B*B-2.0000000000*A*B*co;
  cout << fixed <<setprecision(20)<< sqrt(lenjo) <<endl;
}

Measured memory_bytes: 4228
import java.util.Scanner;

public class Main{    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
                
        while(true){
            int H=sc.nextInt();
            int W=sc.nextInt();
            if(H==0&&W==0){
                break;
            }
            for(int i=0;i<H;i++){
                for(int j=0;j<W;j++){
                    System.out.printf("#");
                }
                System.out.printf("\n");
            }
            System.out.printf("\n");
        }
    }
}


Measured memory_bytes: 61244
X, N = gets.split.map(&:to_i)
Ps = gets.split.map(&:to_i)

hash = Hash.new { |h, k| h[k] = 0 }
hash[0] += 1
Ps.each do |p|
  hash[(X - p).abs] += 1
end

abs = nil
0.upto(100) do |n|
  if hash[n] != 2
    abs = n
    break
  end
end

if Ps.include?(X - abs)
  puts(X + abs)
else
  puts(X - abs)
end


Measured memory_bytes: 14324
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <math.h> // sqrt
using namespace std;

int main() {
    int A, B, M;
    cin >> A >> B >> M;
    vector<int> fri(A);
    vector<int> mic(B);
    for (int i = 0; i < A; i++) {
        cin >> fri.at(i);
    }
    for (int i = 0;  i < B; i++) {
        cin >> mic.at(i);
    }
    vector<vector<int>> off(M, vector<int>(3));
    for (int i = 0; i < M; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> off.at(i).at(j);
        }
    }
    int sum;
    int ans = 200000;
    for (int i = 0; i < M; i++) {
        sum = fri.at(off.at(i).at(0) - 1) + mic.at(off.at(i).at(1) - 1) - off.at(i).at(2);
        ans = min(ans, sum);
    }
    int minf = fri.at(0);
    int minm = mic.at(0);
    int f = 0;
    int m = 0;
    for (int i = 1; i < A; i++) {
        if (fri.at(i) < minf) {
            minf = fri.at(i);
            f = i;
        }
    }
    for (int i = 1; i < B; i++) {
        if (mic.at(i) < minm) {
            minm = mic.at(i);
            m = i;
        }
    }
    sum = fri.at(f) + mic.at(m);
    int sale = 0;
    for (int i = 0; i < M; i++) {
        if (off.at(i).at(0) - 1 == f && off.at(i).at(1) - 1 == m) {
            sale = max(sale, off.at(i).at(2));
        }
    }
    sum -= sale;
    ans = min(ans, sum);
    cout << ans << endl;
}

Measured memory_bytes: 9600
#include<iostream>

using namespace std;

main(){
  int N,f=0;
  string S;
  cin>>N;
  cin>>S;
  if(N%2==1){
    f=1;
  }
  else{
    for(int i=0;i<N/2;i++){
      if(S[i]!=S[N/2+i]) f=1;
    }
  }
  
  if(f==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0};
    lol n; cin >> n;
    lol k; cin >> k;
    /*
    vector<lol> a(n);
    REP(i, n)
    {
        cin >> a[i];
    }
    */
    result = ((n-1)*n)/2+((k-1)*k)/2;

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <iostream>

 

using namespace std;

 

int main()
{
   int a, b, temp, i;
   for(i=1; i<=3000; i++)
   {
      cin >> a >> b;
      
      if(a== 0 && b== 0)
      break;
      
      if(a > b)
      {
        temp = a;
        a = b;
        b = temp;
     
    }
    
    
 

   cout << a << " " << b << endl;
}

}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define MOD 1000000007

int main(){
  int n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  ll ans=0;
  for(int i=0;i<n-1;i++){
    ans+=a[i]/2;
    if(a[i]%2==1&&a[i+1]>=1){
      a[i+1]--;
      ans++;
    }
  }
  ans+=a[n-1]/2;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,kk;
int main()
{
    cin>>a>>b>>c;
    if(b>=a)
    {
        cout<<1<<endl;
        return 0;
    }
    if(c>=b)
    {
        cout<<-1<<endl;
        return 0;
    }
    if((a-b)%(b-c)>=1)
		kk=1;
    cout<<((a-b)/(b-c)+kk)*2+1<<endl;
}

Measured memory_bytes: 256