akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
    int c[3][3];
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            cin >> c[i][j];
        }
    }
    bool judge = true;
    if(c[0][0]-c[0][1] != c[1][0] - c[1][1]) judge = false;
    if(c[0][0]-c[0][1] != c[2][0] - c[2][1]) judge = false;
    if(c[0][0]-c[0][2] != c[1][0] - c[1][2]) judge = false;
    if(c[0][0]-c[0][2] != c[2][0] - c[2][2]) judge = false;
    if(c[0][0]-c[1][0] != c[0][1] - c[1][1]) judge = false;
    if(c[0][0]-c[1][0] != c[0][2] - c[1][2]) judge = false;
    if(c[0][0]-c[2][0] != c[0][1] - c[2][1]) judge = false;
    if(c[0][0]-c[2][0] != c[0][2] - c[2][2]) judge = false;
    if(judge) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
macro_rules !read_value {($iter :expr ,($($t :tt ) ,*) ) =>{($(read_value !($iter ,$t ) ) ,*) } ;($iter :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($iter ,$t ) ) .collect ::<Vec <_ >>() } ;($iter :expr ,{$t :tt =>$f :expr } ) =>{$f (read_value !($iter ,$t ) ) } ;($iter :expr ,chars ) =>{read_value !($iter ,String ) .chars () .collect ::<Vec <char >>() } ;($iter :expr ,usize1 ) =>{read_value !($iter ,usize ) -1 } ;($iter :expr ,$t :ty ) =>{$iter .next () .unwrap () .parse ::<$t >() .unwrap () } ;}
macro_rules !input_inner {($iter :expr ) =>{} ;($iter :expr ,) =>{} ;($iter :expr ,mut $var :ident :$t :tt $($r :tt ) *) =>{let mut $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,mut $var :ident $($r :tt ) *) =>{input_inner !{$iter ,mut $var :usize $($r ) *} } ;($iter :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,$var :ident $($r :tt ) *) =>{input_inner !{$iter ,$var :usize $($r ) *} } ;}
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;(iter =$iter :ident ,$($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut $iter =s .split_whitespace () ;input_inner !{$iter ,$($r ) *} } ;($($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut iter =s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;}
fn main() {
    #[allow(unused_imports)]
    use std::io::Write as _;
    let __out = std::io::stdout();
    #[allow(unused_mut, unused_variables)]
    let mut __out = std::io::BufWriter::new(__out.lock());
    #[allow(unused_macros)]
    macro_rules !print {($($arg :tt ) *) =>(::std ::write !(__out ,$($arg ) *) .unwrap () ) }
    #[allow(unused_macros)]
    macro_rules !println {($($arg :tt ) *) =>(::std ::writeln !(__out ,$($arg ) *) .unwrap () ) }
    #[allow(unused_macros)]
    macro_rules! echo {
        ($iter :expr ) => {
            echo!($iter, "\n")
        };
        ($iter :expr ,$sep :expr ) => {
            let mut iter = $iter;
            if let Some(item) = iter.next() {
                print!("{}", item);
            }
            for item in iter {
                print!("{}{}", $sep, item);
            }
            println!();
        };
    }
    input!(n, k, mut a: [i64; n]);
    for _ in 0..k {
        let mut b = vec![0; n];
        for (i, &x) in a.iter().enumerate() {
            b[i.saturating_sub(x as usize)] += 1;
            if i + (x as usize) + 1 < n {
                b[i + x as usize + 1] -= 1;
            }
        }
        for i in 0..n - 1 {
            b[i + 1] += b[i];
        }
        a = b;
        if a.iter().all(|&x| x == n as i64) {
            break;
        }
    }
    echo!(a.iter(), " ");
}


Measured memory_bytes: 6640
// quote from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8

#![allow(unused)]
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, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

macro_rules! out {
    ($x:expr) => {
        println!("{}", $x)
    };
}

macro_rules! debug {
    ($x:expr) => {
        println!("{:?}", $x)
    };
}

fn main() {
    use std::char;
    input! {
        n: u8,
        s: String,
    }
    let s: String = s;
    let ans: String = s.bytes().map(|c| (((c % 65 + n) % 26) as u8 + b'A') as char).collect();
    println!("{}", ans)
}


Measured memory_bytes: 4352
#include <stdio.h>
int check(int n){
	int pre_n,num=0;
	pre_n=n;
	while(n){
	num=num*10+n%10;
	n/=10;
    }
    return pre_n==num;
}
int main(){
	int a,b,count=0;
	scanf("%d%d",&a,&b);
	for(int i=a;i<=b;i++){
		if(check(i)) count++;
	}
	printf("%d\n",count);
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
	int N,i;
	double t;
	double k;
	scanf("%d",&N);
	i=1;
	while(i<=N){
		if(i%2==1){
			t=t+1;
		}
		i=i+1;
	}
	k=t/N;
	printf("%.10f\n",k);
	return 0;
} 

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

char s[70],ans[130],Ans[130];
int cnt[70],l,r,mid,len,nw,tot;

int main()
{
	len=0;
	for (int i=0; i<26; i++) s[i]='a'+i,s[i+26]='A'+i;
	for (int i=52; i<62; i++) s[i]='0'+(i-52);
	for (int i=0; i<62; i++)
	{
		printf("? ");
		for (int j=1; j<=128; j++) putchar(s[i]); puts("");
		fflush(stdout),scanf("%d",&cnt[i]),cnt[i]=128-cnt[i],tot+=cnt[i];
	}
	for (int i=0; i<62; i++)
		if (!len&&cnt[i]) 
		{
			len=cnt[i];
			for (int j=0; j<len; j++) ans[j]=s[i];
		} else
		{
			int la=0;
			for (int j=1; j<=cnt[i]; j++)
			{
				l=la,r=len;
				while (l<r)
				{
					mid=(l+r+1)>>1;
					printf("? ");
					for (int k=0; k<mid; k++) putchar(ans[k]); 
					for (int k=0; k<=cnt[i]-j; k++)putchar(s[i]);puts("");
					fflush(stdout),scanf("%d",&nw);
					if (nw==tot-mid-(cnt[i]-j+1)) l=mid; else r=mid-1;
				}
				for (int k=0; k<l; k++) Ans[k]=ans[k];
				Ans[l]=s[i];
				for (int k=l; k<len; k++) Ans[k+1]=ans[k];
				len++,la=l+1;
				for (int k=0; k<len; k++) ans[k]=Ans[k];
			}
		}
	printf("! ");
	for (int i=0; i<len; i++) putchar(ans[i]);puts("");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 3828
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * 解説どおりに作成したソースコード
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			int n = s.length;
			System.out.println(IntStream.range(0, n - 1).filter(i -> s[i] != s[i + 1])
					.map(i -> Math.max(i + 1, n - i - 1)).min().orElse(n));
		}
	}
}


