akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;

class P
{
    static void Main()
    {
        long[] d = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 140737488355328, 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496, 9007199254740992, 18014398509481984, 36028797018963968, 72057594037927936, 144115188075855872, 288230376151711744, 576460752303423488, 1152921504606846976, 2305843009213693952, 4611686018427387904 };
        int[] NP = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int odd = 0;
        int even = 0;
        foreach(int i in a)
        {
            if (i % 2 == 0) even++;
            else odd++;
        }
        long res = d[even];
        long r = 1;
        long oddres = 0;
        if (NP[1] == 0)
        {
            //初めのやつの追加
            oddres++;
        }
        for (int i = 1; i <= odd; i++)
        {
            r = (r * (odd + 1 - i)) / i;
            if(i % 2 == NP[1]) oddres += r;
        }
        Console.WriteLine(res * oddres);
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define MIN(a,b) ((a) <= (b) ? (a) : (b))
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort( ALL(v) )

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

int main()
{

    ll n,k;
    cin>>n>>k;
    vector<ll> v(n);
    for(int i = 0 ; i<n ; i++)cin>>v[i];
    ll leftNum = 0 ;
    ll rightNum =0 ;
    vector<ll> right;
    vector<ll> left;
    ll ans = 1000000000;
    for(int i = 0 ; i<n ; i++)
    {
        if(v[i]>0)
            {rightNum++; right.push_back(v[i]);}
        else if(v[i]<0)
            {leftNum++; left.push_back(v[i]);}
        else k--;
    }
    if(k==0)
    {
        cout<<0<<endl;
        return 0 ;
    }
    sort(left.rbegin() , left.rend());

    for(int i = 0 ; i<right.size() ; i++)
    {
        ll rest = k-i-1;
        ll currTime = right[i];
        if(rest<=left.size() &&left.size()!=0)
        {
            currTime= currTime+currTime+abs(left[rest-1]);
            ans = min(ans , currTime);
        }
        else if(rest == 0 )
        {
            ans = min(ans , currTime);
        }
    }
     for(int i = 0 ; i<left.size() ; i++)
    {
        ll rest = k-i-1;
        ll currTime = abs(left[i]);
        if(rest<=right.size() && right.size()!=0)
        {
            currTime= currTime+currTime+abs(right[rest-1]);
            ans = min(ans , currTime);
        }
        else if(rest == 0 )
        {
            ans = min(ans , currTime);
        }
    }


    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2424
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main(){
    string s,ss="CODEFESTIVAL2016";
    std::cin >> s;
    int ans=0;
    rep(i,s.size()){
        if(s[i]!=ss[i])ans++;
    }
    std::cout << ans << std::endl;
    
}

Measured memory_bytes: 256
N, M = map(int, input().split())
g = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)
for i in range(N):
    print(len(g[i]))
    

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {

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

    private void solve() throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        int n = Integer.parseInt(f.readLine());
        int[] isDivisibleBy = new int[1000001];
        StringTokenizer tokenizer = new StringTokenizer(f.readLine());
        int[] ar = new int[n];
        HashMap<Integer, Integer> nums = new HashMap<Integer, Integer>();
        for (int i = 0; i < n; i++) {
            int num = Integer.parseInt(tokenizer.nextToken());
            if (!nums.containsKey(num)) {
                nums.put(num, 0);
            }
            nums.put(num, nums.get(num) + 1);
            ar[i] = num;
            isDivisibleBy[num]++;
        }



        int res = 0;
        for (int i : nums.keySet()) {
            if (nums.get(i) > 1) {
                continue;
            }
            boolean good = true;
            for (int j = 1; j <= Math.sqrt(i); j++) {
                if (i % j == 0) {
                    int div1 = j;
                    int div2 = i / j;
                    if (div1 != i && nums.containsKey(div1)) {
                        good = false;
                        break;
                    }
                    if (div2 != i && nums.containsKey(div2)) {
                        good = false;
                        break;
                    }
                }
            }
            if (good) res++;
        }

        System.out.println(res);
    }
}


