akhauriyash/Code-Regression huggingface dataset:
from math import ceil, floor

K = int(input())
As = list(map(int, input().split()))

L = 2
R = 2
for A in reversed(As):
    if R // A * A < L:
        print('-1')
        exit()
    L = ceil(L / A) * A
    R = floor(R / A) * A + A - 1

print(L, R)


Measured memory_bytes: 15020
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    s = S()
    if s[-1] == 's':
        s += 'es'
    else:
        s += 's'
    print(s)

main()



Measured memory_bytes: 82892
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <map>

using namespace std;

int main(){
  int i,j,k,n,m;
  cin >> n;
  int v[n];
  int m1[100006]={},m2[100006]={};
  int m1m=0,m2m=0;
  for(i=0;i<n;i++){
    cin >> v[i];
    if(i%2==0)m1[v[i]]++;
    else m2[v[i]]++;
  }
  for(i=0;i<100001;i++){
    if(m1[m1m]<m1[i])m1m=i;
    if(m2[m2m]<m2[i])m2m=i;
  }
  sort(m1,m1+100002);
  reverse(m1,m1+100002);
  sort(m2,m2+100002);
  reverse(m2,m2+100002);
  if(m1m!=m2m){
    cout << n-m1[0]-m2[0] << endl;
  }else{
    cout << n-max(m1[0]+m2[1],m1[1]+m2[0]) << endl;
  }
  return 0;
}


Measured memory_bytes: 1408
def main():
    n = int(input())
    a = list(map(int, input().split()))
    d = {}
    for i, num in enumerate(a, start=1):
        d[num] = i
    lst = []
    for _, num in sorted(d.items()):
        lst.append(num)
    print(*lst, sep=" ")


if __name__ == "__main__":
    main()


Measured memory_bytes: 72104
def f(a,d,T):
    try:
        return T[d:].index(a)+d
    except ValueError:
        return len(T)

from random import randint
A=26

D=int(input())

C=[0]+list(map(int,input().split())) #減る満足度のベース
S=[0]*(D+1) #S[d][i] :(d+1)日目にコンテストiを開催した時の満足度

for i in range(1,D+1):
    S[i]=[0]+list(map(int,input().split()))

T=[0]
for i in range(D):
    T.append(int(input()))

L=[[0]*(A+1) for _ in range(D+1)]

for x in range(1,D+1):
    t=T[x]
    for j in range(1,A+1):
        if t!=j:
            L[x][j]=L[x-1][j]+1
        else:
            L[x][j]=0
            
X=0
for d in range(1,D+1):
    X+=S[d][T[d]]    
    for j in range(1,A+1):
        X-=C[j]*L[d][j]

M=int(input())
for _ in range(M):
    d,q=map(int,input().split())
    p=T[d]

    a=f(p,d+1,T)
    b=f(q,d+1,T)
    
    Y=0
    h=L[d-1][p]
    for i in range(d,a):
        h+=1
        Y+=h-L[i][p]
        L[i][p]=h
        
    m=0
    Z=0
    for j in range(d,b):
        Z-=m-L[j][q]
        L[j][q]=m
        m+=1

    X+=(S[d][q]-S[d][p])+Z*C[q]-Y*C[p]
    print(X)

    T[d]=q


Measured memory_bytes: 84832
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_9_B
#???????????? 17:55~

def maxHeapify(heap, index):
    left_index = 2 * index
    right_index = 2 * index + 1
    largest_index = index
    
    if left_index < len(heap) and heap[left_index] > heap[index]:
        largest_index = left_index

    if right_index < len(heap) and heap[right_index] > heap[largest_index]:
        largest_index = right_index

    if largest_index != index:
        heap[index], heap[largest_index] = heap[largest_index], heap[index]
        maxHeapify(heap, largest_index)
    
def main():
    n_node = int(input())
    target_list = [""] + [int(n) for n in input().split()]
    for i in range(1, int(len(target_list) / 2) + 1)[::-1]:
        maxHeapify(target_list, i)
        
    print(*target_list)
if __name__ == "__main__":
    main()

Measured memory_bytes: 65916
#include<bits/stdc++.h>
#define re register
#define ll long long
using namespace std;
inline ll read(){
	ll sum=0;int k=1;
	char c=getchar();
	for(;c<'0' || c>'9';c=getchar()) if(c=='-') k=-1;
	for(;c>='0' && c<='9';c=getchar()) sum=sum*10+c-48;
	return sum*k;
}
int n;
const int N=2e5+10,inf=2e9;
struct Ball{
	int x,y;
	bool operator<(const Ball &qwq)const{
		return x<qwq.x;
	}
}a[N];
ll ans;
multiset<int> R,W;
inline ll calc(){
	return 1ll*(*(--R.end())-*R.begin())*(*(--W.end())-*W.begin()); 
}
int main(){
	n=read();
	for(re int i=1;i<=n;++i){
		int x=read(),y=read();
		if(x>y) swap(x,y);
		a[i]=(Ball){x,y};
		R.insert(x);W.insert(y);
	}
	ans=calc();
	sort(a+1,a+n+1);
	for(re int i=1;i<=n;++i){
		int x=a[i].x,y=a[i].y;
		R.erase(R.find(x));W.insert(x);
		W.erase(W.find(y));R.insert(y);
		ans=min(ans,calc());
	}
	cout<<ans;
	return 0;
}
/*
3 815 6901 3839 178 199 10007 

*/