Measured memory_bytes: 28884
require 'matrix'

my, enemy, b1, b2, b3 = $<.readlines.map {|l| Vector[*l.split.map(&:to_r)]}
v = enemy - my
va = b2 - b1
vb = b3 - b1
begin
  l, s, t = Matrix.columns([-v, va, vb]).lup.solve(my - b1).to_a
rescue
  puts "HIT"
  exit
end

puts 0 < l && l <= 1 && (s + t).between?(0, 1) && s >= 0 && t >= 0 ? "MISS" : "HIT"



Measured memory_bytes: 7248
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i++; i<N)
#define RVROOP(i, N) for(int i=N; i--; i>=0)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  int X; cin>>X;
  int min=X/105, max=X/100;
  int ans=0;
  for(int i=min; i<=max; i++){
    if(i*100<=X && i*105>=X){
      ans=1;
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
n=int(input())
lst=sorted(map(int,input().split()),reverse=True)
memory=-1
ans1=-1
for i in range(n):
    if lst[i]==memory:
        if ans1==-1:
            ans1=memory
            memory=-1
        else:
            ans2=memory
            print(ans1*ans2)
            exit()
    else:
        memory=lst[i]

print(0)

Measured memory_bytes: 85204
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

int n;
vector<vector<int> > edge;
int tree[100000];
void bfs()
{
  queue<pair<int,int> > q;
  q.push(make_pair(1,0)),q.push(make_pair(2,n-1));
  tree[0]=1,tree[n-1]=2;
  while(q.size())
    {
      auto tmp=q.front();q.pop();
      for(int i=0;i<edge[tmp.second].size();i++)
	{
	  if(tree[edge[tmp.second][i]]==0)
	    {
	      tree[edge[tmp.second][i]]=tmp.first;
	      q.push(make_pair(tmp.first,edge[tmp.second][i]));
	    }
	}
    }
}
int main(int argc,char const* argv[])
{
  int a,b;
  cin >> n;
  edge.resize(n);
  for(int i=0;i<n-1;i++)
    {
      cin >> a >> b;
      a--,b--;
      edge[a].push_back(b);
      edge[b].push_back(a);
    }
  bfs();
  int ans=0;
  for(int i=0;i<n;i++)
    {
      if(tree[i]==1)ans++;
    }
  if(ans>n-ans)
    {
      cout << "Fennec" << endl;
    }
  else cout << "Snuke" << endl;
  return 0;
}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair < int, int >;

const int mod = 1e9 + 7;
void add_self (int & a, int b) {
	a += b;
	if (a >= mod) a -= mod;
}

int main() {
	int n; scanf ("%d", &n);
	vector < vector < int > > a (n, vector < int > (n));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			scanf ("%d", &a[i][j]);
		}
	}
	vector < int > dp (1 << n);
	dp[0] = 1;
	for (int state = 0; state < (1 << n) - 1; state++) {
		int men = __builtin_popcount (state);
		for (int i = 0; i < n; i++) {
			if (a[men][i] && !((state >> i) & 1)) {
				int new_state = state ^ (1 << i);
				add_self (dp[new_state], dp[state]);
			}
		}
	}
	printf ("%d\n", dp[(1 << n) - 1]);
	return 0;
}