Measured memory_bytes: 75228
#include <stdio.h>
int main (void){
	int A,B,C;
	scanf("%d%d%d",&A,&B,&C);
	if(A == 5 && B == 5 && C == 7){
		printf("YES\n");
	}else if(A == 5 && B == 7 && C == 5){
		printf("YES\n");
	}	
	else if(A == 7 && B == 5 && C == 5){
		printf("YES\n");
	}
	else{
		printf("NO\n");
		}
	return 0;	
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline

n = int(input())
for i in range(n):
    t, x, y = map(int, input().split())
    if t == x+y:
        continue
    elif t > x+y and (t-(x+y))%2 == 0:
        continue
    else:
        print('No')
        sys.exit()
print('Yes')

Measured memory_bytes: 3060
N,A,B,C = map(int,input().split())
L = [int(input()) for i in range(N)]
def dfs(i,la,lb,lc,cost):
    if i == N:
        if la*lb*lc == 0:
            return 10**20
        else:
            return abs(A-la)+abs(B-lb)+abs(C-lc)-30+cost
    ret1 = dfs(i+1,la+L[i],lb,lc,cost+10)
    ret2 = dfs(i+1,la,lb+L[i],lc,cost+10)
    ret3 = dfs(i+1,la,lb,lc+L[i],cost+10)
    ret4 = dfs(i+1,la,lb,lc,cost)
    return min(ret1,ret2,ret3,ret4)
print(dfs(0,0,0,0,0))

Measured memory_bytes: 3064
IDENTIFICATION DIVISION.
       PROGRAM-ID. test1.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 INP PIC X(100).
       01 A PIC 999999.
       01 B PIC 999999.
       01 C PIC 999999999.
       01 REN PIC 9999999.
       01 RE PIC Z(7).
       01 temp1 PIC 9999.
       01 temp2 PIC 9999.
       01 N PIC 9999.
       PROCEDURE DIVISION.
       MAIN.
       	ACCEPT INP.
      	PERFORM VARYING temp1 FROM 1 BY 1 UNTIL INP(temp1:1)=SPACE
      	END-PERFORM.
      	SUBTRACT 1 FROM temp1.
      	MOVE INP(1:temp1) TO A.
      	ADD 2 TO temp1.
      	PERFORM VARYING temp2 FROM temp1 BY 1 UNTIL INP(temp2:1)=SPACE
      	END-PERFORM.
      	COMPUTE N=temp2 - temp1.
      	MOVE INP(temp1:N) TO B.
      	ADD 1 TO temp2.
      	PERFORM VARYING temp1 FROM temp2 BY 1 UNTIL INP(temp1:1)=SPACE
      	END-PERFORM.
      	COMPUTE N=temp1 - temp2.
      	MOVE INP(temp2:N) TO C.
      	IF A = 7 THEN
      		IF B = 5 AND C = 5 THEN
      			DISPLAY "YES"
      		ELSE
      			DISPLAY "NO"
      		END-IF
      	ELSE IF B = 7 THEN
      		IF A = 5 AND C = 5 THEN
      			DISPLAY "YES"
      		ELSE
      			DISPLAY "NO"
      		END-IF
      	ELSE IF C = 7 THEN
      		IF B = 5 AND A = 5 THEN
      			DISPLAY "YES"
      		ELSE
      			DISPLAY "NO"
      		END-IF
      	ELSE
      		DISPLAY "NO"
      	END-IF.
        STOP RUN.

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n, m;
    cin >> n >> m;
    map<ll, ll> mp;
    rep(i, n) {
        ll a;
        cin >> a;
        mp[-a]++;
    }
    rep(i, m) {
        ll b, c;
        cin >> b >> c;
        mp[-c] += b;
    }
    ll ans = 0;
    for (auto p : mp) {
        if (n <= 0) break;
        ans += -p.fi * min(p.se, n);
        n -= p.se;
    }
    cout << ans << endl;
}

Measured memory_bytes: 12800
package main

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

func main() {
	N, S := ReadInt(), ReadString()
	ml := make(map[byte]bool)
	c := 0
	for i := 0; i < N-1; i++ {
		ml[S[i]] = true
		mr := make(map[byte]bool)
		for j := i + 1; j < N; j++ {
			if ml[S[j]] {
				mr[S[j]] = true
			}
		}
		c = Max(c, len(mr))
	}
	fmt.Println(c)
}

