akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
using namespace std;
using namespace __gnu_pbds;
using lli = long long int;
 
template<typename key> using ordered_set = tree <key, null_type, less<key>, rb_tree_tag, tree_order_statistics_node_update>;
 
int main () {
   IO;
   int n, k, r, p, s;
   string str;
   cin >> n >> k >> r >> s >> p >> str;
   lli ans = 0;
   str = "#" + str; 
   string aux = "#";
   for(int i = 1; i <= n; i++) {
	  if(i <= k) {
		 if(str[i] == 'r') {
			ans += p;
			aux += 'p';
			continue;
		 }
		 if(str[i] == 's') {
			ans += r;
			aux += 'r';
			continue;
		 }
		 if(str[i] == 'p') {
			ans += s;
			aux += 's';
			continue;
		 }
	  }
	  else {
		 char hePlays = str[i];
		 char toWinHim;
		 if(hePlays == 'p') 
			toWinHim = 's';
		 else if(hePlays == 's')
			toWinHim = 'r';
		 else if(hePlays == 'r')
			toWinHim = 'p';
		 if(toWinHim == aux[i - k]) {
			aux += '#';
			continue;
		 }
		 aux += toWinHim;
		 if(toWinHim == 'r')
			ans += r;
		 else if(toWinHim == 's')
			ans += s;
		 else if(toWinHim == 'p')
			ans += p;
	  }
   }
   cout << ans;
   return 0;
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws Exception {
    try (final var stdin = new InputStreamReader(System.in);
         final var br = new BufferedReader(stdin)) {
      System.out.println(br.readLine().equals("1") ? "0" : "1");
    }
  }
}


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