Measured memory_bytes: 8448
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>*/
 
#define pb push_back
#define mp make_pair
#define sz(s) ((int)(s.size()))
#define all(s) s.begin(), s.end()
#define rep(i, a, n) for (int i = a; i <= n; ++i)
#define per(i, n, a) for (int i = n; i >= a; --i)
#define onlycin ios_base::sync_with_stdio(false); cin.tie(0) 
using namespace std;
// using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
/*typedef tree<
pair < int, int >,
null_type,
less< pair < int, int > >,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;*/
// find_by_order() order_of_key()
const int MAXN = (int)5e5+228;
const char nxtl = '\n';
const int mod = (int)1e9+7;
const double eps = (double)1e-7;
template<typename T> inline bool updmin(T &a, const T &b) {return a > b ? a = b, 1 : 0;}
template<typename T> inline bool updmax(T &a, const T &b) {return a < b ? a = b, 1 : 0;}

int n, a[2][MAXN], dp[2][MAXN];

int main() {
	#ifdef accepted
		freopen(".in", "r", stdin);
		freopen(".out", "w", stdout);
	#endif
	onlycin;
	cin >> n;
	rep(i, 0, 1) rep(j, 1, n) {
		cin >> a[i][j];
		dp[i][j] = dp[i][j - 1] + a[i][j];
	}
	int res = -mod;
	rep(i, 1, n) {
		updmax(res, dp[0][i] + dp[1][n] - dp[1][i-1]);
	}
	cout << res << nxtl;
	
	return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
enum Personality{HONEST,UNKIND};
struct Group
{
    Group():mem(0),hp(0){}
    Group(int x):mem(1,x),hp(1){}
    vector<int> mem;
    int hp;
    Personality judge(Group p)
    {
        printf("? %d %d\n",mem[0],p.mem[0]);
        fflush(stdout);
        char in[5];scanf("%s",in);
        return in[0]=='Y'?HONEST:UNKIND;
    }
    void answer(int n)
    {
        string s(n,'0');
        for(int i:mem) s[i]='1';
        printf("! %s\n",s.c_str());
        fflush(stdout);
    }
};
Group merge(Group a,Group b)
{
    a.mem.insert(a.mem.end(),b.mem.begin(),b.mem.end());
    a.hp+=b.hp;
    return a;
}
vector<Group> jail;
Group fight(Group big,Group small)
{
    if(big.hp<small.hp) swap(big,small);
    big.hp-=small.hp;small.hp=0;
    jail.push_back(small);
    return big;
}
int main()
{
    int a,b;scanf("%d%d",&a,&b);
    if(a<=b){puts("Impossible");return 0;}
    
    int n=a+b;
    Group jury(0);
    for(int i=1;i<n;i++)
    {
        Group defendant(i);
        if(jury.judge(defendant)==HONEST)
        {
            if(defendant.judge(jury)==HONEST) jury=merge(jury,defendant);  
            else jury=defendant;
        }
        else jury=fight(jury,defendant);
    }
    for(Group defendant:jail) if(jury.judge(defendant)==HONEST)
        jury=merge(jury,defendant);
    jury.answer(n);
    return 0;
}


Measured memory_bytes: 980
#pragma GCC optimize("O3")
        #pragma comment(linker, "/stack:200000000")
        #pragma GCC optimize("unroll-loops")
         
        #include <algorithm>
        #include <bitset>
        #include <cassert>
        #include <chrono>
        #include <cmath>
        #include <complex>
        #include <cstdio>
        #include <cstdlib>
        #include <cstring>
        #include <ctime>
        #include <deque>
        #include <functional>
        #include <iomanip>
        #include <iostream>
        #include <iterator>
        #include <limits>
        #include <climits>
        #include <list>
        #include <map>
        #include <numeric>
        #include <queue>
        #include <random>
        #include <ratio>
        #include <set>
        #include <sstream>
        #include <stack>
        #include <string>
        #include <unordered_map>
        #include <unordered_set>
        #include <utility>
        #include <vector>
        using namespace std;
         
        typedef long long ll;
        typedef long double LD;
        #define int ll
        #define double LD
        #define pb push_back
        #define mp make_pair
        #define REP(i,n) for (int i = 0; i < n; i++)
        #define loop(i,n) for (int i = 0; i < n; i++)
        #define FOR(i,a,b) for (int i = a; i < b; i++)
        #define REPD(i,n) for (int i = n-1; i >= 0; i--)
        #define FORD(i,a,b) for (int i = a; i >= b; i--)
        #define remax(a,b) a = max(a,b)
        #define remin(a,b) a = min(a,b)
        #define mem(a, b) memset(a, b, sizeof a)
        #define append push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define print(x) cout << (x) << endl
        #define PRECISION(x) cout << fixed << setprecision(x)
        #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
        #define N 1005
        #define pb push_back
        const double PI=acos(-1);
        const int MOD = 1000000007;
        const int FMOD = 998244353;
        const double eps = 1e-9;
         
        mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
        

        signed main()
        {
        	int n;
        	cin>>n;
        	
        	cout<<((n-1)/1000+1)*1000-n;
		}

Measured memory_bytes: 3624
#include <stdio.h>

int main() {
    int i, N;
    char o, s[0xff+1] = {0};
    scanf("%d", &N);
    for (i=0; i < N ;i++) {
        scanf("%c", &o);
        if (o == 'Y') s[0] = 1;
    }
    if (s[0] == 1) printf("Four\n");
    else printf("Three\n");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a) ? "Yes" : "No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
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 long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);
int main() {
	int n;
	ll yen = 1000LL;
	cin >> n;
	V a(n);
	rep(i, n) { cin >> a[i]; }
	P cnt = mp(INF, 0LL);
	rep(i, n) {
		if (cnt.F == INF) {
			cnt.F = a[i];
			continue;
		}
		if ((cnt.F >= a[i])) {
			if (cnt.S != 0LL) {
			//	yen = yen / cnt.F * cnt.S;
				yen += (cnt.S - cnt.F) * (yen / cnt.F);
				//	clog << "buy :" << cnt.F << " sell :" << cnt.S<<endl;
				
			}
			cnt = mp(a[i], 0LL);
		} else {
			if (!chmax(cnt.S, a[i])) {
				//yen = yen / cnt.F * cnt.S +(yen%cnt.F);
				yen += (cnt.S - cnt.F) * (yen / cnt.F);
				//	clog << "buy :" << cnt.F << " sell :" << cnt.S << endl;
				cnt = mp(a[i], 0LL);
			}
		}
	//	clog << "cnt;:: buy :" << cnt.F << " sell :" << cnt.S << endl;
	}
	if (cnt.S != 0LL and cnt.F!= INF) {
		//yen = yen / cnt.F * cnt.S + (yen % cnt.F);
		yen += (cnt.S - cnt.F) * (yen / cnt.F);
		//	clog << "buy :" << cnt.F << " sell :" << cnt.S << endl;
		//	cnt = mp(INF, 0LL);
	}
	cout << yen << endl;
}