Measured memory_bytes: 20608
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
    using namespace std;
 
    int main(){
      int n;
      cin >> n;
      if(n/100==n%10) cout << "Yes" << endl;
      else cout << "No" << endl;
      return 0;}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <math.h>

#define MOD 1000000007
#define REP(i,n) for ((i)=0;i<(n);i++)
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define LL long long
#define ULL unsigned long long



int main(void) {
	char s[11],ans[11];
	int i,j;

	scanf("%s", &s);

	j=0;
	for(i=0;s[i]!='\0';i++){
		if(s[i]=='B'){
			if(j!=0){
				j--;
			}
		}else{
			ans[j]=s[i];
			j++;
		}
	}

	ans[j]='\0';
	printf("%s\n", ans);

	return 0;
}

/* 最後の改行忘れるな！！ */


Measured memory_bytes: 128
import java.util.Scanner;

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

        int counter = 0;
        for (int i = 1; i <= N; i++) {
            double x = scanner.nextInt(), y = scanner.nextInt();
            double dist = Math.sqrt(x * x + y * y);
            if (dist <= D) {
                counter++;

            }

        }
        System.out.println(counter);
    }
}


Measured memory_bytes: 59280
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    double a[n],ave=0,s=0;
    for(int i=0;i<n;i++){
      cin>>a[i];
      ave+=a[i];
    }ave/=(double)n;
    for(int i=0;i<n;i++)s+=pow(a[i]-ave,2);
    s/=(double)n;
    s=sqrt(s);
    printf("%.10f\n",s);
  }
}


Measured memory_bytes: 3200
# -*- coding: utf-8 -*-
from math import ceil
from math import floor
from math import sqrt

def next(c):
    return chr(ord(c)+1)

def step(N, pred, c, cur_max): 
    cur_max = chr(max(ord(c), ord(cur_max)))
    if N == 1:
        return [pred + c]
    else:
        ret = []
        for elem in range(ord('a'), ord(cur_max)+2):
            ret = ret + step(N-1, pred + c, chr(elem), cur_max)
        
        return ret

if __name__ == '__main__':
    input_line = 1
    for i in range(input_line):
        s = input().rstrip().split(' ')
        a = int(s[0])
        ret = step(a, "", 'a', 'a')
        for elem in ret:
            print(elem)


Measured memory_bytes: 12800
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
	
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		
		ArrayList<Integer> div = new ArrayList<>();
		
		int c = Math.min(a, b);
		for(int i = 1; i <= c; i++) {
			if((a % i == 0) && (b % i == 0)) div.add(i);
		}
		
		Collections.sort(div, Collections.reverseOrder());
		System.out.println(div.get(k-1));
		
		sc.close();
	}
 
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int num[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
bool uru(int checkyear){if(checkyear%4==0){if(checkyear%100!=0||checkyear%400==0)return true;}return false;}
int gcd( int x, int y ){return y ? gcd(y, x%y) : x;}
signed main() {
    int x=0,y=0,z=0,w=0,n=0,m=0;
    std::cin >>x>>y;
    if((x+y)%2==0)cout<<(x+y)/2;
    else cout << (x+y+2)/2;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
#A
import sys
#sys.setrecursionlimit(100000)

tmp = input().split()
m,d = list(map(lambda a: int(a), tmp))

#print("m:{} d:{}".format(m,d))

ans=0
for i in range(1,m+1):
#	print("i:{}".format(i))
	for j in range(1,d+1):
		d10=j//10
		d1=j%10
		if((d1>=2)and(d10>=2)and(d1*d10==i)):
			ans+=1
#			print(d10)
#			print(d1)

print(ans)

Measured memory_bytes: 3060
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val d = sc.nextInt()
    val c = Array(26) { sc.nextInt() }
    val s = Array(d) { Array(26) { sc.nextInt() } }
    val t = Array(d) { sc.nextInt() }
    val last = Array(26) { -1 }
    var score = 0L
    for (i in 0 until d) {
        score += s[i][t[i] - 1]
        last[t[i] - 1] = i
        for (j in 0 until 26) {
            score -= c[j] * (i - last[j])
        }
        println(score)
    }
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 35796
#include<stdio.h>
#define MAX 100000

int main(){
  int n,i,X[MAX];
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&X[i]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,X[i]);
    if(i/2>=1)printf("parent key = %d, ",X[i/2]);
    if(i*2<=n)printf("left key = %d, ",X[i*2]);
    if(i*2+1<=n)printf("right key = %d, ",X[i*2+1]);
    printf("\n");
  }
  return 0;
}
  



Measured memory_bytes: 2048
l = int(input())
l -= 1
to = [[] for _ in range(14)]
for i in range(1, 13):
    to[i].append((i + 1, 0 * 3 ** (12 - i)))
    to[i].append((i + 1, 1 * 3 ** (12 - i)))
    to[i].append((i + 1, 2 * 3 ** (12 - i)))
d = []
l_upto = []
t = l
s = 0
for i in range(13):
    d.append(t % 3)
    s += (t % 3) * 3 ** i
    l_upto.append(s)
    t //= 3