func Max(xs ...int) int {
	max := xs[0]
	for _, x := range xs[1:] {
		if max < x {
			max = x
		}
	}
	return max
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1848
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#A
def A():
    return

#B
def B():
    return

#C
def C():
    s = stdin.readline().rstrip()
    K = II() - 1
    ans = []
    for i in range(len(s)):
        for k in range(K+1):
            b = s[i:i + k + 1]
            ans.append(b)
    ans = list(set(ans))
    ans.sort()
    print(ans[K])
    return

#D
def D():
    n, m = LI()
    p = LI_()
    xy = LIR_(m)
    size = [1 for _ in range(n)]
    height = [1 for _ in range(n)]
    par = [i for i in range(n)]
    def find(x):
        if par[x] == x:
            return x
        else:
            par[x] = find(par[x])
            return par[x]
    def union(x, y):
        s1 = find(x)
        s2 = find(y)
        if s1 != s2:
            if height[s1] < height[s2]:
                par[s1] = s2
                size[s2] += size[s1]
                size[s1] = 0
            else:
                par[s2] = s1
                size[s1] += size[s2]
                size[s2] = 0
                if height[s1] == height[s2]:
                    height[s1] += 1

    for x,y in xy:
        union(x, y)
    ans = 0
    for i in range(n):
        if find(p[i]) == find(i):
            ans += 1
    
    print(ans)
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    D()


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

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

using namespace std;

int A[10000];

int main() {
  int N, M;
  cin >> N >> M;

  REP(i, M) cin >> A[i];

  int sum = 0;
  REP(i, M) sum += A[i];

  if (sum > N) {
    cout << -1 << endl;
  } else {
    cout << N - sum << endl;
  }
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(long long i=0;i<(n);++i)
#define Fr(i,n) for(long long i=1;i<=(n);++i)
#define ifr(i,n) for(long long i=(n)-1;i>=0;--i)
#define iFr(i,n) for(long long i=(n);i>0;--i)
using Graph = vector<vector<int>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int x,n,ans,ans2,b;
  cin>>x>>n;
  int arr[n];
  fr(i,n){
    int a;
    cin>>a;
    arr[i]=a;
  }
  fr(i,100){
    b=0;
    fr(l,n){
      if(x-i==arr[l]){
        ++b;
        break;
      }
    }
    if(b==0){
      ans=x-i;
      break;
    }
  }
  fr(i,x-ans){
    b=0;
    fr(l,n){
      if(x+i==arr[l]){
        ++b;
        break;
      }
    }
    if(b==0){
      ans=x+i;
      break;
    }
  }
  cout<<ans;
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <deque>
#include <queue>
#include <cstring>
#include <set>
#include <list>
#include <map>
#include <random>
#include <unordered_map>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<bool> vb;
typedef std::vector<string> vs;
typedef std::vector<double> vd;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<int> > vvi;
typedef vector<vvi> vvvi;
typedef vector<vll> vvll;
typedef std::vector<std::pair<int, int> > vpi;
typedef vector<vpi> vvpi;
typedef std::pair<int, int> pi;
typedef std::pair<ll, ll> pll;
typedef std::vector<pll> vpll;

const long long mod = 1000000007;

#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define forn(i, a, b) for(int i = a; i < b; i++)

#define pb push_back
#define mp make_pair

int main()
{
//#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "wt", stdout);
//#endif
    int n;
    cin>>n;
    vi a(n+1,0);
    forn(i,1,n+1) {
        cin>>a[i];
    };
    int cur = 1;
    ll ans = 0;
    while(cur<=n) {
        ans += (ll)a[cur]/2;
        a[cur] = a[cur]%2;
        if(cur<n && a[cur+1]>0) {
            ans += (ll) a[cur];
            a[cur+1]-=a[cur];
        }
        cur++;
    }
    cout<<ans<<endl;
    
    
    
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    cin>>s;
    int sum=0;
    for (int i=0;i<s.size();i++) {
        sum+=s[i]-'0';
    }
    if (sum%9==0) {
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3680
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, K = list(map(int, sys.stdin.buffer.readline().split()))
H = [int(sys.stdin.buffer.readline()) for _ in range(N)]

H = np.array(H, dtype=int)

H.sort()
d = N - K + 1
a = H[-d:] - H[:d]
print(a.min()
      )


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

using namespace std;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int cur = 0;
  while (a > 0 && c > 0) {
    if (cur % 2 == 0) c -= b;
    else a -= d;
    cur++;
  }

  if (a > 0) puts("Yes");
  else puts("No");
  return 0;
}



Measured memory_bytes: 3648
#include <iostream>
#include <ostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;

    if (a > 9 || b > 9) {
        cout << -1 << endl;
    }
    else {
        cout << a * b << endl;
    }
}



Measured memory_bytes: 256
#include<stdio.h>
void main(){
   int a,b,c;
   scanf("%d%d%d22222",&a,&b,&c);
   int tmp;
   tmp=a;
   a=b;
   b=tmp;
   tmp=a;
   a=c;
   c=tmp;
   printf("%d %d %d\n",a,b,c);
}


Measured memory_bytes: 1724
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ulli unsigned long long int
#define what_is(x) cerr << #x << " is " << x << endl;
#define pi 2*acos(0.0)
#define F  first
#define S  second
#define endl '\n'
#define all(x) x.begin(),x.end()
using namespace std;
const lli INF = 1e18L+5;
/*
lli power(lli x,lli y)
{
    lli res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}
*/
int main()
{
//cout.precision(10);
//cout.setf(ios::fixed,ios::floatfield);
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
	lli T=1;
    //cin>>T;
	while(T--)
	{
		lli i,a,b,n,z;
		cin>>a;
		cout<<a*(a-1)/2<<endl;
	}
}
/*
contest
tt
*/


Measured memory_bytes: 256
#15:30
n = int(input())
a = list(map(int,input().split()))
b = {}
for x in a:
  b[x] = 0
q = int(input())
inp = []
for _ in range(q):
  x,y = map(int,input().split())
  b[x] = 0
  b[y] = 0
  inp.append([x,y])
for x in a:
  b[x] += 1
ans = sum(a)
for z in inp:
  x,y = z
  ans += (y-x) * b[x]
  b[x],b[y] = 0,b[x]+b[y]
  print(ans)

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


using namespace std;

int a[1234567];

int main() {
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] -= i;
	}
	sort(a, a + n);
	int x = a[n / 2];
	long long ans = 0;
	for (int i = 0; i < n; i++) ans += std::abs(x - a[i]);
		cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for (int i = 0; i <= (n); ++i)
#define rip(i,n) for (int i = 1; i <= (n); ++i)
using namespace std;
int main() {
	int n; cin >> n;
	vector<int> a(n), b(n);
	int ans;
	rep(i, n - 1) {
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b.begin(), b.end());
	int maxb = b[n - 1];
	rep(k, n - 1) {
		if (a[k] == maxb)ans = b[n - 2];
		else ans = maxb;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3200
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#define X first
#define Y second
using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

const int N=1000010,mod=1e9+7; 

string s;
int a,b;

int main()
{
	cin>>s;
	
	for(int i=0;i<3;i++)
		if(s[i]=='A') a++;
		else b++;
	
	if(a&&b) puts("Yes");
	else puts("No");
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	return 0;
}









Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5 + 5;
const ll mo = 1e10 +7;
const int M = 100+50;
int main(){
	int n,a,b;
	scanf("%d %d %d",&n,&a,&b);
	if(a+b<=n){
		printf("%d 0\n",min(a,b));
	}else{
		printf("%d %d\n",min(a,b),a+b-n);
	}
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace         std;
#define                 int long long
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<endl
#define                 real signed
#define                 endl '\n'              
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 314159
#define  vi vector<int>
#define  v  vector

signed main() 
{
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    map<char,int>m;
    string s;
    int n;
    cin>>n>>s;
    for(auto i : s)
    {
        m[i]++;
    }
    
    if(m['R']>m['B'])cout<<"Yes";
    else cout<<"No";



     return 0;

}

//       g++ -g c.cpp ; ./a.exe

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

int main(void) {
  long long n;
  std::cin >> n;
  
  long long min;
  bool first = true;
  
  for(long long i=1; i <= (long long)std::sqrt(n); i++) {
    if(n%i==0) {
      long long j = n/i;
      if(first) {
        min = i+j-2;
        first = false;
      } else if(min > i+j-2) {
        min = i+j-2;
      }
    }
  }
  
  std::cout << min;
  return 0;
}

Measured memory_bytes: 256
// KOI NI YAAR SAB SAHI HOEGA  BAS  CHORRO MAT
// ENJOR KARO YAAR
// HAAR MAT MAANO
// // APNA TIME AAYEGA
// BEILIEVE IN GOD
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define loopb(i,a,b) for (lli i=a;i>=b;i--)
#define pb push_back
#define mod 1000000007
#define fast() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define gcd(a,b) (__gcd((a),(b)))
#define lcm(a,b)(((a)*(b))/gcd((a),(b)))
#define ma 1e18
#define bc __builtin_popcountll
#define vi vector<lli>
#define pr pair<lli,lli>
#define vp vector<pr>
#define F  first
#define S   second
#define lld long double
#define PI  3.14159265358979
#define pri  priority_queue<ll>
#define prim  priority_queue<ll,vector<ll>,greater<ll>>
#define flush  cout<<flush

// vector<vector<lli>> pre(3001,vector<lli>(3001,0)); 
//lli vis[3000];
//vector<lli>v[3000];

/*void dfs(lli num)
{vis[num]=1;
for(auto itr = v[num].begin();itr!=v[num].end();++itr)
{if(vis[*itr]==0)
{dfs(*itr);
}
}
}*/

lli a[100009];
lli dp[100009];
lli n,k;

lli solve(lli stones)
{if(stones<a[0])
{return 0;
}
if(dp[stones]!=-1)
{return dp[stones];
}
lli ans=0;
loop(i,0,n)
{if(stones>=a[i])
{ans|=(solve(stones-a[i])==0);}}
return dp[stones]=ans;
}

int main()
{lli t;
cin>>n>>k;
loop(i,0,n)
{cin>>a[i];
}
lli res;
mem(dp,-1);
res = solve(k);
if(res==0)
{cout<<"Second"<<"\n";
}
else
{cout<<"First"<<"\n";
}
}


Measured memory_bytes: 9020
#include <stdio.h>

int main(){
  long long N,a=2,b=1,ans;
  scanf("%lld",&N);
  if(N==1){
    printf("1\n");
    return 0;
  }
  for(long long i=2; i<=N; i++){
    ans = a + b;
    a = b;
    b = ans;
  }
  printf("%lld\n",ans);
}

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

int main() {
  string S;
  cin >> S;
  cout << S.at(0) << S.at(1) << S.at(2) << S.at(3) << S.at(4) << " " << S.at(6) << S.at(7) << S.at(8) << S.at(9) << S.at(10) << S.at(11) << S.at(12) << " " << S.at(14) << S.at(15) << S.at(16) << S.at(17) << S.at(18) << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main {

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

        while(true) {
            int n = num.nextInt();
            int x = num.nextInt();
            int sum = 0;

            if(n == 0 && x == 0) {
                break;
            }

            for(int i = 1; i < n - 1; i++) {
                for(int j = i + 1; j < n; j++) {
                    for(int k = j + 1; k < n + 1; k++) {
                        if((i + j + k) == x) {
                            sum++;
                        }
                    }
                }
            }
            System.out.println(sum);
        }

        
    }
}


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

public class Main {
  static String[] r = {"Sunny","Cloudy","Rainy"};
  	public static int ncr(String str)
    {
      if(str.equalsIgnoreCase("Sunny"))
        return 0;
      if(str.equalsIgnoreCase("Cloudy"))
        return 1;
      if(str.equalsIgnoreCase("Rainy"))
        return 2;
      return -1;
    }
    public static void main(String[] args) throws Exception {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        OutputStream outputStream = System.out;
    	PrintWriter out = new PrintWriter(outputStream);

        int i, n, m, k;

		String str= br.readLine();    
        int c = ncr(str);
	out.print(r[(c+1)%3]);
	out.flush();
	out.close();
	}
}

Measured memory_bytes: 20180
#include<stdio.h>
    
int main()
{
 int x, y, box;
 scanf("%d %d", &x, &y);
     
 while((x != 0) || (y != 0)){
   if (x >= y) {
     box = x;
     x   = y;
     y   = box;
   }
 printf("%d %d\n", x, y);
 scanf("%d %d", &x, &y); 
 }
 return 0;
}

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

int main(){
    int n,l;
    cin>>n>>l;
    int m=1000;
    int sig=1;
    for(int i=1;i<=n;i++){
        m=min(m,abs(l+i-1));
        if(l+i-1>=0) sig=1;
        else if(l+i-1<0) sig=-1;
    }
    int s=0;
    for(int i=1;i<=n;i++){
        s+=l+i-1;
    }
    if(sig==1) cout<<s-m<<endl;
    else cout<<s+m<<endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    private static ArrayList<ArrayList<Integer>> adjList;
    private static int[][] weights;
    private static int n;

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        n = Integer.parseInt(in.readLine());
        adjList = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            adjList.add(new ArrayList<>());
        }
        weights = new int[n][n];
        for (int i = 0; i < n; i++) {
            String line = in.readLine();
            String[] data = line.split(" ");
            int u = Integer.parseInt(data[0]);
            int k = Integer.parseInt(data[1]);
            for (int j = 0; j < k*2; j+=2) {
                int v = Integer.parseInt(data[j+2]);
                int c = Integer.parseInt(data[j+3]);
                weights[u][v] = c;
                adjList.get(u).add(v);
            }
        }
        in.close();
        int[] dist = minDist();
        for (int i = 0; i < n; i++) {
            System.out.println(i + " " + dist[i]);
        }
    }

    private static int[] minDist() {
        int[] dist = new int[n];
        Arrays.fill(dist, Integer.MAX_VALUE);
        dist[0] = 0;
        PriorityQueue<Integer> fringe = new PriorityQueue<>(Comparator.comparingInt(x -> dist[x]));
        fringe.offer(0);
        while (!fringe.isEmpty()) {
            int u = fringe.poll();
            for (int v : adjList.get(u)) {
                int newDist = dist[u] + weights[u][v];
                if (newDist < dist[v]) {
                    fringe.remove(v);
                    dist[v] = newDist;
                    fringe.offer(v);
                }
            }
        }
        return dist;
    }
}




Measured memory_bytes: 557708
n = int(input())
places = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]
can_move = True
for i in range(1, n + 1):
  _t = places[i][0] - places[i - 1][0]
  _x = abs(places[i][1] - places[i - 1][1])
  _y = abs(places[i][2] - places[i - 1][2])

  if not _t >= _x + _y or not _t % 2 == (_x + _y) % 2:
    can_move = False
    break

if can_move:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 28068
#include <algorithm>
#include <functional>
#include <iostream>
#include <iterator>
int main(int argc, char *argv[]) {
  int N, K;
  std::cin >> N >> K;
  int k[1 << 21]{};
  int n;
  for (int i = 0; i < N; ++i) {
    std::cin >> n;
    ++k[n];
  }

  std::sort(k, k + N + 1, std::greater<int>());

  long sum{};
  for (int i = K; i <= N; ++i)
    sum += k[i];

  std::cout << sum << std::endl;
}

	


Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;

int N, K;
double x[200000];

int main(void){
	cin >> N >> K;
	for(int i = 0; i < N; i++){
		int p; cin >> p;
		x[i] = (p + 1.0) / 2.0;
	}

	double res = 0.0;
	double sum = 0.0;
	for(int i = 0; i < K; i++){
		sum += x[i];
	}
	res = sum;
	
	for(int i = 0; i < N - K; i++){
		sum = sum - x[i] + x[i+K];
		res = max(res, sum);
	}

	cout << setprecision(7) << res << '\n';

	return 0;
}

Measured memory_bytes: 1792
<?php
$N = (int)trim(fgets(STDIN));
//$S = trim(fgets(STDIN));
//list($N,$M,$K) = array_map('intval',explode(" ",trim(fgets(STDIN))));
//$s = trim(fgets(STDIN));
//$A = array_map('intval',explode(" ",trim(fgets(STDIN))));

$n = $N %10;

$ans="hon";
switch($n) {
case 3:
  $ans = "bon";
  break;
case 0:
case 1:
case 6:
case 8:
  $ans = "pon";
}
printf("%s\n",$ans);


Measured memory_bytes: 16112
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<ll, pii>pi3;
int dat[101010];
ll r = 1000000000000000000LL;
void isok(vector<pi3>v)
{
	fill(dat, dat + v.size(), 0);
	ll s = 0;
	for (int i = 0; i < v.size(); i++)
	{
		s += v[i].first;
		if (v[i].second.first == 0)dat[v[i].second.second] |= 1;
		else dat[v[i].second.second] |= 2;
	}
	int d[4];
	fill(d, d + 4, 0);
	for (int i = 0; i < v.size(); i++)d[dat[i]]++;
	if (d[3] != 0 || d[1] == 0 || d[2] == 0)r = min(r, s);
}
int main()
{
	int num;
	scanf("%d", &num);
	vector<pi3>v;
	for (int i = 0; i < num; i++)
	{
		int za, zb;
		scanf("%d%d", &za, &zb);
		v.push_back(make_pair(za, make_pair(0, i)));
		v.push_back(make_pair(zb, make_pair(1, i)));
	}
	sort(v.begin(), v.end());
	vector<pi3>z;
	for (int i = 0; i < num; i++)z.push_back(v[i]);
	isok(z);
	z.pop_back();
	z.push_back(v[num]);
	isok(z);
	z.pop_back();
	z.pop_back();
	z.push_back(v[num - 1]);
	z.push_back(v[num]);
	isok(z);
	z.pop_back();
	z.pop_back();
	z.push_back(v[num - 2]);
	z.push_back(v[num + 1]);
	isok(z);
	printf("%lld\n", r);
}

Measured memory_bytes: 12396
N=gets.to_i
xy=[]
N.times do
  xy << gets.split.map(&:to_i)
end
if N==1
  p 1
  exit(0)
end
cands = Hash.new(0)
xy.sort_by!{|pos| pos[1]}
xy.sort_by!{|pos| pos[0]}
(N-1).times do |i|
  ((i+1)...N).each do |j|
    cands[[xy[i][0]-xy[j][0], xy[i][1]-xy[j][1]].inspect] += 1
  end
end
num = cands.values.sort_by!{|v| -v}[0]
p 1+(num-1)+(N-num*2)

Measured memory_bytes: 2044
import itertools
import collections


def getint(): return int(input())
def getints(): return list(map(int, input().split()))

n,k=getints()
h=list(sorted([getint() for _ in range(n)]))

res = 1 << 30
dq = collections.deque()
for v in h:
    dq.append(v)
    if len(dq) == k:
        res = min(res, dq[-1] - dq[0])
        dq.popleft()

print(res)


Measured memory_bytes: 53592
h, w, d = map(int, input().split())
arr = [0] * (h * w + 1)

a = [list(map(int, input().split())) for _ in range(h)]

for i in range(h):
    for j in range(w):
        s = a[i][j]
        arr[s] = (i, j)

q = int(input())
lr = [list(map(int, input().split())) for _ in range(q)]

cnt = h * w
result = [[0] for _ in range(d)]
for i in range(d):
    l = i
    score = 0
    while l + d <= cnt:
        if l == 0:
            result[i].append(score)
            l += d
            continue
        (ux, uy) = arr[l]
        (vx, vy) = arr[l + d]
        score += (abs(vx - ux) + abs(vy - uy))
        result[i].append(score)
        l += d


for l, r in lr:
    ans = result[l % d]
    print(ans[r // d] - ans[l // d])

Measured memory_bytes: 45864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
const int mod = 1000000007;
struct mint {
ll x;
mint(ll x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res+=a;
}
mint operator-(const mint a) const {
mint res(*this);
return res-=a;
}
mint operator*(const mint a) const {
mint res(*this);
return res*=a;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
mint inv() const {
return pow(mod-2);
}
mint& operator/=(const mint a) {
return (*this) *= a.inv();
}
mint operator/(const mint a) const {
mint res(*this);
return res/=a;
}
};
struct combination {
vector<mint> fact, ifact;
combination(int n):fact(n+1),ifact(n+1) {
assert(n < mod);
fact[0] = 1;
for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
ifact[n] = fact[n].inv();
for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
}
mint operator()(int n, int k) {
if (k < 0 || k > n) return 0;
return fact[n]*ifact[k]*ifact[n-k];
}
};
int main(){
    ll n,k;cin>>n>>k;
    mint ans=0;
    for(int i=k;i<=n+1;i++){
        ans+=(n-i+1)*i+1;
    }
    cout<<ans.x<<endl;
    return 0;
}

Measured memory_bytes: 3672
n, k = map(int, input().split())
a = [int(x) for x in input().split()]

ans = sum(a[0:k])
for i in range(1, n-k+1):
    nxt = ans - a[i-1] + a[i+k-1]
    if ans < nxt:
        print('Yes')
    else:
        print('No')
    ans = nxt


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

int main()
{
	int n, A[4][3][10],a,b,c,d;

	for (int i = 0;i < 4;i++) {
		for (int j = 0;j < 3;j++) {
			for (int k = 0;k < 10;k++) {
				A[i][j][k] = 0;
			}
		}
	}

	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> a >> b >> c >> d;
		A[a-1][b-1][c-1] += d;
	}

	for (int i = 0;i < 4;i++) {
		for (int j = 0;j < 3;j++) {
			for (int k = 0;k < 10;k++) {
				cout << " " << A[i][j][k];
			}
			cout << endl;
		}
		if (i != 3) {
			for (int x = 0;x < 20;x++) {
				cout << "#";
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 1160
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

//Code Short
#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define DSORT(n) sort(n.begin(),n.end())
#define QECHO(n) cout << n
#define QECHOS(n) cout << n << " "

//Define Math
const double EPS = 1e-10;
const double PI  = acos(-1.0);

using namespace std;
typedef long long ll;
/* prototype */
int EDSum(ll);//各桁の和
vector<int> SOE(int,int);//素数 (Min,Max)
int MinCM(int,int);//最小公倍数(num1,num2)
int MaxCD(int,int);//最大公約数(num1,num2)
vector<int> igets(int);//cin * N
ll nPr(ll,ll); //(n,r)
ll nE(ll); //(n)
ll nCr(ll,ll); //(n,r)

void solve(){
  int a,b,c;
  cin >> a >> b >> c;
  cout << (a-b)%c << endl;
}

int main(void){cin.tie(0);ios::sync_with_stdio(false);solve();}
int EDSum(ll number) {
  int ans = 0;
  while (1) {
    ans += number % 10;
    number /= 10;
    if (number == 0) break;
  }
  return ans;
}

vector < int > SOE(int min, int max) {
  if (min < 2) min = 2;
  vector < int > int_array;
  for (int i = min; i <= max; i++) int_array.push_back(i);
  vector < int > sosu;
  double stop = sqrt(max);
  while (true) {
    sosu.push_back(int_array.front());
    int_array.erase(int_array.begin());
    if (stop < (double)(sosu.back())) break;
    for (int i = 0; i < (int) int_array.size(); i++) {
      if (int_array[i] % sosu.back() == 0)
        int_array.erase(int_array.begin() + i);
    }
  }
  sosu.insert(sosu.end(), int_array.begin(), int_array.end());
  return sosu;
}

int MinCM(int a, int b) {
  int c = a * b;
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return c / b;
}

int MaxCD(int a, int b) {
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
vector < int > igets(int N) {
  vector < int > A;
  int temp;
  for (int i = 0; i < N; ++i) {
    cin >> temp;
    A.push_back(temp);
  }
  return A;
}

ll nPr(ll n, ll r) {
  ll ans = 1;
  r = n - r;
  while (n != r) {
    ans *= n;
    --n;
  }
  return ans;
}

ll nE(ll n) {
  return nPr(n, n);
}

ll nCr(ll n, ll r) {
  if (r == 0) return -1;
  else {
    if (0 != n - r && n - r < r) r = n - r;
    return nPr(n, r) / nE(r);
  }
}

Measured memory_bytes: 256
s = input()
c_index = float('inf')
f_index = 0
for i, c in enumerate(s):
    if c == "C":
        c_index = min(c_index, i)
    if c == "F":
        f_index = max(f_index, i)
if c_index < f_index:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
import math
import heapq
n, k = list(map(int, input().split(' ')))
aaa = list(map(int, input().split(' ')))
aaa = [-a for a in aaa]
heapq.heapify(aaa)
for i in range(k):  # TLE?
    t = heapq.heappop(aaa)
    t = math.ceil(t/2)
    heapq.heappush(aaa, t)
print(-sum(aaa))



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

int  main()
{
	int a; cin >> a;
	cout << a + (a*a) + (a*a*a) << endl;
	return 0;
}


Measured memory_bytes: 3648
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int Y = (X - A)%B;
		System.out.println(Y);
		sc.close();
		}


}


Measured memory_bytes: 21716
#include<cstdio>
const int PI = 1e9 + 7;
int n;
long long sum = 1;
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
	{
		sum = (sum*i)% PI;
	}
	printf("%d\n", sum);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,t;
	cin>>s>>t;
	int lens=s.size();
	int lent=t.size();
	int i,j;
	for(i=lens-lent;i>=0;i--)
	{
		for(j=0;j<lent;j++)
		{
			if(s[i+j]!=t[j]&&s[i+j]!='?')break;
		}
		
		if(j==lent)break;
		
	}
	if(i<0)cout<<"UNRESTORABLE";
	else
	{
	   for(j=0;j<lent;j++)
	   s[i+j]=t[j];
	   for(i=0;i<lens;i++)	
	   if(s[i]=='?')s[i]='a';
	   cout<<s;
	   }

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int N;
vector<int> a(110);

int main(){
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    cin >> a.at(i);
  }

  sort(a.begin(), a.end(), greater<int>());

  int Alice = 0;
  int Bob = 0;

  for (int i = 0; i < N; i++)
  {
    if (i % 2 == 0)
    {
      Alice += a.at(i);
    }
    else
    {
      Bob += a.at(i);
    }
  }

  cout << Alice - Bob << endl;
}


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

int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	string ans = "";
	for (int i = 0; i < tx - sx; i++) {
		ans += "R";
	}
	for (int i = 0; i < ty - sy; i++) {
		ans += "U";
	}
	for (int i = 0; i < tx - sx; i++) {
		ans += "L";
	}
	for (int i = 0; i < ty - sy; i++) {
		ans += "D";
	}

	ans += "D";
	for (int i = 0; i <= tx - sx; i++) {
		ans += "R";
	}
	for (int i = 0; i <= ty - sy; i++) {
		ans += "U";
	}
	ans += "L";

	ans += "U";
	for (int i = 0; i <= tx - sx; i++) {
		ans += "L";
	}
	for (int i = 0; i <= ty - sy; i++) {
		ans += "D";
	}
	ans += "R";
	cout << ans << endl;
	return 0;
}

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

namespace {
int Do01BFS(int K, vector<int>* distances) {
  vector<int>& d = *distances;
  deque<int> q;
  d[1] = 0;
  q.push_back(1);
  while (!q.empty()) {  // Visits every node.
    auto now = q.front();
    q.pop_front();
    int next = (now + 1) % K;
    if (d[next] == INT_MAX) {  // Not visited.
      d[next] = d[now] + 1;
      q.push_back(next);
    }
    next = (now * 10) % K;
    if (d[next] > d[now]) {  // Updates shorter path.
      d[next] = d[now];
      q.push_front(next);
    }
  }
  return d[0] + 1;
}
}  // namespace

int main() {
  int K;
  cin >> K;
  // Distance of each mod K integers.
  vector<int> distances(K, INT_MAX);
  cout << Do01BFS(K, &distances) << endl;
}


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

using namespace std;

typedef long long ll;

const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const long double PI = 3.14159265359;

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()
#define _log2(x) 31-__builtin_clz(x)

#define hash sodnf9843bsd
#define right iadjfof23n3okd
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define len length
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}

int n;
vector<double>p;
bool vis[3030][3030] = {};
double dp[3030][3030] = {};

double solve(int i, int head){
    if (i == n) return head > n-head;
    if (!vis[i][head]){
        vis[i][head] = true;
        dp[i][head] = p[i]*solve(i+1, head+1) + (1-p[i])*solve(i+1, head);
    }
    return dp[i][head];
}

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

    cin>>n;
    p.resize(n);
    _fi(n) cin>>p[i];

    prec(10);
    cout << solve(0, 0) << endl;

    return 0;
}


Measured memory_bytes: 59084
N=int(input())
S=([chr(ord('a') + i) for i in range(26)])
L=[float("inf")]*26
for i in range(N):
	x=input()
	for j in range (len(S)):
		L[j]=min(L[j],x.count(S[j]))
for i in range(len(S)):
	print(S[i]*L[i],end="")
print("")

Measured memory_bytes: 3064
use proconio::{ input, fastout };

#[fastout]
fn main() {
    input! {
        s: String,
    };
    let d = if &s == "RRR" {
        3
    } else if &s == "RRS" || &s == "SRR" {
        2
    } else if &s == "SSS" {
        0
    } else {
        1
    };
    println!("{}", d );
}


Measured memory_bytes: 2168
#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 n;
    cin >> n;
    char card='H';
    vector<bool> spades(13,0);
    vector<bool> hearts(13,0);
    vector<bool> clovers(13,0);
    vector<bool> tiles(13,0);
    int temp;
    rep(i,n){
        cin >> card;
        if(card == 'H'){
            cin >> temp,hearts.at(temp-1) = true;
        }else if(card == 'S'){
            cin >> temp,spades.at(temp-1) = true;
        }else if(card == 'C'){
            cin >> temp,clovers.at(temp-1) = true;
        }else if(card == 'D'){
            cin >> temp,tiles.at(temp-1) = true;
        }
    }
    rep(i,52){
        if(i<13){//S
            if(spades.at(i) != true)cout << 'S' << ' ' << i+1 << endl;
        }else if (i<26)//H
        {
            if(hearts.at(i-13) != true)cout << 'H' << ' ' << i-12 << endl;
        }else if (i<39)//C
        {
            if(clovers.at(i-26) != true)cout << 'C' << ' ' << i-25 << endl;
        }else if (i<52)//T
        {
            if(tiles.at(i-39) != true)cout << 'D' << ' ' << i-38 << endl;
        }
    }
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/


Measured memory_bytes: 3084
/*
これを入れて実行
g++ code.cpp
./a.out
*/

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = { -1, 0, +1, 0 };
int dx4[4] = { 0, +1, 0, -1 };
int dy8[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };
int dx8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
	return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
	if (r == 0 || r == n){
		return 1;
	}
	else if (r == 1){
		return n;
	}
	return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
	r = n - r;
	ll ret = 1;
	for (ll i = n; i >= r + 1; i--) ret *= i;
	return ret;
}

//-----------------------ここから-----------

ll factorial[201000];
ll invfactorial[201000];

ll extGCD(ll a, ll b, ll &x, ll &y){
	if (b == 0){
		x = 1;
		y = 0;
		return a;
	}

	ll d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

ll nCrM(ll n, ll r){
	ll ret = factorial[n];
	ret *= invfactorial[n - r];
	ret %= MOD;
	ret *= invfactorial[r];
	ret %= MOD;
	return ret;
}




int main(void){
	ll h, w, a, b;
	cin >> h >> w >> a >> b;

	factorial[0] = 1;

	for (int i = 1; i < 201000; i++){
		factorial[i] = (factorial[i - 1] * i) % MOD;
	}

	

	for (int i = 0; i < 201000; i++){
		ll x, y;
		ll g = extGCD(factorial[i], MOD, x, y);
		while (x < 0) x += MOD;
		x %= MOD;
		invfactorial[i] = x;
	}

	ll ans = 0;

	//cout << nCrM(h + w - 2, h - 1) << endl;

	for (int i = b; i < w; i++){
		ll tmp = nCrM((h - a - 1) + i, h - a - 1);
		tmp %= MOD;
		tmp *= nCrM((a - 1) + (w - i - 1), a - 1);
		tmp %= MOD;
		ans += tmp;
		ans %= MOD;

	}

	cout << ans << endl;
}



Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;
#define int LL

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && (ch != '-')) ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int const MAXN = 5005;
int a[MAXN];
int f[MAXN][MAXN];

signed main() {

#ifdef LOCAL
  FILEIO("a");
#endif

  int n, A, B; read(n), read(A), read(B);
  for (RI i = 1; i <= n; ++i) read(a[i]);
  memset(f, 0x3f, sizeof(f));
  f[0][0] = 0;
  for (RI i = 1; i <= n; ++i)
    for (RI j = 0; j <= n; ++j)
      if (a[i] > j) {
        f[i][j] = min(f[i][j], f[i - 1][j] + A);
        f[i][a[i]] = min(f[i][a[i]], f[i - 1][j]);
      }
      else {
        f[i][j] = min(f[i][j], f[i - 1][j] + B);
      //  f[i][a[i]] = min(f[i][a[i]], f[i - 1][j] + A);
      }
  int ans = 0x7f7f7f7f7f7f7f7f;
  for (RI i = 0; i <= n; ++i)
    ans = min(ans, f[n][i]);
  printf("%lld\n", ans);

  cerr << (double)(clock()) / CLOCKS_PER_SEC * 1000 << "ms" << endl;

  return 0;
}

// created by Daniel yuan

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

bool is_prime(int n) {
  if (n <= 1) return false;
  if (n == 2) return true;
  if (n % 2 == 0) return false;
  for (int i = 2; i*i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}

int main() {
  int X;
  cin >> X;
  while (!is_prime(X)) X++;
  cout << X << endl;
  return 0;
}


Measured memory_bytes: 256