Measured memory_bytes: 3600
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		sc.close();
		long cnt=0;
		long bcnt=0;
		for (i = 0; i < s.length; i++) {
			switch(s[i]) {
			case 'B':
				bcnt++;
				break;
			case 'W':
				cnt+=bcnt;
				break;
			}
		}
		out.println(cnt);
	}
}


Measured memory_bytes: 26532
def test():

	n = int(input())
	x_array = list(map(int,input().split()))
	y_array = list(map(int,input().split()))

	p_1 = 0
	p_2 = 0
	p_3 = 0
	p_inf = 0

	for i in range(n):
		
		tmp = abs(x_array[i] - y_array[i])
		p_1 += tmp
		p_2 += tmp ** 2
		p_3 += tmp ** 3
		if p_inf < tmp:
			p_inf = tmp

	p_2 = p_2**(1/2)
	p_3 = p_3**(1/3)

	print(f"{p_1:.6f}")
	print(f"{p_2:.6f}")
	print(f"{p_3:.6f}")
	print(f"{p_inf:.6f}")


if __name__ == "__main__":
	test()


Measured memory_bytes: 5660
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <random>
#include <utility>
#include <map>
#include <vector>
#include <queue>
#include <bitset>
#include <sstream>
#define REP(i,x) for(int i=0; i<(x); i++)
typedef long long ll;