for i, t in enumerate(d):
    for s in range(t + (i == 0)):
        to[0].append((13 - i, l - l_upto[i] + 3 ** i * s))
print(14, sum(map(len, to)))
for i in range(len(to)):
    for j, cost in to[i]:
        print(i + 1, j + 1, cost)



Measured memory_bytes: 9256
// #includes {{{
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cmath>
using namespace std;
// }}}
// pre-written code {{{
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

const int INF=0x3f3f3f3f;

typedef long long Int;
typedef unsigned long long uInt;
#ifdef __MINGW32__
typedef double rn;
#else
typedef long double rn;
#endif

typedef pair<int,int> pii;

/*
#ifdef MYDEBUG
#include"debug.h"
#include"print.h"
#endif
*/
// }}}

int N,T;
int A[100010];

int main(){
	cin>>N>>T;
	REP(i,N)cin>>A[i];
	map<int,int> mp;
	int d = -INF;
	REP(i,N){
		if(i>0){
			d = max(A[i]-mp.begin()->first,d);
		}
		mp[A[i]]++;
	}
	int one = 0, rec = 0;
	mp.clear();
	REP(i,N){
		if(i>0){
			int t = A[i] - mp.begin()->first;
			if(d==t){
				if(mp.begin()->second==1){
					one++;
				}else{
					rec++;
				}
			}
		}
		mp[A[i]]++;
	}
	mp.clear();
	int send = 0;
	for(int i = N-1;i>=0;i--){
		if(i!=N-1){
			map<int,int>::iterator it = mp.end();
			it--;
			int t = it->first - A[i];
			if(d==t){
				if(it->second>2){
					send++;
				}
			}
		}
		mp[A[i]]++;
	}
	cout<<one+rec+send<<endl;
}