int main(){
  int h, w;
  
  while ( true ){
    cin >> h >> w;
    
    if(h==0 && w==0)break;
    
    rep(i, h) {
      rep(j, w) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

int main() {
  ll n;cin >> n;
  ll ans=0;
  ll as[n+1];ll bs[n];
  rep(i,n+1)cin >> as[i];
  rep(i,n)cin >> bs[i];

  rep(i,n){
    ans+=min(as[i]+as[i+1],bs[i]);
    as[i+1]=max(as[i+1]-max(bs[i]-as[i],0LL),0LL);
  }
  cout << ans;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll a, b, q;std::cin >> q;
  re(i, q){
    std::cin >> a >> b;
    if(a>b) swap(a, b);
    ll ans = a-1;
    ll l = a-1, r = b;
    while(r-l>1){
      ll mid = (l+r)/2;
      ll tmp = ((mid+1-a)*(mid+1-a))/4 + a*(mid+1);
      //std::cout << "now" << mid << " " << tmp << '\n';
      if(tmp<a*b) l = mid;
      else r = mid;
    }
    std::cout << ans + l << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n = input()

    hon = ["2", "4", "5", "7", "9"]
    pon = ["0", "1", "6", "8"]
    bon = ["3"]
    ret = ""
    if n[-1] in hon:
        ret = "hon"
    elif n[-1] in pon:
        ret = "pon"
    elif n[-1] in bon:
        ret = "bon"

    return ret


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 9144
import bisect
from collections import deque
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()

d = deque([])
for i in range(N):
  n = bisect.bisect_right(C, B[N-1-i])
  if len(d) == 0:
    d.appendleft(N-n)
  else:
    d.appendleft(N-n+d[0])
  
ans = 0
for i in range(N):
  m = bisect.bisect_right(B, A[i])
  if m < N:
    ans += d[m]
print(ans)

Measured memory_bytes: 29640
#include <iostream>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

#define INF 100000000;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
#define eps 1.0e-14;

int main(){
    int n;
    ll k;
    cin >> n >> k;
    int A[200006];
    rep(i,n){
        cin >> A[i];
        A[i]--;
    }
    int journey[500006];
    journey[0] = 0;
    for(int i = 1; i < n*2; i++){
        journey[i] = A[journey[i-1]];
    }
    if(k < n){
        cout << journey[k] + 1 << endl;
        return 0;
    }
    int loop_start = n - 2;
    int loop_end = n - 1;
    while(journey[loop_start] != journey[loop_end]){
        loop_start--;
    }
    int period = loop_end - loop_start;
    k %= period;
    while (k < n){
        k += period;
    }
    cout << journey[k] + 1 << endl;
}

Measured memory_bytes: 5960
<?php

$a = [];
for ($i=0; $i < 6; $i++) {
    array_push($a, intval(trim(fgets(STDIN))));
}

if ($a[4]-$a[0] <= $a[5]) {
    echo 'Yay!';
} else {
    echo ':(';
}

echo PHP_EOL;


Measured memory_bytes: 16132
N,M = map(int,input().split())
A = list(map(int,input().split()))
total = sum(A)
A.sort(reverse = True)
counter_0 = 0

for i in range(M):
  if A[i] < total/(4*M):
    counter_0 += 1
    
if counter_0 == 0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9196
#include<bits/stdc++.h>
typedef double          D;
typedef long long int   LL;
typedef long double     LD;
#define OR              ||
#define AND             &&
#define nl              '\n'
#define S               string
#define inf             INT_MAX
#define SQR(a)          (a) * (a)
#define pb              push_back
#define GCD(a, b)       __gcd(a, b)
#define MOD             1000000007
#define PI              2.0*acos(0.0)
#define COSI(x)         acos(x)
#define LCM(a, b)       (a * b) / GCD(a, b)
#define mem(a,b)        memset(a,b,sizeof(a))
#define srtv(v)         sort(v.begin(),v.end())
#define T               int t; cin>>t; while(t--)
#define Rep(i,a,b)      for(int i = a; i <= b; i++)
#define rep(i,a,b)      for(int i = a; i >= b; i--)
#define boost		    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inout           freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)

#define si(x)           scanf("%d",&x)
#define pi(x)           printf("%d",x)
#define ss(str)         scanf("%s",str)
#define pl(x)           printf("%lld",x)
#define sl(x)           scanf("%lld",&x)
#define sii(x,y)        scanf("%d %d",&x,&y)
#define sll(x,y)        scanf("%lld %lld",&x,&y)
#define siii(x,y,z)     scanf("%d %d %d",&x,&y,&z)
#define slll(x,y,z)     scanf("%lld %lld %lld",&x,&y,&z)
#define M 10005

using namespace std;

//===========================================================

int fact(int n){
    if(n==0)
        return 1;
    else
        return n*fact(n-1);
}

//===========================================================

void divisor(int n){
    vector<LL>a(n+1);

    for(int i=1; i<=n; i++){
        for(int j=i; j<=n; j +=i){
            a[j]++;
        }
        cout<<a[i]<<" ";
    }
}

//===========================================================

void divisor2(int n){
    int cnt=0;
    for(int i=1; i<=sqrt(n); i++){
        if(n%i==0) cnt++;
        if(n/i != i) cnt++;
    }
    cout<<cnt;
}

//===========================================================

void isPrime_sieve(int n){
    bool marked[M];

    memset(marked,true,sizeof(marked));

    for(int i=2; i*i<=n; i++){
        if(marked[i]==true){
            for(int j=i*i; j<=n; j +=i){
                marked[j]=false;
            }
        }
    }

    for(int i=2; i<=n; i++){
        if(marked[i]){
            cout<<i<<" ";
        }
    }
}

//===========================================================

void move_brackets(int n,string s){
    int op=0,len=0;
        for(int i=0; i<n; i++){
            if(s[i]=='('){
                op++;
            }
            else{
                if(op){
                    op--;
                    len +=2;
                }
            }
        }
        cout<<(n-len)/2<<nl;
}

//===========================================================

const LL mx=1e9+123;


int main(void){
  // boost;

    LL t,n,ans,d,m;
        cin>>n;

    if(n%1000==0){
       cout<<0<<nl;
    }
    else{
        ans=n%1000;
        cout<<1000-ans<<nl;
    }
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
#define N 2000000
#define K 10000

void CountingSort(int *,int *,int);

int n;

int main()
{
  int i,*A,*B;

  scanf("%d",&n);
  if(n<1 || n>N) exit(1);

  A = (int *)malloc(sizeof(int)*n);
  B = (int *)malloc(sizeof(int)*n);
  
  for(i=0;i<n;i++){
    scanf(" %d",&A[i]);
    if(A[i]<0 || A[i]>10000) exit(2);
  }

  CountingSort(A,B,K);

  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    printf("%d",B[i]);
  }
  
  printf("\n");
  
  return 0;
}

void CountingSort(int *A,int *B,int k)
{
  int i,j,C[K];

  for(i=0;i<k;i++)
    C[i] = 0;

  for(j=0;j<n;j++)
    C[A[j]]++;

  for(i=1;i<k;i++)
    C[i] += C[i-1];

  for(j=n-1;j>=0;j--){
    B[C[A[j]]-1] = A[j];
    C[A[j]]--;
    /*for(i=0;i<n;i++) printf("%d ",B[i]);
      printf("\n");*/
  }
}



Measured memory_bytes: 17372
n,k=map(int,input().split())
A=[]
List=[0]*n
d=[0]*k
for i in range(k):
    d[i]=int(input())
    A.append(list(map(int,input().split())))
    for j in range(d[i]):
        if (List[A[i][j]-1]==0):
            List[A[i][j]-1]=1
    
print(n-sum(List))

Measured memory_bytes: 9164
#! -*- coding:utf-8 -*-

n = int(input())

a = []
b = []
for i in range(n):
    x,y = map(int,input().split())
    a.append(x)
    b.append(y)

x = min(a)
y = min(b)

a.sort()
b.sort(reverse = True)

print(a[-1] - a[0] + a[0] + b[-1])


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

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    if (abs(x - a) > abs(x - b)){
        cout << "B" << endl;
    }
    else {
        cout << "A" << endl;
    }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <memory>
#include <memory.h>
#include <fstream>
#include <cmath>
#include <math.h>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<double, double> Pd;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

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

int nums[] = {
	500, 100, 50, 10, 5, 1
};

int main(){
	int n;
	while(cin >> n && n){
		n = 1000 - n;
		int cnt = 0;
		rep(i, 6){
			cnt += n / nums[i];
			n %= nums[i];
		}
		cout << cnt << endl;
	}
	return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};

int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
int ddx[]={1,1,1,0,-1,-1,-1,0},ddy[]={1,0,-1,-1,-1,0,1,1};

ll mypow(ll x,ll n,ll m) {	//xのn乗をmで割った余り
	if(n==0) return 1;
	if(n%2==0) return mypow(x*x%m,n/2,m);
	else return x*mypow(x,n-1,m)%m;
}

//-----------------------------------------------------------------------------

int a,b;
string s;

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

	cin>>a>>b>>s;
	int i=0;
	while(i<a) {
		if(s[i]<'0'||s[i]>'9') {
			cout<<"No"<<endl;
			return 0;
		}
		i++;
	}
	if(s[i]!='-') {
		cout<<"No"<<endl;
		return 0;
	}
	i++;
	while(i<a+b+1) {
		if(s[i]<'0'||s[i]>'9') {
			cout<<"No"<<endl;
			return 0;
		}
		i++;
	}
	cout<<"Yes"<<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++)

using ll = long long;
using P = pair<int, int>;

const int mod = 998244353;

int main(int, char**)
{
    const int cut = 9;
    int n;
    cin >> n;
    vector<int> V(n+1), W(n+1);
    rep(i,n) cin >> V[i+1] >> W[i+1];

    int N = min(n, 1<<(cut+1) - 1);
    int M = 1e5;
    vector< vector<ll> > dp(N+1, vector<ll>(M+1));
    for(int i = 1; i <= N; i++) {
        rep(j,M+1) {
            if (j >= W[i]) dp[i][j] = max(dp[i/2][j], dp[i/2][j-W[i]] + V[i]);
            else dp[i][j] = dp[i/2][j];
        }
    }

    int q;
    cin >> q;

    vector<ll> ansv;
    rep(i,q) {
        int v, L;
        cin >> v >> L;
        vector<int> vs;
        while (v > N) {
            vs.push_back(v);
            v >>= 1;
        }
        ll ans = dp[v][L];
        int k = vs.size();
        vector<ll> sumw(1<<k), sumv(1<<k);
        rep (j,k) {
            int l = 1<<j;
            for (int l2 = l; l2 < l<<1; l2++) {
                sumw[l2] = sumw[l2 ^ l] + W[vs[j]];
                sumv[l2] = sumv[l2 ^ l] + V[vs[j]];
                if (sumw[l2] <= L) ans = max(ans, sumv[l2] + dp[v][L-sumw[l2]]);
            }
        }
        ansv.push_back(ans);
    }
    for (auto ans : ansv) cout << ans << endl;

    return 0;
}

Measured memory_bytes: 409144
def judge(x):
    cnt = 0
    
    for i in range(X):
        for j in range(Y):
            for k in range(Z):
                if A[i]+B[j]+C[k]<x:
                    break
                
                cnt += 1
                
                if cnt>=K:
                    return True
    
    return False

def binary_search():
    l, r = 0, 10**11
    
    while l<=r:
        mid = (l+r)//2
        
        if judge(mid):
            l = mid+1
        else:
            r = mid-1
    
    return r

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

border = binary_search()
l = []

for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if A[i]+B[j]+C[k]<=border:
                break
            
            l.append(A[i]+B[j]+C[k])

if len(l)<K:
    l += [border]*(K-len(l))

l.sort(reverse=True)

for li in l:
    print(li)

Measured memory_bytes: 45660
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

type Result string

const (
	Wa Result = "WA"
	Ac Result = "AC"
)

type AnswerByProblem struct {
	waCount int
	acCount int
	isAc    bool
	isWa    bool
}

func (abp *AnswerByProblem) AddAc() {
	abp.acCount++
	abp.isAc = true
}
func (abp *AnswerByProblem) AddWa() {
	abp.waCount++
	abp.isWa = true
}

type Submission struct {
	num    int
	result Result
}
type Answer struct {
	isAc    bool
	isWa    bool
	waCount int
}
type Answers map[int]*Answer

func (as *Answers) Add(sub Submission) {
	a, ok := (*as)[sub.num]
	if !ok {
		a = &Answer{}
		(*as)[sub.num] = a
	}
	switch sub.result {
	case Wa:
		if !a.isAc {
			a.isWa = true
			a.waCount++
		}
	case Ac:
		a.isAc = true
	}
}
func (as *Answers) Get() (correct, penalty int) {
	for _, a := range *as {
		if !a.isAc {
			continue
		}
		correct++
		if a.isWa {
			penalty += a.waCount
		}
	}
	return
}

func main() {
	n, m := nextInt(), nextInt()
	as := make(Answers, n)
	for i := 0; i < m; i++ {
		as.Add(Submission{nextInt(), Result(nextString())})
	}
	fmt.Println(as.Get())
}


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



int main() {
    int a, b;
    cin >> a >> b;
    if (a == 1) a = 14;
    if (b == 1) b = 14;
    string ans = "Draw";
    if (a > b) ans = "Alice";
    if (a < b) ans = "Bob";
    cout << ans << endl;
}

Measured memory_bytes: 256
import kotlin.comparisons.*
import java.util.*

const val MOD = 1000000007L

fun readI() = readLine()!!.toInt()
fun readL() = readLine()!!.toLong()
fun readD() = readLine()!!.toDouble()
fun readIs() = readLine()!!.split(' ').map(String::toInt)
fun readLs() = readLine()!!.split(' ').map(String::toLong)
fun readDs() = readLine()!!.split(' ').map(String::toDouble)

fun main(args: Array<String>) {
  val (n, m) = readIs()
  val ss = IntArray(m)
  repeat(m) {
    val ks = readIs()
    var s = 0
    for (i in 1..ks[0]) {
      s += 1 shl (ks[i] - 1)
    }
    ss[it] = s
  }
  val pp = readIs()
  var ans = 0
  next@for (i in 0 until (1 shl n)) {
    for (j in 0 until m) {
      val x = Integer.bitCount(i and ss[j])
      if (x % 2 != pp[j]) continue@next
    }
    ans++
  }
  println(ans)
}


Measured memory_bytes: 36648
//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <string>
//
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<double>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> d;
    rep(i, N)
    {
        ll dd;
        cin >> dd;
        d.push_back(dd);
    }
    ll total = 0;
    for (int i = 0; i < N-1; ++i)
    {
        for(int j=i+1;j<N;++j)
        {
            total += d[i] * d[j];
        }
    }
    cout << total;
    return 0;
}

Measured memory_bytes: 3192
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)
bool  Array_check(ll y, ll x,ll d,ll w) {
	if (x < 0 || x >= w || y<0 || y>=d) {
		return false;
	}
	else {
		return true;
	}
	
}

//小文字=大文字+32
int main() {
	ll n, m;
	cin >> n >> m;
	vector<ll>L(m), R(m);
	ll l = 1, r = n;
	rep(i, m) {
		cin >> L[i] >> R[i];

	}
	rep(i, m) {
		l = max(l, L[i]);
		r = min(R[i], r);

	}
	if ( r-l >= 0) {
		cout << r-l+1;
	}
	else {
		cout << 0;
	}
}


Measured memory_bytes: 4820
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
  
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}
  
/*------------------------------------------------------------------*/
int main(){
    ll x, y; cin >> x >> y;
    if(x > 0 and y > 0){
        if(abs(x) > abs(y)) cout << abs(x - y + 2) << endl;
        else cout << abs(x - y) << endl;
    }else if(x < 0 and y < 0){
        if(abs(x) < abs(y)) cout << abs(x - y + 2) << endl;
        else cout << abs(x - y) << endl;
    }else if(x == 0){
        if(y < 0) cout << abs(y) + 1 << endl;
        else cout << y << endl;
    }else if(y == 0){
        if(x < 0) cout << abs(x) << endl;
        else cout << abs(x) + 1 << endl;
    }else{
        cout << abs(x + y) + 1 << endl;
    } 
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 510


int V,E;
int capacity[NUM][NUM];

vector<int> G[NUM]; //グラフの隣接リスト表現
bool used[NUM]; //DFSですでに調べたかのフラグ

void add_edge(int from,int to){
	G[from].push_back(to);
	G[to].push_back(from);
	capacity[from][to] = 1;
	capacity[to][from] = 1;
}

//増加パスをDFSで探す
int dfs(int node_id,int sink,int flow){
	if(node_id == sink)return flow; //終点についたらflowをreturn
	used[node_id] = true;

	for(int i = 0; i < G[node_id].size(); i++){ //node_idから出ているエッジを調査
		int to = G[node_id][i];
		if(used[to] == false &&  capacity[node_id][to] > 0){ //エッジの先のノードに未訪問で、かつエッジに流す余裕がある場合
			int tmp_flow = dfs(to,sink,min(flow,capacity[node_id][to])); //流せるだけ流す
			if(tmp_flow > 0){ //流せた場合
				capacity[node_id][to] -= tmp_flow; //流した分、エッジの容量を削減する
				capacity[to][node_id] += tmp_flow; //逆辺の容量を、流した分だけ増加させる
				return tmp_flow;
			}
		}
	}
	return 0;
}


//sourceからsinkへの最大流を求める
int max_flow(int source,int sink,int limit){ //source:始点 sink:終点
	int flow = 0,add;
	while(limit > 0){ //増加パスが存在する限り、流量を追加し続ける
		for(int i = 0; i < V; i++)used[i] = false;
		add = dfs(source,sink,1);
		if(add == 0)break;
		flow += add;
		limit--;
	}
	return flow;
}


int main(){

	int N,E,Q;
	scanf("%d %d %d",&N,&E,&Q);

	V = N; //Vは、usedテーブルを初期化する際に使うだけなのでNとして良い

	int from,to;
	for(int loop = 0; loop < E; loop++){
		scanf("%d %d",&from,&to);
		from--;
		to--;
		add_edge(from,to);
	}

	int ans = max_flow(0,N-1,BIG_NUM);

	int command,A,B;

	for(int loop = 0; loop < Q; loop++){
		scanf("%d %d %d",&command,&A,&B);
		A--;
		B--;

		if(command == 1){
			add_edge(A,B);
		}else{ //削除命令

			//printf("capacity[A-B]:%d [B-A]:%d\n",capacity[A][B],capacity[B][A]);

			if(capacity[A][B] == 1 && capacity[B][A] == 1){ //使ってない場合
				//Do nothing :削除しても影響なし
			}else if(capacity[A][B] == 2){ //B→Aの方向に流れた場合
				if(max_flow(B,A,1) == 1){ //B→Aの別の経路がある場合
					//経路変更して流量は変わらず

				}else{ //B→Aに別の経路がない場合
					max_flow(N-1,0,1); //sink→sourceに押し戻す
					if(capacity[B][A] == 1){ //B→Aの流れが押し戻された場合
						//Do nothing
					}else{
						max_flow(B,A,1); //別の経路を探す
					}
					ans--;
				}
			}else{ //capacity[B][A] == 2 A→Bの方向に流れる場合

				//printf("Minhi!\n");

				if(max_flow(A,B,1) == 1){ //A→Bの別の経路がある場合
					//printf("別の経路あり\n");
					//経路変更して流量は変わらず
				}else{ //A→Bに別の経路がない場合
					max_flow(N-1,0,1); //sink→sourceに押し戻す
					if(capacity[A][B] == 1){ //A→Bの流れが押し戻された場合
						//Do nothing
						//printf("押しも度された\n");
					}else{
						max_flow(A,B,1); //別の経路を探す
						//printf("別のを探す\n");
					}
					ans--;
					//printf("ans:%d\n",ans);
				}
			}

			capacity[A][B] = 0;
			capacity[B][A] = 0;
		}

		ans += max_flow(0,N-1,1); //増加流量は最大1であるはず
		printf("%d\n",ans);
	}

	return 0;
}



Measured memory_bytes: 4400
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		long a = scanner.nextInt();
		long b = scanner.nextInt();
		long c = scanner.nextInt();
		
		long x = c-a-b;
		
		long y = x*x - 4*a*b;
		
		if((x>0)&&(y>0)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
	
}

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

int main(void){
    string a,b;
    cin>>a>>b;
    for(int i=0;i<a.length();i++){
        if(a[i]!=b[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
int main(void){
    int c1, c5, c10, c50, c100, c500, sum;
    cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;
     
    sum=c1 + c5 * 5 + c10 * 10 + c50 * 50 + c100 * 100 + c500 * 500;
    if(sum >= 1000){
        cout << 1 << endl;
    }
    else cout << 0 << endl;
    return 0;
}

/*
　硬貨の合計金額を求め，
　お札にできる（1000以上）なら「1」を返します。
*/


Measured memory_bytes: 3092
from math import gcd


def lcm(a, b):  # 最小公倍数
    return a * b // gcd(a, b)

A, B, C, D = map(int, input().split())

# A-1以下で、Cの倍数、Dの倍数、lcm(C,D)のそれぞれの個数
x = [(A - 1) // C, (A - 1) // D, (A - 1) // lcm(C, D)]
# B以下で、Cの倍数、Dの倍数、lcm(C,D)のそれぞれの個数
y = [B // C, B // D, B // lcm(C, D)]

# A-1以下で条件を満たす数
an = (A - 1) - (x[0] + x[1] - x[2])

# B以下で条件を満たす数
bn = B - (y[0] + y[1] - y[2])

print(bn - an)


Measured memory_bytes: 9132
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main(){
	int n,a[100],x,p,s;
	while(1){
		cin >> n >> x >> p;
		if((n==0)&&(x==0)&&(p==0)){
			return 0;
		}
		s=0;
		for(int i=0;i<n;i++){
			cin >> a[i];
			s+=a[i];
		}
		if(a[x-1]==0){
			s=0;
		}
		else{
			s=s*(100-p)/a[x-1];
		}
		cout << s <<"\n";	
	}
return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define mod2 1000000000
#define mod1 998244353
#define lol ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define F(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define ss second
int main()
{
    ll n,m;cin >> n >> m;
    ll k;cin >> k;
    ll ans = 0;
    vector <ll> sum1;
    vector <ll> sum2;
    ll sum = 0;
    sum1.pb(0);
    sum2.pb(0);
    for(ll i=0;i<n;i++)
    {
        ll x;cin >> x;
        sum = sum+x;
        sum1.pb(sum);
    }
    sum = 0;
    for(ll i=0;i<m;i++)
    {
        ll x;cin >> x;
        sum = sum+x;
        sum2.pb(sum);
    }
    for(ll i=0;i<=n;i++)
    {
        if(sum1[i]>k) break;
        ll k1 = k-sum1[i];
        ll r1 = (upper_bound(sum2.begin(), sum2.end(), k1) - sum2.begin());
        //cout << i << k1 << r1<< endl;
        ans = max(ans,i+r1-1);
    }
    for(ll i=0;i<=m;i++)
    {
        if(sum2[i]>k) break;
        ll k1 = k-sum2[i];
        ll r1 = (upper_bound(sum1.begin(), sum1.end(), k1) - sum1.begin());
        //cout << i << k1 << r1<< endl;
        ans = max(ans,i+r1-1);
    }
    cout << ans << endl;
}
    

Measured memory_bytes: 7928
def main():
    S  = input()
    K  = int(input())

    cnt = 0
    while cnt<len(S) and  S[cnt]=='1':
        cnt = cnt + 1
    
    if K<=cnt:
        print(S[0])
    elif cnt==len(S):
        print(S[cnt-1])
    else:
        print(S[cnt])


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int num = sc.nextInt();
    int oddCnt = 0;
    
    for(int i = 1; i <= num ; i++){
      if(i % 2 != 0){
        oddCnt++;
      }
    }
    System.out.println((double)oddCnt/num);
  }
}

Measured memory_bytes: 23252
d=list(map(int,input().split()))
q=int(input())

class dice(object):
	def __init__(self, d):
		self.d = d

	def roll(self,com):
		a1,a2,a3,a4,a5,a6=self.d
		if com=="E":
			self.d = [a4,a2,a1,a6,a5,a3]
		elif com=="W":
			self.d = [a3,a2,a6,a1,a5,a4]
		elif com=="S":
			self.d = [a5,a1,a3,a4,a6,a2]
		elif com=="N":
			self.d = [a2,a6,a3,a4,a1,a5]

dice1=dice(d)
l=[]
for i in range(q):
	l.append(list(map(int,input().split())))

c=["E","W","S","N"]
import random
for i in l:
	while 1:
		if dice1.d[0]==i[0] and dice1.d[1]==i[1]:
			break 
		else:
			dice1.roll(c[random.randint(1,2)])
	print(dice1.d[2])

Measured memory_bytes: 11636
#include<iostream>
#include<math.h>

using namespace std;

int main() {
	int N, D;
	cin >> N >> D;
	int X[10][10];
	int ans = 0;
	double root;
	int root2;
	int count = 0;
	for (int i = 0;i < N;i++) {
		for (int q = 0;q < D;q++) {
			cin >> X[i][q];
		}
	}
	for (int i = 0;i < N;i++) {
		for (int q = i+1;q < N;q++) {
			for (int w = 0;w < D;w++) {
				ans += (X[i][w] - X[q][w])*(X[i][w] - X[q][w]);
			}
			root = sqrt(ans);
			root2 = root;
			/*cout << root*root << endl;
			cout << ans << endl;*/
			if (root2 * root2 == ans) {
				count++;
			}
			ans = 0;
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
char a[501][501];
int b[501][501];
int main()
{
	int h,x,i,j;
	cin>>h>>x;
	for(i=1;i<=h;i++)
	for(j=1;j<=x;j++)
	{
		cin>>a[i][j];
		if(a[i][j]=='#')
		b[i][j]=-1;
	}
	for(i=1;i<=h;i++)
	{
		for(j=1;j<=x;j++)
		{
			if(a[i][j]=='.')
			{
				if(a[i-1][j]=='#') b[i][j]++;
                if(a[i-1][j-1]=='#') b[i][j]++;
       			if(a[i-1][j+1]=='#') b[i][j]++;
      			if(a[i][j-1]=='#') b[i][j]++;
      			if(a[i][j+1]=='#') b[i][j]++;
      			if(a[i+1][j-1]=='#') b[i][j]++;
      			if(a[i+1][j]=='#') b[i][j]++;
      			if(a[i+1][j+1]=='#') b[i][j]++;
			}
		}
	}
	for(i=1;i<=h;i++)
	{
		for(j=1;j<=x;j++)
		{
			if(b[i][j]==-1)
			{
				cout<<'#';
				continue;
			}
			cout<<b[i][j];
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		if(s.charAt(0) == s.charAt(2)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 22740
#include<iostream>
#include<vector>

using namespace std;

int main(){
int time[3]={0};
int indices[6][2]={{0,1},{0,2},
                  {1,0},{1,2},
                  {2,0},{2,1}};
int min=10000;

cin>>time[0]>>time[1]>>time[2];

for(int i=0;i<6;i++){
    if(min>time[indices[i][0]]+time[indices[i][1]]){
        min=time[indices[i][0]]+time[indices[i][1]];
    }
}

cout<<min<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException {

		final String inputLine;
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			inputLine = br.readLine();
		}

		final Integer n = Integer.valueOf(inputLine);
		List<Integer> list = new ArrayList<>();

		for(int i = 3; i <= n; i++) {
			if(i % 3 == 0) {
				list.add(i);
				continue;
			}

			int quotient = i;
			while(quotient != 0) {
				if(quotient % 10 == 3) {
					list.add(i);
					break;
				} else {
					quotient /= 10;
				}
			}
		}

		StringBuilder result = new StringBuilder();
		for(Integer i : list) {
			result.append(" " + i);
		}

		System.out.println(result);
	}
}


Measured memory_bytes: 26464
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
using namespace std;

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
	int sum = 0;
	vector<int> vec_1(4); vector<int> vec_2(2);
	for (int i = 0; i < 4; i++) cin >> vec_1[i];
	for (int i = 0; i < 2; i++) cin >> vec_2[i];
	sort(vec_1.begin(), vec_1.end(), greater<int>());
	sort(vec_2.begin(), vec_2.end(), greater<int>());
	for (int i = 0; i < 3; i++) sum += vec_1[i];
	for (int i = 0; i < 1; i++) sum += vec_2[i];
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3144
//2020.2.1
//s1270188 xxxmk2
//alds1_13b

#include<stdio.h>
#include<stdlib.h>
#define N 3
#define D 100

//struct
struct node{
  int data[N][N];
  struct node *p;
};
struct xy{
  int x;
  int y;
};

//global
struct node root;
int mv[4][2]={0,1,0,-1,-1,0,1,0};//上下左右 xy

//function
int man(int n,int x,int y){
  int nx, ny;

  nx=(n-1)%N;
  ny=(n-1)/N;
  
  x=x-nx;
  if(x<0) x*=-1;

  y=y-ny;
  if(y<0) y*=-1;
  
  return x+y;
}

int judge(struct node *n){
  int i, j=0;

  if(n==NULL) return -1;
  
  for(i=0;i<N*N;i++){
    if(n->data[i%N][i/N]==0) continue;
    if(n->data[i%N][i/N]!=i+1) j+=man(n->data[i%N][i/N],i%N,i/N);
  }

  return j;
}

struct xy blank(struct node *n){
  struct xy ddd;
  int i;

  for(i=0;i<N*N;i++)
    if(n->data[i%N][i/N]==0) break;

  ddd.x=i%N;
  ddd.y=i/N;
  
  return ddd;
}

struct node *mk(struct node *n,struct xy b, struct xy m){
  struct node *aaa;
  int i;
  
  aaa=malloc(sizeof(struct node));

  for(i=0;i<N*N;i++) aaa->data[i%N][i/N]=n->data[i%N][i/N];
  
  aaa->data[b.x][b.y]=aaa->data[m.x][m.y];
  aaa->data[m.x][m.y]=0;
  aaa->p=n;
  
  return aaa;
}


int puzzle(struct node *n,struct node *bp, int g,int d){
  int h=judge(n), i, j;
  struct xy bl, m;
  struct node *mm;
  
  if(h==0) return g;

  if(g+h>d) return -1;
  
  bl=blank(n);
  
  for(i=0;i<4;i++){
    m.x=bl.x+mv[i][0];
    m.y=bl.y+mv[i][1];

    if(m.x<0 || m.y<0 || m.x==N || m.y==N ) continue;
    
    mm=mk(n,bl,m);
    if(bp!=NULL){
      for(j=0;j<N*N;j++)
	if(mm->data[j%N][j/N]!=bp->data[j%N][j/N]) break;
      if(j==N*N){
	free(mm);
	continue;
      }
    }
    
    j=puzzle(mm,mm->p,g+1,d);
    if(j>0) return j;
  }

  return -1;
}

int main(){
  int i, ans;
  struct node *n, *m;
  
  //input
  for(i=0;i<N*N;i++) scanf("%d",&root.data[i%N][i/N]);
  root.p=NULL;
  
  for(i=judge(&root);i<=D;i++){
    ans=puzzle(&root,NULL,0,i);

    if(ans>0) break;
  }
  
  //output
  printf("%d\n",ans);

  return 0;
}



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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int tot = 0;
		if(X == 1) tot += 300000;
		if(X == 2) tot += 200000;
		if(X == 3) tot += 100000;
		if(Y == 1) tot += 300000;
		if(Y == 2) tot += 200000;
		if(Y == 3) tot += 100000;
		if(X == 1 && Y == 1) tot += 400000;
		
		Console.WriteLine(tot);
	}
	int X,Y;
	public Sol(){
		var d = ria();
		X = d[0]; Y = d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13140
n = int(input())
ba_list = []
for i in range(n):
    ba_tmp = list(map(int, input().split()))
    ba_list.append([ba_tmp[1], ba_tmp[0]])
ba_list.sort()
now_time = 0
for i in range(n):
    now_time += ba_list[i][1]
    if now_time > ba_list[i][0]:
        print('No')
        exit()
print('Yes')

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll r;
    cin >> r;
    cout << r * r << endl;
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>

using namespace std;

int main(){
    while(1){
        int cand, boul;
        cin >> cand >> boul;
        if(cand==0 && boul==0) break;
        
        int turn = 0;
        int allstone = boul;
        vector<int> stone(50,0);
        
        while(1){
            if(boul == 0){
                if(stone[turn] == allstone){
                    cout << turn << endl;
                    break;
                }else{
                    boul = stone[turn];
                    stone[turn] = 0;
                }
            }else{
                stone[turn]++;
                boul--;
            }
            turn = (turn+1)%cand;
        }
    }
            
    return 0;
}

Measured memory_bytes: 3100
S=input()

for i in range(0, len(S)):
    if ((i % 2) == 0) and (S[i] == 'L'):
        print('No')
        exit(0)
    if ((i % 2) == 1) and (S[i] == 'R'):
        print('No')
        exit(0)

print('Yes')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
//debug
#ifdef grief
#define debug(...) do{\
	fprintf(stderr , "%s - %d : (%s) = " , __PRETTY_FUNCTION__ , __LINE__ , #__VA_ARGS__ );\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){
	cerr<<x<<endl;
}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){
	cerr<<x<<" , ";
	_DO(tail...);
}
#else
#define debug(...)
#endif
//type
typedef long long ll;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef priority_queue<pll,vector<pll>,greater<pll> > heap;
//macro
#define SZ(x) ((ll)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define F first
#define S second
#define mkp make_pair
#define pb push_back
const ll INF=1e9;
const ll MAX=1e5+5;
const ll MOD=1e9+7;
//}}}
ll x[MAX],y[MAX];
ll C,c;
int main(){
	//ios_base::sync_with_stdio(0); cin.tie(0);
	ll a,b;
	cin>>a>>b;
	for(ll i=1;i<=a;i++)
		cin>>x[i];
	for(ll i=1;i<=b;i++){
		cin>>y[i];
		c+=y[i]+MOD; c%=MOD;
		C+=(y[i]+MOD)*i; C%=MOD;
	}
	c%=MOD; C%=MOD;
	ll ans=0;
	for(ll i=1;i<=a;i++){
		ll r=0;
		r+=(4*i*C)%MOD; r%=MOD;
		r+=MOD-(2*i*c)%MOD; r%=MOD;
		r+=MOD-(2*C)%MOD;r%=MOD;
		r+=MOD-(2*i*b%MOD*c)%MOD;r%=MOD;
		r+=MOD-(2*a*C)%MOD; r%=MOD;
		r+=(a+1)*(b+1)%MOD*c%MOD;r%=MOD;
		ans+=r*(x[i]+MOD)%MOD;
		ans%=MOD;
	}
	cout<<ans<< '\n';
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    cout << min(N % K, K - N % K) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main() {
    int a, b, x;
    double answer;
    cin >> a >> b >> x;
    if (0.5 * a * a * b >= 1.0 * x) {
        answer = atan2(1.0 * a * b * b, 2.0 * x);
    } else {
        answer = atan2(2.0 * b - (2.0 * x / a / a), a);
    }
    cout << setprecision(10) << answer / M_PI * 180.0 << endl;
}


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

using namespace std;

#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); i++)
#define re return
#define fi first
#define se second
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define sqrt(x) sqrt(abs(x))
#define y0 y3487465
#define y1 y8687969
#define j0 j5743892
#define j1 j542893
#define prev PREV
#define next NEXT
                         
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double D;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<vi> vvi;

template<class T> T abs(T x) { re x > 0 ? x : -x; }
template<class T> T gcd(T a, T b) { re a ? gcd (b % a, a) : b; }
template<class T> T sqr(T a) { re a * a; }
template<class T> T sgn(T a) { re a > 0 ? 1 : (a < 0 ? -1 : 0); }

#define filename ""

int n;
int m;
string s;

int main () {
	cin >> s;
	for (int i = 0; i + 1 < sz (s); i++)
		if (s[i] == 'A' && s[i + 1] == 'C') {
			printf ("Yes\n");
			re 0;
		}
	printf ("No\n");
	return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for i in range(n):
    if a[i] in d:
        d[a[i]] = d[a[i]] + 1
    else:
        d[a[i]] = 1

ans = 0
diverse = len(d)
d = sorted(d.items(), key = lambda x:x[1])

for i in range(len(d)):
    if diverse > k:
        ans += d[i][1]
        diverse -= 1
    else:
        break
print(ans)

Measured memory_bytes: 40092
#include<stdio.h>
#define WHITE 1
#define BLACK 2
#define GRAY 3
#define INFTY -1

int Q[100];
int head=0,tail=0;
int color[100],d[100];
int M[100][100];
int n;

void bfs(int);
void enqueue(int);
int dequeue(void);

int main(){
  int i,j,u,v,k;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    if(k!=0){
      for(j=1;j<=k;j++){
	scanf("%d",&v);
	v--;
	M[u][v]=1;
      }
    }
  }

  bfs(0);

  for(i=0;i<n;i++){
    printf("%d %d\n",i+1,d[i]);
  }
  
  return 0;

}  

void enqueue(int x){
  Q[tail]=x;
  tail++;
}

int dequeue(){
  int y=Q[head];
  head++;
  return y;
}


void bfs(int s){
  int i,u,v;
  for(i=0;i<n;i++){
    color[i]=WHITE;
    d[i]=INFTY;
  }
  color[s]=GRAY;
  d[s]=0;
  enqueue(s);
  while(head!=tail){
    u=dequeue();
    for(v=0;v<n;v++){
      if(M[u][v]==1&&color[v]==WHITE){
	color[v]=GRAY;
	d[v]=d[u]+1;
	enqueue(v);{
	  if(M[u][v]==1&&color[v]==WHITE){
	    color[v]=GRAY;
	    d[v]=d[u]+1;
	    enqueue(v);
	  }
	}
      }
    }
    color[u]=BLACK;
  }
}



Measured memory_bytes: 2108
#include<stdio.h>
int ta[200010],nt[400010],to[400010],cc[400010];
long long u[200010],ANS[200020],ans[200020];
int mbk(long long a,int n,int m){return n?(mbk((a*a)%m,n/2,m)*(n%2?a:1))%m:1;}
int inv(int a,int m){return mbk((long long)a,m-2,m);}
long long pp[200010],ip[200010],M=1e9+7;
int f(int s){//printf("!%d\n",s);
  long long i;
  u[s]=1;
  for(i=ta[s];i+1;i=nt[i]){
    if(u[to[i]])continue;
    ans[s]=ans[s]*f(to[i])%M;
    cc[s]+=cc[to[i]];
  }
  ans[s]=ans[s]*inv(cc[s],M)%M;
  return ans[s];
}
void h(int s,int t){
  ans[s]=ans[s]*cc[s]%M*inv(ans[t],M)%M;
  ans[t]=ans[t]*cc[t]%M;
  cc[s]-=cc[t];
  cc[t]+=cc[s];
  ans[s]=ans[s]*inv(cc[s],M)%M;
  ans[t]=ans[t]*inv(cc[t],M)%M*ans[s]%M;
}
void g(int s){//printf("!!%d %d\n",s,cc[s]);
  int i;
  u[s]=2;
  ANS[s]=ans[s];
  for(i=ta[s];i+1;i=nt[i]){
    if(u[to[i]]==2)continue;
    //printf("%d %d %d %d %lld %lld\n",s,to[i],cc[s],cc[to[i]],ans[s],ans[to[i]]);
    h(s,to[i]);
    //printf("%d %d %d %d %lld %lld\n",s,to[i],cc[s],cc[to[i]],ans[s],ans[to[i]]);
    g(to[i]);
    h(to[i],s);
  }
}
int main(){
  int n,a,b,i;
  scanf("%d",&n);
  for(i=0;i<=n;i++)ta[i]=-1;
  pp[0]=1;
  for(i=1;i<=n;i++)pp[i]=(pp[i-1]*i)%M;
  for(i=0;i<=n;i++)ip[i]=inv(pp[i],M);
  for(i=1;i<=n;i++)ans[i]=cc[i]=1;
  for(i=0;i<n-1;i++){
    scanf("%d %d",&a,&b);
    nt[i    ]=ta[to[i+n-1]=a];
    nt[i+n-1]=ta[to[i    ]=b];
    ta[b]=i+n-1;
    ta[a]=i;
  }
  f(1);
  //for(i=0;i<=10;i++)printf("%lld\n",pp[i]);printf("\n");
  //for(i=0;i<=n;i++)printf("%d\n",cc[i]);
  //printf("%d\n",f(1));
  //for(i=0;i<=n;i++)printf("%d\n",cc[i]);
  //for(i=1;i<=n;i++)printf("%3d ",i);printf("\n");
  //for(i=1;i<=n;i++)printf("%3lld ",ans[i]);printf("\n");
  //for(i=1;i<=n;i++)printf("%3d ",cc[i]);printf("\n");
  g(1);
  for(i=1;i<=n;i++)printf("%lld\n",ANS[i]*pp[n]%M);
  return 0;
}


Measured memory_bytes: 15360
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace abc167
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
            solve_abc167B();
            Console.Out.Flush();
        }

        public static void solve_abc167B()
        {
            long[] abck = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
            long a = abck[0];
            long b = abck[1];
            long c = abck[2];
            long k = abck[3];
            long max = Math.Min(a, k) - Math.Max(0, (k - a) - b);
            Console.WriteLine(max);
        }

        public static void solve_abc167A()
        {
            string a = Console.ReadLine();
            string b = Console.ReadLine();
            Console.WriteLine(a.Equals(b.Substring(0, b.Length - 1)) ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 28480
W, H, N = map(int, input().split())

max_x = 0
max_y = 0
min_x = W
min_y = H
for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        max_x = max(max_x, x)
    elif a == 2:
        min_x = min(min_x, x)
    elif a == 3:
        max_y = max(max_y, y)
    else:
        min_y = min(min_y, y)

# print(max_x, max_y)
# print(min_x, min_y)
if(min_x > max_x) and (min_y > max_y):
    print((min_x - max_x) * (min_y - max_y))
else:
    print(0)


Measured memory_bytes: 9196
# 和の期待値は期待値の和
# それぞれ期待値を出したあとは大きさKの区間和の最大値
# n(n+1)/2
n, k = map(int, input().split())
p = []
for x in list(map(int, input().split())):
    p.append((x * (x + 1) // 2) / x)

ans = 0
tmp = 0
for i in range(n):
    tmp += p[i]
    if i >= k:
        tmp -= p[i - k]
    ans = max(ans, tmp)

print(ans)

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

int main() {
    double r;
    cin >> r;
    
    printf("%.6f %.6f\n", (3.141592653589 * r * r), (3.141592653589 * r * 2));
}


Measured memory_bytes: 3208