using namespace std;

int main(int argc, const char * argv[]) {
    int a,b;
    cin >> a >> b;
    string out;
    if(a>8 || b>8){
        out = ":(";
    }else{
        out = "Yay!";
    }
    cout << out << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>                                                                                               
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main(){
    int a,b,x;
    cin >> a >> b>> x;
    if(a <= x && a+b >= x) cout << "YES\n";
    else cout << "NO\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
  int n;
  std::cin >> n;
  int res = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    std::cin >> x;
    if ((i+1)*x%2 == 1) {
      res += 1;
    }
  }
  std::cout << res;
  return 0;
}


Measured memory_bytes: 3196
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define ll long long
int compr(const void *a, const void *b)
{ //昇順
    return *(int *)b - *(int *)a;
}

int main(void)
{
    int n;
    scanf("%d", &n);
    ll i, max = 0;
    for (i = 1; i <= n; i++)
    {
        if (i % 3 == 0 && i % 5 == 0)
        {
        }
        else if (i % 3 == 0)
        {
        }
        else if (i % 5 == 0)
        {
        }
        else
        {
            max += i;
        }
    }
    printf("%lld\n", max);
    return 0;
}

Measured memory_bytes: 1736
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=n-1;i>=a;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
template<typename T>
void max_self(T &a,T b){
    a=max(a,b);
}
template<typename T>
void min_self(T &a,T b){
    a=min(a,b);
}
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=2e4+10,oo=0x3f3f3f3f,MOD=998244353;
const double PI = acos(-1);

void solve(){
    int n,q;
    cin>>n>>q;
    string s;
    cin>>s;
    int cnt[n+1]={};
    loop(n-1,i,0){
        if(s[i]=='A'&&s[i+1]=='C')
            cnt[i+1]++;
        cnt[i+1]+=cnt[i];
    }
    while(q--){
        int l,r;
        cin>>l>>r;
        l--,r--;
        cout<<cnt[r]-cnt[l]<<endl;
    }
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();
}

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

using namespace std;

int c[10][10];
int a[300][300];
int ct[10];

void rec(int now, int vc, bool used[]){
        ct[now]=min(ct[now], vc);
        for(int i=0;i<10;i++){
                if(now==i||used[i]){
                        continue;
                }
                else{
                        vc+=c[i][now];
                        used[i]=true;
                        rec(i, vc, used);
                        vc-=c[i][now];
                        used[i]=false;
                }
        }
}

int main(){
        int H, W;
        cin>>H>>W;
        for(int i=0;i<10;i++){
                for(int j=0;j<10;j++){
                        cin>>c[i][j];
                }
        }
        for(int i=0;i<H;i++){
                for(int j=0;j<W;j++){
                        cin>>a[i][j];
                }
        }
        for(int i=0;i<10;i++){
                ct[i]=c[i][1];
        }
        bool used[10]={false};
        rec(1, 0, used);
        /*for(int i=0;i<10;i++){
                cout<<i<<":"<<ct[i]<<endl;
        }*/
        long long ans=0;
        for(int i=0;i<H;i++){
                for(int j=0;j<W;j++){
                        if(a[i][j]==-1){
                                continue;
                        }
                        ans+=ct[a[i][j]];
                }
        }
        cout<<ans<<endl;
        return 0;
}


Measured memory_bytes: 512
n = gets.to_i
l = gets.split(" ").map!{|i| i.to_i}
max = 0
sum = 0
n.times do |j|
 if max < l[j] then max = l[j] end
 sum += l[j]
end
sum = sum - max  
if max < sum 
  puts 'Yes'
else puts 'No'
end
  

Measured memory_bytes: 1788
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ n, d ] <- readInts
	let
		w = d * 2 + 1
	print $ ( n + w - 1 ) `div` w

Measured memory_bytes: 380
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

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

typedef vector<int> vec;
typedef vector<vec> mat;

const ll mod = 1000000007;

int main(){
    int n;
    cin >> n;
    double a[n];
    rep(i, n) cin >> a[i];
    double ans = 0;
    rep(i, n) ans += (double)1 / a[i];
    ans = 1 / ans;
    printf("%.10lf\n", ans);
}