Measured memory_bytes: 5376
#include<iostream>
using namespace std;
int main(){
  int N,K;
  int cnt=0;
  cin>>N>>K;
  for(int i=0; i<N; i++){
    int h;
    cin>>h;
    if(h>=K){
      cnt++;
    }
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

int main(){
  int n;
  cin>>n;
  set<int>  nums;

  rep(i,n){
    int d;
    cin>>d;
    if(nums.count(d)) nums.erase(d);
    else nums.insert(d);
  }

  cout << nums.size() << endl;

  return 0;
}


Measured memory_bytes: 4864
n=int(input())
v=list(map(int,input().split()))
even=[]
odd=[]
for i in range(n):
  if i%2==0:
    even.append(v[i])
  else:
    odd.append(v[i])
from collections import Counter
even=Counter(even)
odd=Counter(odd)

even=sorted(even.items(),key=lambda x:x[1],reverse=True)
odd=sorted(odd.items(),key=lambda x:x[1],reverse=True)

a=even[0]
if a[1]==n//2:
  b=0
else:
  b=even[1][1]
  
c=odd[0]
if c[1]==n//2:
  d=0
else:
  d=odd[1][1]
  
if a[0]==c[0]:
  print(min(n-a[1]-d,n-b-c[1]))
else:
  print(n-a[1]-c[1])
  
  
  


Measured memory_bytes: 105960
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
using namespace std;
//
const int inf=1e9+7;
//
int main(){
	int A,B;
	cin>>A>>B;
	if(A%2==0||B%2==0){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int N=100005;
int n,k,f[N];
long long m;
struct note{
	int x,y,c;
}a[N];
bool cmp(note x,note y){
	return x.c<y.c;
}
int find(int x){
	if (f[x]==x) return x;
	f[x]=find(f[x]);
	return f[x];
}
int main(){
	scanf("%d%lld%d",&n,&m,&k);
	for (int i=1;i<=k;i++){
		scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].c);
		if (a[i].c && m==n-1){
			puts("No");
			return 0;
		}
	} 
	for (int i=0;i<n;i++) f[i]=i;
	std::sort(a+1,a+k+1,cmp);
	for (int i=1;i<=k;i++){
		int fx=find(a[i].x),fy=find(a[i].y);
		if (a[i].c){	
			if (fx==fy){
				puts("No");
				return 0;
			}
		}else{
			f[fx]=fy;
		}
	}
	int cnt=0;
	if (m==n-1) {
		puts("Yes");return 0; 	
	}
	for (int i=0;i<n;i++) if (find(i)==i) cnt++;
	if (n-cnt+1ll*cnt*(cnt-1)/2<m || cnt==2 ) puts("No");
	else puts("Yes");
}

Measured memory_bytes: 1792
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    char[] a = sc.next().toCharArray();
    Arrays.sort(a);
    if((new String(a)).equals("abc")){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

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

int main() {
    int x;
    cin >> x;
    if(x == 0) cout << 1 << endl;
    else if(x == 1) cout << 0 << endl;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> a(n,0);
	for(int i=1;i<n;i++)
	{
		int c;
		cin >> c;
		a.at(c-1)++;
	}
	for(int i =0;i<n;i++)
	{
		cout << a.at(i) << endl;
	}
	return 0;
}


Measured memory_bytes: 4052
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N, M = read_ints()
    H = read_ints()
    is_good = [True]*N
    for _ in range(M):
        a, b = read_ints()
        a -= 1
        b -= 1
        if H[a] >= H[b]:
            is_good[b] = False
        if H[a] <= H[b]:
            is_good[a] = False
    return is_good.count(True)


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 20120
#include<bits/stdc++.h>
using namespace std;
 
int n;
int c=0;
 
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    if(s=="A")c++;
    else{
      c--;
      if(c<0){
        cout<<"NO"<<endl;
        return 0;
      }
    }
  }
  cout<< (c==0?"YES":"NO") <<endl;
  return 0;
}

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

int main(void){
  int A, B, C, K;
  cin >> A >> B >> C >> K;

  int ans;
  if(K <= A){
    ans = K;
  }else if(A < K && K <= A + B){
    ans = A ;
  }else if(A + B < K){
    ans = A - (K - A - B);
  }
  cout << ans << endl;
}



Measured memory_bytes: 3636
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;

#ifndef LOCAL
#pragma GCC optimize ("O2")
#define endl '\n'
#endif

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

ll pwr(ll a,ll b, ll mod){
    a %= mod;
    int ans = 1;
    while(b){
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

const int N = 2e5 + 5;
int a[N];
void solve(){
	int n;
	cin >> n;
	fr(i, 1, n){
		cin >> a[i];
		a[i] -= i;
	}
	sort(a + 1, a + n + 1);
	int val = a[(n + 1) / 2];
	int ans = 0;
	fr(i, 1, n){
		ans += abs(a[i] - val);
	}
	cout << ans;
}
signed main(){
    IO;
    #ifdef LOCAL
        freopen("inp.txt","r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    cout << setprecision(10) << fixed;
    int t = 1;
    // cin >> t;
    fr(tt, 1, t){
        solve();
    }
    return 0;
}

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

using namespace std;

    // always declare big array here it's safer for stack than inside of main

    bool isRight(int a , int b , int c){
        a = a * a;
        b = b * b;
        c = c * c;

        return a == b + c || b == a + c || c == a + b;
    }

int main(){

         // cin.sync_with_stdio(0); to speed input but scanf and printf faster
         // cin.tie(0);             not use scanf after that and not use endl but \n

         // element before me is (i - 1) * m + m - 1

		 ios_base::sync_with_stdio(false);
		 cin.tie(NULL);
		 cout.tie(NULL);

         int n;
         cin >> n;

         while(n--){
            int x , y , z;
            cin >> x >> y >> z;

            if(isRight(x , y , z))
                cout << "YES" << endl;
            else cout << "NO" << endl;
         }

    return 0;
}



Measured memory_bytes: 3180
#include <iostream>

using namespace std;

int apples;
int pieces;

int main() {
    cin >> apples >> pieces;
    int total_pieces = pieces + apples*3;
    int result = 0;
    while(total_pieces>=2){
        total_pieces -= 2;
        result += 1;
    }
    cout << result;
    return 0;
}

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

int f(int k) {
  int res = 0;
  while (k > 0) {
    res += k % 10;
    k /= 10;
  }
  return res;
}

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  int sum = 0;
  for (int k = 1; k <= n; ++k) if (f(k) >= a && f(k) <= b) sum += k;
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3568
#include<cstdio>
#include<iostream>
#define INF 10000000
using namespace std;
int dp[2][100000][2]={{{0}}};

int main(){

    for(int i = 0;i < 2;i++){
        for(int j = 0;j < 100000;j++){
            dp[i][j][0] = dp[i][j][1] = INF;
        }
    }
    int N;
    cin>>N;
    int v[100000]={0};
    for(int i = 0; i < N - 1;i++){
        cin>>v[i+1];
    }
    v[N-1] = 0;
    for(int i = 0;i < N;i++){
        for(int j = 0;j < N+1;j++){
            for(int k = 0;k < 2;k++){
                dp[(i+1)%2][j][k] = INF;
            }
        }
        dp[(i+1)%2][0][1] = v[i];
        for(int j = 0;j < N/2;j++){
            if(dp[i%2][j][1]!=INF){
                dp[(i+1)%2][j+1][0] = min(dp[(i+1)%2][j+1][0],dp[i%2][j][1]+v[i]);
                dp[(i+1)%2][j][1] = min(dp[(i+1)%2][j][1],dp[i%2][j][1]-v[i-1]+v[i]);
            }
            if(dp[i%2][j][0]!=INF){
                dp[(i+1)%2][j+1][0] = min(dp[(i+1)%2][j+1][0],dp[i%2][j][0]-v[i-1]+v[i]);
                dp[(i+1)%2][j][1] = min(dp[(i+1)%2][j][1],dp[i%2][j][0]+v[i]);
            }
        }
    }
    cout<<dp[0][N/2-1][0]<<endl;
    return 0;
}

Measured memory_bytes: 3120
object Main extends App {
  val src = io.Source.stdin.getLines.toList.drop(1).flatMap(_.split(" ").map(_.toInt)).sortWith(_ > _)

  val li = for { num <- (100 to 1 by -1).toList
                 if num <= src.count(_ >= num)
           } yield num

  println(li.head)
}



Measured memory_bytes: 44400
#include <iostream>
#include <vector>
#include <queue>

using namespace std;
using Graph = vector<vector<int>>;

int main()
{
	int n,m,flag;
	scanf("%d %d",&n,&m);

	int a[m],b[m],prev[n];

	Graph g(n+1);
	for(int i=1;i<=m;i++){
		scanf("%d %d",&a[i],&b[i]);
		g[a[i]].push_back(b[i]);
		g[b[i]].push_back(a[i]);
	}

	vector<int> dist(n+1,-1);
	queue<int> que;

	dist[1] = 0;
	que.push(1);

	while(!que.empty()){
		int v = que.front();
		que.pop();

		for(int nv: g[v]){
			if(dist[nv] != -1){
				continue;
			}
			dist[nv] = dist[v] + 1;
			prev[nv] = v;
			que.push(nv);
		}
	}

	flag = 0;
	for(int i=1;i<n;i++){
		if(dist[i] == -1){
			flag = 1;
			break;
		}
	}

	if(flag == 0){
		printf("Yes\n");
		for(int i=2;i<=n;i++){
			printf("%d\n",prev[i]);
		}
	}

	return 0;
}


Measured memory_bytes: 12056
//http://drken1215.hatenablog.com/entry/2018/06/24/003500
//勉強させて頂いた記事

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;


const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()

//8 3
//7 3 1 8 4 6 2 5
//13 12 11 10 7 3 8 1 9 4 6 2 5
//  |     |    5|     |

//言い換え大切
//別に1からやらなくても、左端からやっても結果は変わらない。
//左端からつめて、1にたどり着くということは逆も然りである。

int main(){
    int N,K;
    vector<int> A;
    while(cin>>N>>K){
        A.resize(N);
        rep(i,N)cin>>A[i];
        int res=0;
        int right=0;
        while(true){//シミュレーション
            if(res==0)right+=K;
            else right+=K-1;
            ++res;

            if(right>=N)break;
        }
        cout<<res<<endl;
    }

    return 0;
}

//a=97,z=122

Measured memory_bytes: 640
n=int(input())
score=[]
point=0
for i in range(n):
  d=input().split()
  if d[0]==d[1]:
    point+=1
    score.append(point)
  else:
    point=0
    score.append(point)

if max(score)>=3:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9184
#include <iostream>
#include <map>
using namespace std;
#define F first
#define S second
int main(){
    string s,ans,lon;
    map<string,int>m;
    int top=0;
    while(cin>>s){
        m[s]++;
        if(s.size()>lon.size())lon=s;
    }
    for(pair<string,int> i:m){
        if(i.S>top){
            top=i.S;
            ans=i.F;
        }
    }
    cout<<ans<<' '<<lon<<endl;
}


Measured memory_bytes: 3176
N = int(input())
T = list(map(int, input().split()))
M = int(input())
X = [list(map(int, input().split())) for i in range(M)]
ans = [sum(T)]*M
for i in range(M):
  ans[i] += (X[i][1]-T[X[i][0]-1])
for i in range(M):
  print(ans[i])


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    int data[3][3], ans[3][3];
    rep(i,3) rep(j,3) cin >> data[i][j];
    int n; cin >> n;
    rep(i,n){
        int b; cin >> b;
        rep(i,3) rep(j,3) if(b==data[i][j]) ans[i][j] = 1;
    }
    if(ans[0][0]*ans[0][1]*ans[0][2] == 1) { cout << "Yes" << endl ; return 0;}
    if(ans[1][0]*ans[1][1]*ans[1][2] == 1) { cout << "Yes" << endl ; return 0;}
    if(ans[2][0]*ans[2][1]*ans[2][2] == 1) { cout << "Yes" << endl ; return 0;}
    if(ans[0][0]*ans[1][0]*ans[2][0] == 1) { cout << "Yes" << endl ; return 0;}
    if(ans[0][1]*ans[1][1]*ans[2][1] == 1) { cout << "Yes" << endl ; return 0;}
    if(ans[0][2]*ans[1][2]*ans[2][2] == 1) { cout << "Yes" << endl ; return 0;}
    if(ans[0][0]*ans[1][1]*ans[2][2] == 1) { cout << "Yes" << endl ; return 0;}
    if(ans[0][2]*ans[1][1]*ans[2][0] == 1) { cout << "Yes" << endl ; return 0;}
    cout << "No" << endl;
}

Measured memory_bytes: 256
S_T=input()
A_B=input()
U=input()
list_S_T=[]
for i in range(len(S_T)):
    if S_T[i]==" ":
        S =S_T[0:i]
        T=S_T[i+1:len(S_T)]
for i in range(len(A_B)):
    if A_B[i]==" ":
        A = int(A_B[0:i])
        B = int(A_B[i+1:len(A_B)])
if S==U:
    A = A-1
elif T==U:
    B = B-1
print(A,B)

Measured memory_bytes: 3064
N = int(input())
S = input().strip()
A = [0 for _ in range(N+1)]
B = [0 for _ in range(N+1)]
for i in range(1,N+1):
    if S[i-1]=="E":
        A[i] = A[i-1]+1
        B[i] = B[i-1]
    else:
        A[i] = A[i-1]
        B[i] = B[i-1]+1
cmin = 10**6
for i in range(N):
    cnt = B[i]+A[N]-A[i+1]
    cmin = min(cmin,cnt)
print(cmin)

Measured memory_bytes: 23764
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(), (x).end()
#define pb push_back
int main()
{
    vi a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(all(a));
    cout << a[2] - a[0] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
         int n=0;
         char w[101];
         cin >> w;
         while(w[n]){ n++;}
         if(n%2!=0) { cout << "No" << "\n"; return 0; }
         else{ 
           sort(w,w+n);
           for(int i=0;i<n;i+=2){
             if(w[i]!=w[i+1]){ cout << "No" << "\n"; return 0;}
           }
          }
          cout << "Yes" << "\n"; return 0;


         
  
  
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

template<typename T>
void say(vector<T> s, char r) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << r << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("yes");
	else say("no");
}

void Yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

void YN(bool b) {
	if (b)say("YES");
	else say("NO");
}

template<typename T>
void maxi(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void mini(T& a, T b) {
	a = min(a, b);
}

void exact_say(double x) {
	cout << setprecision(numeric_limits<double>::max_digits10) << x << endl;
}

template<typename T>
vector<vector<T>> fill_vector(int h, int w, T val) {
	vector<vector<T>> ret;
	vector<T> v(w, val);
	rep(h)ret.push_back(v);
	return ret;
}

template<typename T>
T max(vector<T> v) {
	T ret=v[0];
	Rep(1, v.size())maxi(ret, v[i]);
	return ret;
}

template<typename T>
T min(vector<T> v) {
	T ret = v[0];
	Rep(1, v.size())mini(ret, v[i]);
	return ret;
}

signed main() {
	makei(N);
	makei(W);
	vi w, v;
	rep(N) {
		makei(a);
		makei(b);
		w.push_back(a);
		v.push_back(b);
	}
	vvi dp = fill_vector(N, W+1, 0LL);
	Rep(w[0], W + 1)dp[0][i] = v[0];
	Rep(1, N) {
		For(j, W + 1) {
			vi preans;
			preans.push_back(dp[i - 1][j]);
			if (j != 0)preans.push_back(dp[i][j - 1]);
			if (j >= w[i])preans.push_back(dp[i - 1][j - w[i]] + v[i]);
			dp[i][j] = max(preans);
		}
	}
	say(dp[N - 1][W]);
}

Measured memory_bytes: 79488
#include<bits/stdc++.h>
using namespace std;
int mo=pow(10,9)+7;
int helperfn(vector<vector<char> > &matrix,int i,int j,int row,int col,vector<vector<int> >&dp)
{

	if(i>=row||j>=col)
            return 0;

	if(i==matrix.size()-1 && j==matrix[0].size()-1)
		return 1;

	int x=0,y=0;
	if(dp[i][j]!=-1)
		return dp[i][j];
	
	if(i+1<matrix.size()&&matrix[i+1][j]=='.')
		x=helperfn(matrix,i+1,j,row,col,dp) % mo;
	
	if(j+1<matrix[0].size()&&matrix[i][j+1]=='.')
		y=helperfn(matrix,i,j+1,row,col,dp) % mo;

	dp[i][j]= (x+y) % mo;
	return dp[i][j];




}

int main()
{
	int h,w;
	cin >> h>> w;

	vector<char> ab(w);
	vector<vector<char> > matrix(h,ab);

	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
		
		char x;
		cin >> x;

		matrix[i][j]=x;
	
		}
	}
	vector<int> temp(w+2,-1);
	vector<vector<int> > dp(h+2,temp);

	cout << helperfn(matrix,0,0,h,w,dp);		
	return 0;
}

Measured memory_bytes: 5376
import itertools
N, K = list(map(int, input().split()))
A_orig = list(map(int, input().split()))

res = len(A_orig) * max(A_orig)
for pattern in itertools.combinations(range(N), K):
    cnt = 0
    A = A_orig[:]
    for p in pattern:
        if p == 0:
            continue
        extension = max(0, max(A[:p]) - A[p] + 1)
        A[p] += extension
        cnt += extension
    res = min(res, cnt)
    
print(res)

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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<vb> vmb;
typedef vector<vi> vmi;
typedef vector<vll> vmll;

int main()
{
    int n, w;
    cin >> n >> w;

    vi weight(n), value(n);
    for (int i = 0; i < n; ++i)
        cin >> weight[i] >> value[i];

    vmll dp(2, vll(w + 1, 0));
    for (int i = 1; i <= n; ++i)
    {
        int cur = i & 1;
        int pre = !cur;
        for (int j = 1; j <= w; ++j)
        {
            dp[cur][j] = dp[pre][j];
            if (j >= weight[i - 1])
                dp[cur][j] = max(dp[cur][j], value[i - 1] + dp[pre][j - weight[i - 1]]);
        }
    }

    cout << dp[n & 1][w];
    return 0;
}

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

int gcd(int a, int b) {
    int t = a % b;
    if (t == 0) return b;
    return gcd(b, t);
}

int main() {
    int K; cin >> K;
    
    int res = 0;
    for (int i = 1; i <= K; ++i) {
        for (int j = 1; j <= K; ++j) {
            for (int k = 1; k <= K; ++k) {
                int t = gcd(i, j);
                res += gcd(t, k);
            }
        }
    }

    cout << res << endl;
    return 0;
}

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

int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(i%2==0 && s[i]=='L'){
			cout<<"No"<<endl;
			return 0;
		}
		if(i%2==1 && s[i]=='R'){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::*;

// const MOD: i32 = 1000000007;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

fn main() {
    let n: usize = read().unwrap();
    let a: i64 = read().unwrap();
    let b: i64 = read().unwrap();

    let mut v: [i64; 10005] = [0; 10005];

    for i in 1..n + 1 {
        let mut nn = i;
        let mut s: i64 = 0;
        while nn != 0 {
            s += (nn % 10) as i64;
            nn /= 10;
        }
        v[i] = s;
    }

    let mut ans = 0;
    for i in 1..n + 1 {
        if v[i] >= a && v[i] <= b {
            //            println!("{}", i);
            ans += i;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(void) {
	char str[20];
	int i;

	fgets(str, sizeof(char) * 20, stdin);
	for (i = 0; i < 19; i++) {
		if (i == 5 || i == 13) {
			printf(" ");
		}
		else
			printf("%c", str[i]);
	}

	return 0;
}

Measured memory_bytes: 128
s = input()
k = int(input())

if len(set(s)) == 1:
    print((len(s))*k//2)
    exit()

first, last = s[0], s[-1]
first_flag = 1
a, b  = 0, 0
tmp = s[0]
tmp_cnt = 0
cnt = 0

for i in range(len(s)):
    c = s[i]
    if c == first and first_flag:
        a += 1
    elif c != first:
        first_flag = 0
    
    if c == tmp:
        tmp_cnt += 1
    else:
        cnt += (tmp_cnt // 2)
        tmp_cnt = 1
        tmp = c
    if i == len(s) -1:
        b = tmp_cnt
        cnt += (tmp_cnt // 2)

if first != last:
    ans = cnt * k
else:
    ans = cnt * k - (a//2 + b//2 - (a+b)//2)*(k-1)

print(ans)

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  string s; cin >> s;
  char c = s.front();
  int cnt = 0;
  for(auto e:s){
    cnt += e != c;
    c = e;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3696
#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>

#define ll long long

int main()
{
    int S, W;
    std::cin >> S >> W;

    if(W >= S) {
        std::cout << "unsafe" << std::endl;
    }
    else {
        std::cout << "safe" << std::endl;
    }
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<queue>

const int INF = 1001001001;
const int mod = 1000000007;

int main() {
	int x; std::cin >> x;
	if (x) std::cout << 0 << std::endl;
	else std::cout << 1 << std::endl;
	return 0;
}

Measured memory_bytes: 3616
#include <iostream>
using namespace std;
int n,k,q;
int num[100001];
int main()
{
	cin>>n>>k>>q;
	for(int i=1;i<=q;i++)
	{
		int a;
		cin>>a;
		num[a]++;
	}
	for(int i=1;i<=n;i++)
		if(num[i]+k-q<=0)
			cout<<"No"<<endl;
		else
			cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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

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

signed main() {
  vll A(3);
  rep(i, 3) {
    cin >> A[i];
  }
  SORT(A);
  COUT(A[0] + A[1]);
  return 0;
}

Measured memory_bytes: 256
#include  <stdio.h>

  int main(){
    int w,h,x,y,r;

    scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);

   int y_u,y_h,x_r,x_l;
   y_u = y-r;
   y_h = y+r;
   x_r = x+r;
   x_l = x-r;

   if(y_u >= 0 && y_h <= h && x_l >= 0 && x_r <= w)
   printf("Yes\n");

   else printf("No\n");
   return 0;
  }



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

int main() {
    int n;cin>>n;
    pair<int, int>a[n];
    
    for(int i=0;i<n;++i){
        cin>>a[i].first;
        a[i].second = i+1;
    }
    sort(a,a+n);
    for(int i=0;i<n-1;++i){
        cout<<a[i].second<<" ";
    }
    cout<<a[n-1].second<<endl;
    
	return 0;
}

Measured memory_bytes: 1536
import copy
import math
import time
import statistics
import math
import itertools
import bisect
from decimal import *

# a = get_int()
def get_int():
    return int(input())
# a = get_string()
def get_string():
    return input()
# a_list = get_int_list()
def get_int_list():
    return [int(x) for x in input().split()]
# a_list = get_string_list():
def get_string_list():
    return input().split()
# a, b = get_int_multi()
def get_int_multi():
    return map(int, input().split())
# a_list = get_string_char_list()
def get_string_char_list():
    return list(str(input()))
# print("{} {}".format(a, b))
# a_list = [0] * a
'''
while (idx < n) and ():

    idx += 1
'''

def main():

    start = time.time()

    #n, q = get_int_multi()
    #n = get_int()

    s = get_string()

    wk = 0
    ans = 0
    for a in s:
        if a == "R":
            wk += 1
        else:
            wk = 0
        ans = max(ans, wk)

    print(ans)



if __name__ == '__main__':
    main()




Measured memory_bytes: 11044
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
  int c[4][4],a[4],b[4],ax[4][4]={},bx[4][4]={};
  for(int i=1;i<=3;i++)
    for(int j=1;j<=3;j++)
      cin>>c[i][j];
  a[1]=min(min(c[1][1],c[1][2]),c[1][3]);
  a[2]=min(min(c[2][1],c[2][2]),c[2][3]);
  a[3]=min(min(c[3][1],c[3][2]),c[3][3]);
  b[1]=min(min(c[1][1],c[2][1]),c[3][1]);
  b[2]=min(min(c[1][2],c[2][2]),c[3][2]);
  b[3]=min(min(c[1][3],c[2][3]),c[3][3]);
  for(int i=1;i<=3;i++)
    for(int j=1;j<=3;j++)
      if(c[i][j]!=a[i]+b[j]){
        ax[i][j]+=c[i][j]-a[i]-b[j];
        bx[i][j]+=c[i][j]-a[i]-b[j];
      }
  for(int i=1;i<=3;i++){
    int s1=ax[i][1];
    int s2=bx[1][i];
    for(int j=2;j<=3;j++)
      if(ax[i][j]!=s1||bx[j][i]!=s2){
        cout<<"No";
        return 0;
      }
  }
  cout<<"Yes";
  return 0;
}

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

int main() 
{
    int a;
    string s;
    cin >> a >> s;

    printf("%s\n", a>=3200? s.c_str() : "red");
    return 0;
}


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

namespace _0005
{
    class Program
    {
        static void Main(string[] args)
        {
            Calc calc = new Calc();
            // 1行に整数a,bがスペース区切りで与えられる
            // aとbの最大公約数と最小公倍数を出力する

            string str;

            while ((str = Console.ReadLine()) != null)
            {
                long[] num = str.Split(' ').Select(long.Parse).ToArray();
                long a = num[0];
                long b = num[1];
                long r = a % b;
                long gcd = calc.GCD(a, b, r);
                long lcm = calc.LCM(a, gcd, b);
;
                Console.WriteLine(gcd+" "+lcm);

            }
        }

    }
    class Calc
    {
        public long GCD(long a,long b, long r)             // 最大公約数を求めるメソッド
        {
            while (r != 0)                  // a / bの余りrを求める
            {
                a = b;
                b = r;
                r = a % b;
            }
            return b;
        }

        public long LCM(long a, long gcd, long b)
        {
            long lcm = (a / gcd) * b;

            return lcm;
        }
    }

}



Measured memory_bytes: 14336
import java.awt.geom.Point2D;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		Point2D.Double p1, p2, p3, x;
		boolean flag;

		while (sc.hasNext()) {
			p1 = new Point2D.Double(sc.nextDouble(), sc.nextDouble());
			p2 = new Point2D.Double(sc.nextDouble(), sc.nextDouble());
			p3 = new Point2D.Double(sc.nextDouble(), sc.nextDouble());
			x  = new Point2D.Double(sc.nextDouble(), sc.nextDouble());

			if (f(p1, p2, p3, x)) {
				
			}

			if (f(p1, p2, p3, x) && f(p2, p3, p1, x) && f(p3, p1, p2, x)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}

	public static boolean f(Point2D.Double a, Point2D.Double b, Point2D.Double c, Point2D.Double x) {
		double s, i;

		if (a.x - b.x == 0) {
			if (0 < (x.x - a.x) * (c.x - a.x)) {
				return true;
			} else {
				return false;
			}
		} else {
			s = (b.y - a.y) / (b.x - a.x);
			i = a.y - s * a.x;
			if (0 < (x.y - (s * x.x + i)) * (c.y - (s * c.x + i))) {
				return true;
			} else {
				return false;
			}
		}
	}
}

Measured memory_bytes: 12000
tbl = [0] * 26
while True:
    try:
        s = input().lower()
        for i in s:
            if 96 < ord(i) < 124:
                tbl[ord(i) - 97] += 1
    except:
        break

for i in range(26):
    print(f"{chr(i + 97)} : {tbl[i]}")


Measured memory_bytes: 5568
PROGRAM-ID.                      PROGRAM_ID.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
01 N            PIC 9(3).
01 ans          PIC Z9.
 
PROCEDURE                        DIVISION.
    ACCEPT N.
    COMPUTE ans = (N + 1) / 2.
    DISPLAY ans.
    STOP RUN.


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ios::sync_with_stdio(false);
std::cin.tie(nullptr);
    int d;cin >>d;
    vector<int>c(26);
    for (int i = 0; i <26; ++i) {
        cin >>c[i];
    }
    vector<vector<int>>s(d,vector<int>(26));
    for (int i = 0; i < d; ++i) {
        for (int j = 0; j < 26; ++j) {
            cin >>s[i][j];
        }
    }
    vector<int>t(d);
    for (int i = 0; i < d; ++i) {
        cin >>t[i];
        t[i]--;
    }
    int score=0;
    vector<int>last(26,0);
    for (int i = 0; i < d; ++i) {
        score+=s[i][t[i]];
        last[t[i]]=i+1;
        for (int j = 0; j < 26; ++j)score-=c[j]*(i+1-last[j]);
        cout <<score<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3696
A,B,C,D,E,F = map(int,input().split())

xy = []
for Ai in range(0,F+1,100*A):
    for Bj in range(0,F-Ai+1,100*B):
        x = Ai + Bj
        for Ci in range(0,(F-x)+1,C):
            Dj = 0
            y = Ci + Dj
            while x + y <= F:
                xy.append((x,y))
                Dj += D
                y += D

ans = (100*A,0)
node = 0
for x,y in xy:
    if x == y == 0:
        continue
    if (x//100) * E >= y:
        tmp = 100*y/(x+y)
        if node < tmp:
            ans = (x+y, y)
            node = tmp

print(*ans)

Measured memory_bytes: 175956