Measured memory_bytes: 3784
a,b,c,d=map(int,input().split())

from fractions import gcd
m=(c*d)//gcd(c,d)

A=b//c-(a-1)//c # a-bのうち、cの倍数のもの
B=b//d-(a-1)//d # a-bのうち、dの倍数のもの
C=b//m-(a-1)//m # a-bのうち、cとdの最小公倍数の倍数のもの
ans=(b-a+1)-(A+B-C)
print(ans)


Measured memory_bytes: 5048
#include<bits/stdc++.h>
using namespace std;
int main(){
    
    bool check=false;
    int n;
    cin>>n;
    int d1[n];
    int d2[n];
    for(int i=0;i<n;i++){
        cin>>d1[i]>>d2[i];
    }
    
    for(int i=1;i<=n-2;i++){
        if((d1[i]==d2[i] )&&(d1[i-1]==d2[i-1])&&(d1[i+1]==d2[i+1])){
            check=true;
            break;
        }
    }
    if(check){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3620
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	int n;
	cin>>n;
	string s,sol="-1";
	cin>>s;
	bool hasAns = false;
	for(int j=0;j<4&&!hasAns;j++) {
		string ans(n,' ');
		if(j==0)ans[0]='W',ans[1]='W';
		else if(j==1)ans[0]='W',ans[1]='S';
		else if(j==2)ans[0]='S',ans[1]='W';
		else ans[0]='S',ans[1]='S';
		for(int i=1;i<n-1;i++) {
			bool equal = s[i]=='o';
			if(ans[i]=='W')equal=!equal;
			if(equal)ans[i+1]=ans[i-1];
			else ans[i+1]=(ans[i-1]=='W'?'S':'W');
		}
		bool nowAns = true;
		for(int i=0;i<n;i++) {
			bool equal = s[i]=='o';
			if(ans[i]=='W')equal=!equal;
			bool now = ans[(n+i-1)%n]==ans[(i+1)%n];
			if((!equal&&now)||(equal&&!now)){nowAns=false;break;}
		}
		if(nowAns) {
			hasAns = true;
			sol=ans;
		}
	}
	cout<<sol;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3732
#include <cstdio>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<fstream>

#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
using namespace std;

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
       
    ll i,j,k,p=1,q=1;
    ll n,m,tmp;
    string s[200000];
    string str;
    ll sum=0;
    ll strr[200005];
    cin>>n;
    rep(i,n+1){
        if(i%3==0||i%5==0){
            
        }else{
            sum=sum+i;
        }
    }
    cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 9860
#include<bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793238462643383279
double solution(double hh,double mm){
    if(hh > 11.0) hh = hh-12.0;
    if(mm == 60.0) mm = 0;
    double hangle = (hh*30.0)+(mm/2.0);
    double mangle = mm*6.0;
    double ans = abs(hangle-mangle);
    if(ans > 180.0) ans = 360.0-ans;
    return ans;

}

int main(){
    double a,b,c,d;
    scanf("%lf %lf %lf %lf",&a,&b,&c,&d);

    cout.precision(20);
    double ang = solution(c,d);

    double ans = a*a + b*b - (2*a*b *cos( (ang * PI) / 180.0));

    ans = sqrt(ans);
    cout << ans;
    return 0;
}


Measured memory_bytes: 4288
def dijkstra():
    global n, color, M, d, p

    min_value = 1000000
    d[0] = 0
    color[0] = 'GRAY'

    while True:
        min_value = 1000000
        u = -1

        for i in range(n):
            if min_value > d[i] and color[i] != 'BLACK':
                u = i
                min_value = d[i]

        if u == -1:
            break

        color[u] = 'BLACK'

        for v in range(n):
            if color[v] != 'BLACK' and M[u][v] != 1000000:
                if d[v] > d[u] + M[u][v]:
                    d[v] = d[u] + M[u][v]
                    color[v] = 'GRAY'

    for i in range(n):
        if d[i] == 1000000:
            d[i] = -1

        print('{} {}'.format(i, d[i]))


n = int(input())

color = ['WHITE'] * n
M = [[1000000 for i in range(n)] for j in range(n)]
d = [1000000] * n  # 重みが最小の辺の重み
p = [-1] * n  # MSTにおけるp[v]の親（どこから来たか？？）

for i in range(n):
    _ = list(map(int, input().split()))
    u = _[0]
    degree = _[1]

    for j in range(degree):
        v = _[j*2+2]
        w = _[j*2+3]
        M[u][v] = w
# print(M)

dijkstra()



Measured memory_bytes: 5712
#include <bits/stdc++.h>
#define fi first
#define se second
#define For(i, a, b) for (int i = (a); i <= (b); ++i)
#define Ford(i, a, b) for(int i = (a); i >=(b); --i)
#define endl '\n'
#define debug(a) cout << a << endl
using namespace std;
 
typedef long long ll;
typedef pair <ll, ll> pll;
typedef vector <ll> vll;
 
const ll maxN = 1e18;
const ll minN = -1e18;
const ll MOD = 1e9 + 7;
 
const ll limit = 2e5 + 5;
const ll limit1 = 1e6 + 5;
const ll limit2 = 1e3 + 5;

ll n, k;
ll a[limit1];
ll res = 0, sum = 0, ans = 0, kd, hkd;


void FastIn(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

void ReadIn(){
    cin >> n >> k;
    for(ll i = 0; i <= 2e5 + 5; i++){
        a[i] = i;
    }
    for(ll i = k - 1; i <= n; i++){
        kd = i;
        hkd = a[n] - i;
        kd = (0 + kd) * (i + 1) / 2;
        hkd = (hkd + a[n]) * (i + 1) / 2;
        res += hkd - kd + 1;
        res %= MOD;
    }
    cout << res;
}
int main(){
    FastIn();
    ReadIn();
}
    

Measured memory_bytes: 5212
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 

*/
// clang-format off
/* }}} */

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

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
// clang-format on
/* }}} */

int n, x;
int v[32];
bool dp[1000010];

bool isprime(int num) {
  REPS(i, 2, sqrt(num) + 1) {
    if (num % i == 0) return false;
  }
  return true;
}

signed main() {
  while (cin >> n >> x, n || x) {
    fill(dp, dp + 1000010, false);
    dp[0] = true;
    REP(i, n) v[i] = in();
    REP(i, n) {
      for (int j = 0; j + v[i] <= x; ++j) if (dp[j]) {
        dp[j + v[i]] = true;
      }
    }
    int ans = 0;
    DEP(i, x) if (dp[i] && isprime(i)) {
      ans = i;
      break;
    }
    ans ? print(ans) : print("NA");
  }

  return 0;
}

Measured memory_bytes: 4072
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define intt long long
#define pii pair<intt,intt>

#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define IO ios_base::sync_with_stdio(false);cin.tie();
#define endl '\n'

const intt max4 = 10004;
const intt maxx = 100005;
const intt max6 = 1000006;
const intt max7 = 10000007;

const intt lg4 = 13;
const intt lg5 = 17;
const intt lg6 = 20;

const intt INF = 2LL * 1000000000;

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

intt powmod (intt a, intt b, intt mod) {
    intt res = 1;
    a %= mod;
    for (; b; b >>= 1) {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

intt gcd (intt a, intt b) {
    while (b > 0) {
        intt t = a % b;
        a = b, b = t;
    }
    return a;
}

intt lcm (intt a, intt b) {
    return (a / gcd (a, b)) * b;
}

intt is_prime (intt n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (intt i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

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

int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    IO;
    intt a, b;
    cin >> a >> b;
    cout << b * 2 - a << endl;
    return 0;
}


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

int main()
{
    string o, e;
    cin >> o >> e;
    for(int i=0; i<e.length(); i++)
    {
        cout << o[i] << e[i];
    } if(o.size()!=e.size()) cout << o.back();
    cout << endl;
}

Measured memory_bytes: 256
#C
class UnionFind():
    # https://www.slideshare.net/chokudai/union-find-49066733
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        # root[x]>=0の場合は、特に直接的な意味を持たない気がする。計算に寄与するので意味はあるのだろうが。
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        # 無結合の時はRank=0,結合して1つ木が深くなると根がRank+=1
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    #
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]

    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return
        # 違う木に属していた場合rnkを見てくっつける方を決める
        # (1)xのランクの方が大きい(位置が深い)場合
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        # (2)yのランクの方が大きい(位置が深い)場合 or 等しい場合
        # また等しい場合、引数の2つめのyの方のランクを1つ増やす
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1

    # xとyが同じグループに属するか判断
    # Return: True or False
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]
    
#####################################################################    
N,M = map(int,input().split())
UN=UnionFind(N)
A=[0]*M
B=[0]*M
for i in range(M):
    A[i],B[i] = map(int,input().split())
    UN.Unite(A[i],B[i])

#print(UN.root)
cnt=0
for i in range(1,N+1):
    if UN.root[i]<0:
        cnt +=1
print(cnt-1)

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

#define P pair<lli,lli>

signed main(){

	lli n;
	cin>>n;

	string s[3];
	REP(i,0,3)cin>>s[i];

	lli cnt = 0;
	REP(i,0,n){
		set<char> c;
		REP(j,0,3){
			c.insert(s[j][i]);
		}
		if(c.size()==3)cnt+=2;
		else if(c.size()==2)cnt++;
	}

	cout<<cnt<<endl;

	return 0;
}

Measured memory_bytes: 256
# frozen_string_literal: true

N, K = gets.split.map(&:to_i)
MOD = 10**9 + 7

def count(i)
  tail(i) - head(i) + 1
end

def head(i)
  i * (i - 1) / 2
end

def tail(i)
  i * (N - i + 1) + i * (i - 1) / 2
end
sum = 0
(K..(N + 1)).each do |i|
  sum += count(i)
end

puts sum % MOD


Measured memory_bytes: 14404
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	ll K;
	int a[100001],b[100001];
	int amax=0;
	ll cnt[100001]={0};
	scan(N);scan(K);
	rep(i,N){
		scan(a[i]);scan(b[i]);
		cnt[a[i]]+=b[i];
		amax=max(amax,a[i]);
	}
	rep1(i,amax){
		K-=cnt[i];
		if(K<=0){
			prin(i);
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 1792
l = [int(i) for i in input().split()]
#直接
if(abs(l[0]-l[2])<=l[3]):
        print("Yes")
#間接
elif(abs(l[0]-l[1])<=l[3] and abs(l[1]-l[2])<=l[3]):
        print("Yes")
else:
        print("No")

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using int64 = int64_t;

constexpr int64 P1 = 1000000007;

int64 modpow(int64 a, int64 x) {
    if (x == 0) return 1;
    if (x == 1) return a;
    if (x % 2 == 0) {
        int64 h = modpow(a, x/2);
        return h * h;
    }
    return a * modpow(a, x-1);
}

int N, M;
string S;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N >> M >> S;

    int64 rhash[300001];
    rhash[0] = 0;
    for (int j = 1; j <= N; ++j) {
        rhash[j] = rhash[j-1] * P1 + (S[j-1] - 'a' + 1);
    }

    set<int64> hashes;
    int l = 0, r = 1;
    for (int j = 0; j < M; ++j) {
        string q; cin >> q;
        if (q == "L--") --l;
        if (q == "L++") ++l;
        if (q == "R--") --r;
        if (q == "R++") ++r;

        int64 nh = rhash[r] - rhash[l] * modpow(P1, r-l);
        hashes.insert(nh);
    }
    cout << hashes.size() << endl;
    return 0;
}

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

public class Main implements Runnable {

    private void solve() throws IOException {

        int N = nextInt();
        double[] d = new double[N];
        for(int i = 0; i < N; ++i) {
            d[i] = nextDouble();
        }
        double s = 0.0;
        for(int i = 0; i < N; ++i) {
            s += 1.0 / d[i];
        }
        s = 1.0 / s;
        s += 1e-9;
        writer.println(s);
    }

    public static void main(String[] args) {

        new Main().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
//            reader = new BufferedReader(new FileReader("a_1.txt"));
            tokenizer = null;
            writer = new PrintWriter(System.out);
//            writer = new PrintWriter("aa_1.txt");
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while(tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }

        return tokenizer.nextToken();
    }
}


Measured memory_bytes: 21460
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    ans = 0

    for i in range(n):
        x, u = input().split()
        if u == "JPY":
            ans += int(x)
        else:
            ans += 380000.0 * float(x)

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 62000
#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 <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
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif

int main(void) {
    int sum = 0;
    int num;
    cin >> num;
    vector<int> arr(num);
    cins(arr);
    for(int i = 0; i < num; i++) sum += arr[i];

    sort(arr.begin(), arr.end());
    if(!(sum%10)) {
        int exclude = 0;
        for(int i = 0; i < num; i++) {
            if(arr[i]%10) {
                exclude = arr[i];
                break;
            }
        }
        sum = (!exclude) ? 0 : sum - exclude;
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var b = ReadLine();
        if (b == "A")
            WriteLine("T");
        else if (b == "T")
            WriteLine("A");
        else if (b == "G")
            WriteLine("C");
        else WriteLine("G");
    }
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppiii;

void solve() {
  int a, b;
  cin >> a >> b;
  cout << a + b/2 << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}


Measured memory_bytes: 256