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

#define ANS  //for answer
#define CMP  //for compe

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define nv(x) #x,(x)
#define ncv(x) #x,":",(x)
#define ncvc(x) #x,":",(x),","
using ll = long long;
void pPRINT(std::ostream& ost) {}
template <class T, class... U>void pPRINT(std::ostream& ost,const T t,const U... u) {ost<<t<<" ";pPRINT(ost, u...);}
template <class... T>void PRINT(const T... t) {pPRINT(std::cout, t...);}
template <class... T>void PRINTl(const T... t){pPRINT(std::cout,t...);std::cout<<"\n";}
template <class T>void PRINTa(const T* const t,const ll size){REP(i,size)PRINT(t[i]);PRINTl();}
template <class T>void PRINTal(const T* const t,const ll size){REP(i,size)PRINTl(i,":",t[i]);}
#ifdef CMP
using namespace std;
#else
#endif
#ifdef ANS
#define DEBUG(...)
void init(){}
#else
#define DEBUG(...) PRINT("##DEBUG##","file :",__FILE__,", line :",__LINE__,"[");PRINT(__VA_ARGS__);PRINTl("]");
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}
#endif

void solve();

int main(int argc, char *argv[]) {

  init();
  DEBUG();
  solve();

  return 0;
}

void solve(){

  DEBUG("SOLVE START");
  string s;cin>>s;
  ll n = s.length();
  vector<pair<ll,ll>> b(0);
  b.emplace_back(0,0);
  REP(i,n-1){
    if(s[i]!=s[i+1]){
      if(s[i]=='R'){b[b.size()-1].second = i;}
      else b.emplace_back(i+1,0);
    }
  }
  ll *ans = new ll[n]{};
  REP(i,b.size()){
    ll r=b[i].first,x=b[i].second,l=(i==b.size()-1?n-1:b[i+1].first-1);
    DEBUG(ncv(i),ncv(r),ncv(x),ncv(l));
    ans[x]=(x-r+2)/2+(l-x)/2;
    ans[x+1]=(x-r+1)/2+(l-x+1)/2;
  }

  PRINTa(ans,n);

}

Measured memory_bytes: 2292
/*#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {

	ll n,total = 0;
	cin>>n;
	ll arr[n+1];
	multiset <ll> str;
	multiset <ll> :: iterator itr1, itr2;  
	for(ll i=1; i<=n; i++) {
		cin>>arr[i];
		str.insert(arr[i] + i);
	}
	for(ll i=1; i<=n; i++) {
		ll c = i - arr[i];
		if(c>0) {
		itr1 = str.lower_bound(c);
		itr2 = str.upper_bound(c);
		//cout<<*itr1<<" "<<*itr2<<"\n";
		total += distance(itr1,itr2);
		}
	}

	cout<<total;
	for(itr1 = str.begin(); itr1!= str.end(); itr1++){
		cout<<*itr1<<" ";
	}
	
	cout<<distance(itr1,itr2);
	
	//return 0;
}*/

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

vector<vector<pair<int, int>>> adj;
int main() {
	int n,m;
	cin>>n>>m;
	adj.resize(n+1);
	//cout<<n<<m;
	int h[n+1];
	for(int i=1; i<=n; i++)
		cin>>h[i];
	int a, b;
	for(int j=0; j<m; j++) {
		cin>>a>>b;
		adj[a].push_back(make_pair(b,h[a]));
		adj[b].push_back(make_pair(a,h[b]));
	}

	int oop = 0,total =0;
	//vector<bool> check(n+1 , false);
	for(int i =1 ; i<=n; i++) {
		oop = 0;
		if(adj[i].size() == 0)
			total++;
		//if(!check[i]) {
			for(auto edge : adj[i]) {
				//int diff = edge.second;
				//cout<<i<<" "<<edge.first<<" "<<h[i]<<" "<<h[edge.first]<<"\n";
				if(h[i] > h[edge.first]) {
					//if(h[i] != h[edge.first]) check[edge.first] = true;
					oop = 1;
					
				}
				else {
					oop = 0;
					break;
				}

			}
			if(oop == 1) total++;
		//}
		//cout<<"\n";
		//check[i] = true;
	}
	cout<<total;
	return 0;

}

Measured memory_bytes: 9544
// #include C/C++ {
#include <bits/stdc++.h>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
// }

// #parameter{
#ifdef _DEBUG

#define TYPE decltype
#define RF(filename) {freopen((filename), "r", stdin);}
#define WF(filename) {freopen((filename), "w", stdout);}
#define DF(filename) {freopen((filename), "w", stderr);}
#define eprintf printf

#else

#define TYPE __typeof
#define RF(filename) {;}
#define WF(filename) {;}
#define DF(filename) {;}
#define eprintf(...)
#define fprintf(...)

#endif

// #define {
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define MP make_pair
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(it) (it).begin(), (it).end()
#define FILL(__space, __val) memset(__space, __val, sizeof(__space))
#define MOVE(__spaceTo, __spaceFrom) memmove(__spaceTo, __spaceFrom, sizeof(__spaceTo))
#define UNIQUE(__vector) sort(ALL(__vector)), __vector.resize(unique(ALL(__vector)) - __vector.begin())
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = acos(-1.0);
const double EPS = 1e-6;

#define MAX_N 55
#define MAX_M 55
#define MOD (int)(1e9+7)
#define INF ((1 << 30) - 1)
#define BINF ((1LL << 62) - 1LL)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////
int main() {
	RF("input.txt");
	// WF("output.txt");
	DF("err.txt");

	int A, B, C;
	scanf("%d %d %d", &A, &B, &C);
	printf("%d\n", max(0, C - (A - B)));
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];

    int num_minus = 0;
    long long sum_abs = 0;
    long long min_abs = 1LL<<60;
    for (int i = 0; i < N; ++i) {
        if (A[i] < 0) ++num_minus;
        sum_abs += abs(A[i]);
        min_abs = min(min_abs, abs(A[i]));
    }
    if (num_minus % 2 == 0) cout << sum_abs << endl;
    else cout << sum_abs - min_abs * 2 << endl;
}

Measured memory_bytes: 3980
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n;cin>>n;
    int ans = 0, cnt = 0;
    int before;cin>>before;
    rep(i,n-1){
        int tmp;cin>>tmp;
        if(tmp<=before){cnt++;}
        else {ans=max(ans,cnt);cnt=0;}
        before = tmp;
    }
    co(max(ans,cnt));
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
    
        var sc = new Scanner(System.in);
    
        int n = Integer.parseInt(sc.next());
        var a = new int[n];
        var b = new boolean[1000001];
        var set1 = new HashSet<Integer>();
        var set2 = new HashSet<Integer>();
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(sc.next());
            set1.add(a[i]);
            if(b[a[i]]){
                set2.add(a[i]);
            }else{
                b[a[i]] = true;
            }
        }
        for(int i : set2){
            b[i] = false;
        }
        
        for(int i : set1){
            int x = i+i;
            while(x <= 1000000){
                b[x] = false;
                x += i;
            }
        }
        int ans = 0;
        for(int i = 1; i <= 1000000; i++){
            if(b[i]) ans++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 70516
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace lineAralgebra
{
	class Program
	{
		static void Main(string[] args)
		{
			var input = Console.ReadLine();
			var ok = true;
			var evenSet = new HashSet<char>() { 'R', 'U', 'D' };
			var oddSet = new HashSet<char>() { 'L', 'U', 'D' };
			for (var i = 0; i < input.Length; i++)
			{
				var s = input[i];
				if (i % 2 == 0)
				{
					if (!evenSet.Contains(s)) ok = false;

				}
				else
				{
					if (!oddSet.Contains(s)) ok = false;

				}
			}

			if (ok) {
				System.Console.WriteLine("Yes");
			} else {
				System.Console.WriteLine("No");
			}
		}

		/** test cases:
		 * null ==> null
		 * 1 ==> 1
		 * 1->2 ==> 2->1
		 * 1->2->3 ==> 2->1->3
		 * 1->2->3->4 ==> 2->1->4->3
		 */
	}
}

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

int main(){
  int n, m; cin >> n >> m;
  int c; cin >> c;
  vector<int> b(m);
  
  for(int i = 0; i < m; i++){
    cin >> b.at(i);
  }
  
  int ans = 0;
  
  for(int i = 0; i < n; i++){
    int sum = c;
    for(int j = 0; j < m; j++){
      int a; cin >> a;
      sum += a * b.at(j);
    }
    if (sum > 0) ans++;
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
using System;

namespace abc090A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string A = Console.ReadLine();
            string B = Console.ReadLine();
            string C = Console.ReadLine();
            Console.WriteLine(A.Substring(0, 1)+B.Substring(1,1)+C.Substring(2,1));
        }
    }
}


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

typedef long long ll;
const ll mod=1e9+7;
const ll N=1001;
const ll INF=1e10;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	int x;
	cin>>x;
	cout<<(!x);
}	  


Measured memory_bytes: 3644
#include <iostream>
#include <set>
#include <list>

using namespace std; 

int
main(int argc, char const *argv[])
{
    list<uint64_t> l;
    uint64_t tmp = 0;
    uint64_t ans = 0;

    for (auto i = 0; i < 5; i++) {
	uint64_t n;
	cin >> n;
	ans += (n /10) * 10;
	auto rest = n % 10;
	if (rest > 0) {
	    ans += 10;
	    tmp = max(tmp, (10 - rest));
	}
    }

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


Measured memory_bytes: 256
from __future__ import print_function

from functools import reduce
from operator import mul
from collections import Counter
from collections import deque
from itertools import accumulate
from queue import Queue
from queue import PriorityQueue as pq
from heapq import heapreplace
from heapq import heapify
from heapq import heappushpop
from heapq import heappop
from heapq import heappush
import heapq
import time
import random
import bisect
import itertools
import collections
from fractions import Fraction
import fractions
import string
import math
import operator
import functools
import copy
import array
import re
import sys
sys.setrecursionlimit(500000)


input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def cmp_vec(u, v):
    if u[1] < v[1]:
        return -1
    elif u[1] == v[1]:
        if u[2] < v[2]:
            return -1
        elif u[2] == v[2]:
            return 0
        else:
            return 1
    else:
        return 1


def main():
    #
    n, m = map(int, input().strip().split())
    l = []
    for i in range(m):
        p, y = map(int, input().strip().split())
        p = str(p).zfill(6)
        l.append(list((i, p, y)))
    l.sort(key=functools.cmp_to_key(cmp_vec))

    #
    cntr = 1
    for i in range(m):
        if i > 0 and l[i][1] != l[i-1][1]:
            cntr = 1
        l[i][2] = str(cntr).zfill(6)
        cntr += 1

    #
    l.sort(key=lambda x: x[0])
    for xx in l:
        print(xx[1],end="")
        print(xx[2])


if __name__ == '__main__':
    main()


Measured memory_bytes: 120792
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 10007;

signed main(){
  int N; cin >> N;
  vector<int> a(N), num(100010), num1(100010);
  for(int i = 0; i < N; i++) {
  cin >> a[i];
  if(i % 2 == 0) num[a[i]]++;
  if(i % 2 == 1) num1[a[i]]++;
  }
  int p = max_element(num.begin(), num.end()) - num.begin();
  int q = max_element(num1.begin(), num1.end()) - num1.begin();
  int ans;
  if(p != q){
    ans = N - (num[p] + num1[q]);
  }
  if(p == q){
    sort(num.begin(), num.end()); reverse(num.begin(), num.end());
    sort(num1.begin(), num1.end()); reverse(num1.begin(), num1.end());
    ans = min(N - (num[0] + num1[1]), N - (num[1] + num1[0]));
  }
  cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
ll mo=1000000007;
int main() 
{ 
	ll t1=1;
	//cin>>t1;
	while(t1)
	{
		ll x,y;
		cin>>x>>y;
		if(y>x*4 || y<x*2 || y%2!=0)cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
		t1--;
    }
    return 0; 
}

Measured memory_bytes: 3636
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
    ll a, b;
    cin >> a >> b;
    if(a % 2 != 0 && b % 2 != 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 888
#include <stdio.h>

int main(void)
{
	int i,j,data;
	int a[10];
	for(i=0;i<10;i++){
		scanf("%d",&data);
		a[i]=data;
	}
	for(i=0;i<10;i++){
		j=i;
		while(j>=1 && a[j-1] > a[j]){
			data=a[j]; a[j]=a[j-1]; a[j-1]=data;
			j--;
		}
	}
	for(i=9;i>6;i--)
	printf("%d\n",a[i]);
	return 0;
}


Measured memory_bytes: 2136
#define within(x, _l, _r) ((x >= _l) && (x <= _r))
#include <iostream>
using namespace std;

const int MAXN = 1e2;
char mat[MAXN][MAXN];
int n, m, res;

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

void dfs(int cx, int cy){
    char save = mat[cx][cy];
    mat[cx][cy] = '!';
    for (int i = 0; i < 4; ++ i){
        int nx = cx + dx[i], ny = cy + dy[i];
        if (within(nx, 0, n - 1) && within(ny, 0, m - 1) && mat[nx][ny] == save) dfs(nx, ny);
    }
}

int main(){
    while (cin >> n >> m){
        if (n == 0 && m == 0) break;
        res = 0;
        for (int i = 0; i < n; ++ i){
            for (int j = 0; j < m; ++ j){
                cin >> mat[i][j];
            }
        }

        for (int i = 0; i < n; ++ i){
            for (int j = 0; j < m; ++ j){
                if (mat[i][j] == '!') continue;
                dfs(i, j);
                ++ res;
            }   
        }

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


Measured memory_bytes: 3536
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));
  
  $a = [];
  list($o) = explode(" ", trim(fgets(STDIN)));
  $a[$o] = true;
  for ($i=1; $i<$n; $i++) {
    list($w) = explode(" ", trim(fgets(STDIN)));
    if(isset($a[$w])){
      echo "No";
      exit;
    }
    if($w[0] !== substr($o, strlen($o)-1, 1)){
      echo "No";
      exit;
    }
    $o = $w;
    $a[$w] = true;
  }
  echo "Yes";

Measured memory_bytes: 16288
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

vector<vector<int>> g;



int main(){
   int n,m;
   cin >> n >> m;
   g.resize(n);
   rep(i,m){
      int a,b;
      cin >> a >> b;
      a--;b--;
      g[a].push_back(b);
      g[b].push_back(a);
   }
   vector<int> ans(n,-1);
   queue<int> q;
   q.push(0);
   auto f = [&]{
      while(!q.empty()){
         int nx = q.front();q.pop();
         for (auto w :g[nx]){
            if (ans[w] != -1) continue;
            ans[w] = nx;
            q.push(w); 
         }
      }
   };
   f();
   cout << "Yes" << endl;
   rep(i,n){
      if (i == 0) continue;
      cout << ans[i] + 1 << endl;
   }
   return 0; 

}


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

int main(){
    string s;
    cin >> s;
    int ans=0;
    rep(i,4){
        if(s[i] == '+') ++ans;
        else --ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	long A,B,N,a,b;
	cin>>A>>B>>N;
	if(N<B){
		a=(A*N)/B;
		b=A*(long)(N/B);
	}else{
		a=(A*(B-1))/B;
		b=A*(long)((B-1)/B);
	}
	cout<<a-b;
	return 0;
}

Measured memory_bytes: 3592
module S = Set.Make (struct type t = int let compare = compare end)

let () =
    let main () =
        let n, m = Scanf.sscanf (read_line ()) "%d %d" (fun n m -> n, m) in
        let uv = Array.init m (fun _ -> Scanf.sscanf (read_line ()) "%d %d" (fun u v -> u, v)) in
        let s, t = Scanf.sscanf (read_line ()) "%d %d" (fun s t -> s, t) in
        let u = Array.make (n + 1) S.empty in
        Array.iter (fun (uu, vv) -> u.(uu) <- S.add vv u.(uu)) uv;
        (*
        let v = Array.make (n + 1) S.empty in
        for i = 1 to n do
            let set = S.fold (fun k s2 -> S.union u.(k) s2) u.(i) S.empty in
            v.(i) <-  S.fold (fun k s2 -> S.union u.(k) s2) set   S.empty
        done;
        *)
        let visited = Array.make_matrix 3 (n + 1) (-1) in
        visited.(0).(s) <- 0;
        let rec loop step frontier =
            if S.cardinal frontier = 0 then (-1) else
                let curs  = step mod 3 in
                let frontier =
                    S.fold (fun e next_frontier ->
                        S.fold (fun f next_frontier ->
                            if visited.(curs).(f) >= 0 then next_frontier else (
                                visited.(curs).(f) <- step;
                                S.add f next_frontier
                            )
                        ) u.(e) next_frontier
                    ) frontier S.empty
                in
                if visited.(0).(t) >= 0 then visited.(0).(t) / 3 else loop (step + 1) frontier
        in
        let result = loop 1 (S.singleton s) in
        Printf.printf "%d\n" result
    in
    main ()

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

int main() {
  int A, B;
  cin >> A >> B;
  if(A == B) {
    cout << "Draw";
  }
  else if(A == 1) {
    cout << "Alice";
  }
  else if(B == 1) {
    cout << "Bob";
  }
  else {
    if(A > B) {
      cout << "Alice";
    }
    else {
      cout << "Bob";
    }
  }
}


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

int main() {
    using vi = vector<int>;
    
    string s;
    cin >> s;
    if(s == "ABC"){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(void){
  long N,K;
  scanf("%ld%ld",&N,&K);
  long counter = 0;
  long sample = K;

  if(K%2 == 0){
    long hoge = 0;
    for(int i = 1;i <= N;i++){
      if(i%K == 0){
        counter++;
      }
      if(i%K == K/2){
        hoge++;
      }
    }
    printf("%ld\n",counter*counter*counter+hoge*hoge*hoge);
  }else{
    for(int i = 1;i <= N;i++){
      if(i%K == 0){
        counter++;
      }
    }
    printf("%ld\n",counter*counter*counter);
  }

  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
//#define scanf scanf_s
typedef long long int lli;

// ITP1_2_B
// 3整数a,b,cを読み込み、a<b<cを満たすなら"Yes"、満たさないなら"No"を出力
int main()
{
	int iInputA,iInputB, iinputC;
	scanf("%d %d %d", &iInputA, &iInputB, &iinputC);

	if (iInputA < iInputB && iInputB < iinputC) {
		printf("Yes\n");
		return 0;
	}

	printf("No\n");

	return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#define int long long
#define endre getchar();getchar();return 0
#define moder 1000000007
#define inf 1000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int kai(int x) {
	if (x == 0)return 1;
	return (kai(x - 1)*x) % moder;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
map<int, int> factor(int m) {
	map<int, int>res;
	for (int i = 2; i*i <= m; i++) {
		while (m%i == 0) {
			res[i]++;
			m /= i;
		}
	}
	if (m != 1)res[m]++;
	return res;
}

/*--------Library Zone!--------*/


signed main() {
	string s;
	cin >> s;
	if (s[0] == s.back()) {
		if (s.size() % 2 == 0)cout << "First" << endl;
		else cout << "Second" << endl;
	}
	else {
		if (s.size() % 2)cout << "First" << endl;
		else cout << "Second" << endl;
	}
	endre;
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;

public class Main {
    ArrayList<Board> bs;

    public static void main(String[] args) {
        Main m = new Main();
        m.read();
        m.solve();
    }

    private void read() {
        String line;
        char[] ls;
        String[] elems;
        bs = new ArrayList<>();
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            while ((line = br.readLine()) != null && !line.equals("")) {
                elems = line.split(" ");
                int w = Integer.parseInt(elems[0]);
                int h = Integer.parseInt(elems[1]);
                if (w == 0 && h == 0)
                    break;
                Board b = new Board(w, h);
                for (int i = 0; i < h; i++) {
                    ls = br.readLine().toCharArray();
                    for (int j = 0; j < w; j++) {
                        if (ls[j] == '@') {
                            b.board[i][j] = true;
                            b.init = new Tuple(i, j);
                        }
                        else {
                            b.board[i][j] = ls[j] == '.';
                        }
                    }
                }
                this.bs.add(b);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private void solve() {
        for (Board b: bs) {
            boolean[][] graph = b.board;
            boolean[][] used = new boolean[b.h][b.w];
            Queue<Tuple> queue = new LinkedList<>();
            queue.add(b.init);
            int ans = 0;
            while (!queue.isEmpty()) {
                Tuple crr = queue.poll();
                if (used[crr.fst][crr.snd])
                    continue;
                used[crr.fst][crr.snd] = true;
                ans++;
                int x, y;
                for (int dx = -1; dx <= 1; dx++) {
                    for (int dy = -1; dy <= 1; dy++) {
                        if (dx != 0 && dy != 0)
                            continue;
                        x = crr.snd + dx;
                        y = crr.fst + dy;
                        if (0 <= x && x < b.w && 0 <= y && y < b.h)
                            if (graph[y][x] && !used[y][x])
                                queue.add(new Tuple(y, x));
                    }
                }
            }
            System.out.println(ans);
        }
    }

    private class Board {
        int w, h;
        Tuple init;
        boolean[][] board;
        Board(int w, int h) {
            this.w = w;
            this.h = h;
            board = new boolean[h][w];
        }
    }

    private class Tuple {
        int fst, snd;
        Tuple(int f, int s) {
            fst = f;
            snd = s;
        }
    }
}

Measured memory_bytes: 29624
#include<bits/stdc++.h>
#define endl "\n" 
#define pi acos(-1)
#define ll long long 
using namespace std;
void att(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
}
void sirra(){
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif
}
void solve();
int main(){
	att();sirra();
	int q=1;//cin>>q;
	while(q--){
		solve();
	}
	return 0;
}
void solve(){
	int l,r,d,p=0;cin>>l>>r>>d;
    for(int i=l;i<=r;i++)
    {
        if(i%d==0)
            p++;
    }
    cout<<p;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin >> s;
    reverse(s.begin(),s.end());
    bool hata;
    while(s.size() > 0) {
        hata = true;
        if(s.substr(0,7) == "remaerd") {
            s.erase(s.begin(),s.begin() + 7);
            hata = false;
        }
        if(s.substr(0,6) == "resare") {
            s.erase(s.begin(),s.begin() + 6);
            hata = false;
        }
        if(s.substr(0,5) == "maerd") {
            s.erase(s.begin(),s.begin() + 5);
            hata = false;
        }
        if(s.substr(0,5) == "esare") {
            s.erase(s.begin(),s.begin() + 5);
            hata = false;
        }
        if(hata) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}


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

int main() {
  uint32_t N = 0;
  std::cin >> N;
  std::vector<int32_t> A(N);
  for (auto &&a : A) std::cin >> a;

  uint32_t ans = 0;
  bool prev = false, start = false;
  for (size_t i = 1; i < N; i++) {
    if (A[i - 1] == A[i]) continue;
    if (A[i - 1] > A[i]) {
      bool flag = !prev && start;
      ans += flag;
      start = !flag;
      prev = true;
    } else {
      bool flag = prev && start;
      ans += flag;
      start = !flag;
      prev = false;
    }
  }

  std::cout << ans + 1 << std::endl;

  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll K; cin>>K;
  string S; cin>>S;
  ll Ssz=S.size();
  for(ll i=0; i<min(K,Ssz); i++) cout<<S[i];
  if(Ssz>K) cout<<"..."<<endl;
}

Measured memory_bytes: 3628
S = []
P = []
B = []
def re(n,i)
  if n == 0 && i == 1
    1
  elsif i == 0
    0
  elsif i <= 1 + S[n-1]
    re(n-1,i-1)
  elsif i == 2 + S[n-1]
    re(n-1,i-2) + 1
  elsif i < S[n] - 1
    P[n-1] + 1 + re(n-1,i-2-S[n-1])
  elsif i == S[n] - 1
    P[n]
  elsif i == S[n]
    P[n]
  end
end
n,x = gets.chomp.split(" ").map(&:to_i)
P[0] = 1
S[0] = 1
B[0] = 0
n.times do |i|
  S[i+1] = S[i] * 2 + 3
  P[i+1] = P[i] * 2 + 1
  B[i+1] = S[i+1] - P[i+1]
end
puts re(n,x)

Measured memory_bytes: 14344
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let f: Vec<Vec<i64>> = (0..n).map(|_| (0..10).map(|_| input()).collect()).collect();
    let p: Vec<Vec<i64>> = (0..n).map(|_| (0..11).map(|_| input()).collect()).collect();

    let mut ans = i64::min_value();
    for i in 1..1024 {
        let mut temp = 0;
        for j in 0..n {
            let mut c = 0;
            for k in 0..10 {
                if f[j][k] > 0 && (i & (1 << k) > 0) {
                    c += 1;
                }
            }
            temp += p[j][c];
        }
        ans = std::cmp::max(ans, temp);
    }

    println!("{}", ans);
}


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

int main() {
  int A,B;
  cin >> A >> B;
  
  vector<int> NA(0);
  int na;
  if (A * 100 % 8 == 0){
    na = A * 100 / 8;
  }
  else {
    na = A * 100 / 8 + 1;
  }
  while (na * 8 / 100 == A){
    NA.push_back(na);
    na++;
  }
  
  int N = NA.size();
  bool notfound = true;
  for (int i = 0; i < N; i++){
    if(NA.at(i) / 10 == B){
      cout << NA.at(i) << endl;
      notfound = false;
      break;
    }
  }
  if (notfound) cout << "-1" << endl;
}
    


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

template<typename T> T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }

const int MOD = 1000000007;

int main() {
    int A, B;
    cin >> A >> B;
    int d = abs(A - B);
    if (d % 2) cout << "IMPOSSIBLE" << endl;
    else cout << min(A, B) + d / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
# a = [0] * m
# b = [0] * m
# for i in range(m):
#     a[i], b[i] = map(int, input().split)
answer = [0] * (n+1)
for _ in range(m):
    a, b = map(int, input().split())
    answer[a] += 1
    answer[b] += 1

for i in range(1, n+1):
    print(answer[i])

Measured memory_bytes: 3060
n,m = map(int,input().split())
x = list(map(int,input().split()))

x.sort()
y = []
if n>=m:
    print(0)
else:
    for i in range(0,m-1):
        y.append(x[i+1]-x[i])
    y.sort()
    s = sum(y[0:m-n])
    print(s)


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

using namespace std;

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define SQ(a) (a)*(a)

template <class T, class U> ostream& operator<< (ostream &out, pair<T,U> c) { out << "(" << c.first << " "; out << c.second << ")"; return out; }
template <class T> ostream& operator<< (ostream &out, vector<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
template <class T> ostream& operator<< (ostream &out, set<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
const double PI  = 3.141592653589793238463;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    cout << s[0] << s.size() - 2 << s[s.size()-1];
    cout << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main
{
	
	private void solve()throws Exception
	{
		int l=nextInt();
		int r=nextInt();
		int d=nextInt();
		out.println(r/d-(l-1)/d);
	}

	 
	///////////////////////////////////////////////////////////

	public void run()throws Exception
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws Exception{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws Exception{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws Exception{
		return br.readLine();
	}
	int nextInt()throws Exception{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws Exception{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws Exception{
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 32880
#include<iostream>
        #include<string>
        #include<vector>
        #include<math.h>
        #include<cmath>
        #include<stack>
        //#include<stdlib.h>
        using namespace std;
        int main() {
        	long long int q, h, s, d, n, i, a=0;
        	cin >> q >> h >> s >> d >> n;
        	q *= 4; h *= 2;
        	if (q < h) { i = q; }
        	else { i = h; }
        	if (i > s) { i = s; }
        	if(i*2>d)
        	{
        		if ((n & 1) == 1) { n--; a = i; }
        		a += (n / 2)*d;
        	}
        	else
        	{
        		a = i * n;
        	}
        	cout << a;
        	return 0;
        }

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

int main() {
	int a[4][2] = {0};
	double in[2];
	while(cin >> in[0] >> in[1]) {
		for(int i = 0; i < 2; i++) {
			if(in[i] < 0.2)
				a[3][i]++;
			else if(in[i] < 0.6)
				a[2][i]++;
			else if(in[i] < 1.1)
				a[1][i]++;
			else
				a[0][i]++;
		}
	}
	for(int i = 0; i < 4; i++)
		cout << a[i][0] << " " << a[i][1] << endl;
}

Measured memory_bytes: 1224
def main(input = STDIN)
  while (n = input.gets.to_i) != -1
    cood = Complex(1, 0)
    (n - 1).times{cood = one_step(cood)}
    puts cood.rect.map{|i|i.to_f.round(2)}
  end
end
def one_step(cood)
  return Complex.polar(1, cood.phase + Math::PI / 2) + cood
end
main

Measured memory_bytes: 6264
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <algorithm>
#include <functional>
using namespace std;


int main(){
	

	int i,j;
	int N;
	long long sum = 0;
	cin >> N;
	vector<long long>number(N * 3);
	long long tmp;
	for (i = 0; i < 3*N; i++){
		cin >> number[i];
	}
	/* 数値を降順にソート */
	sort(number.begin(), number.end(), greater<long long>());

	for (i = 1; i < 2 * N; i+=2){
		sum = sum + number[i];
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>

using namespace std;
typedef long long LL;

int main(){
  int N;
  cin >> N;
  vector<LL>  A(N);
  
  for(int i=0;i<N;i++){
	cin >> A[i];	
  }
  sort(A.begin(),A.end(),greater<LL>());

  LL area=1;
  LL pre_A=A[0];
  int count=0;
  for(int i=1;i<N;i++){	
	if(A[i]==pre_A){
	  area*=A[i];
	  pre_A=-1;
	  count++;
	  if(count>=2){
		break;
	  }
	}else{
	  pre_A=A[i];
	}
  }

  if(count>=2){
	cout << area << endl;
  }else{
	cout << 0 << endl;
  }

  return 0;
}

Measured memory_bytes: 1024
N, K = map(int, input().split())

if K == 0:
    print(N * N)
else:
    ans = 0
    for b in range(K + 1, N + 1):
        ans += (N // b) * (b - K)
        ans += max(0, N % b - K + 1)
    print(ans)

Measured memory_bytes: 2940
//Author : Vipul Sharma
 
// LIBRARIES

#include<iostream>
#include<set>
#include<algorithm>
#include<map>
#include <bits/stdc++.h>
 
// MACROS
#define ll long long int
#define ld long double
#define rep(i, a, b) for ( i = a; i < b; i++)
#define rev(i,b,a) for( i=b-1;i>=a;i--)
#define eqrep(i,b) for( i=1;i<=b;i++)
#define itrep(at) for (auto it = at.begin(); it != at.end(); it++)
#define ld long double
#define pb push_back
#define eb emplace_back
#define w(t) while (t--)
#define booster                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define mod 1000000007
#define endl "\n"
#define deb1(x) cout << #x << " : " << x << endl;
#define deb2(x, y) cout << #x << " : " << x << "\t" << #y << " : " << y << endl;
#define deb3(x, y, z) cout << #x << " : " << x << "\t" << #y << " : " << y << "\t" << #z << " : " << z << endl;
#define deb4(x, y, z, w) cout << #x << " : " << x << "\t" << #y << " : " << y << "\t" << #z << " : " << z << "\t" << #w << " : " << w << endl;
#define deb5(a, b, c, d, e) cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define deb6(a, b, c, d, e, f) cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
 
using namespace std;
long long cost = 1e18;
 
 
 
int main()
{
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	booster;
	map<string,ll>umap;
	ll n;
	cin>>n;
	ll ac=0,wa=0,tle=0,re=0;
	w(n)
	{
		string s;
		cin>>s;
		
		if(s=="AC") ac++;
		else if(s=="WA") wa++;
		else if(s=="TLE") tle++;
		else re++;
	}
	cout<<"AC"<<" x "<<ac<<endl;
	cout<<"WA" <<" x "<< wa<<endl;
	cout<<"TLE"<<" x "<<tle<<endl;
	cout<<"RE"<<" x "<<re<<endl;
	//cout<<umap.size()<<endl;
	return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

/**
 * https://abc074.contest.atcoder.jp/tasks/arc083_b
 */
public class Main {

	public static void main(String[] args) {
				
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[][] g = new int[N][N];
		for(int i=0; i<N; i++){
			for(int j=0; j<N; j++){
				g[i][j] = Integer.parseInt(sc.next());
			}
		}
		sc.close();
		
		long[][][] costs = getAllPairsMinimumCost(g, Integer.MAX_VALUE/2);

		long ans = 0;
		for(int y=0; y<N; y++){
			for(int x=0; x<N; x++){
				if(g[y][x]!=costs[0][y][x]){
					ans = -1;
					break;
				}else{
					if(costs[1][y][x]==0){
						ans += g[y][x];
					}
				}
			}
			if(ans==-1) break;
		}
		if(ans>=0) ans = ans/2;
		System.out.println(ans);
		
	}

	static long[][][] getAllPairsMinimumCost(int[][] g, long inf){
		final long[][][] costs = new long[2][g.length][g.length];
		for(int y=0; y<g.length; y++){
			for(int x=0; x<g.length; x++){
				costs[0][y][x] = g[y][x];
			}
		}
		for(int k=0; k<g.length; k++){
			for(int i=0; i<g.length; i++){
				if(costs[0][i][k]==inf) continue;
				for(int j=0; j<g.length; j++){
					if(costs[0][k][j]==inf) continue;
					if(costs[0][i][j]>=costs[0][i][k]+costs[0][k][j]){
						if(i!=k && k!=j) costs[1][i][j]=1; 
					}
					costs[0][i][j] = Math.min(costs[0][i][j], costs[0][i][k]+costs[0][k][j]);
				}
			}
		}
		return costs;
	}
	
}

Measured memory_bytes: 48760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n) for(ll i=0;i<(n);i++)
#define For1(i,n) for(ll i=1;i<(n);i++)
#define MOD 1000000007
int main(){
    string s;cin>>s;
    ll n=s.size();
    vector<ll> bottom,top;
    vector<ll> ans(n,0);
    For1(i,n){
        if(s.at(i-1)=='R'&&s.at(i)=='L'){
            bottom.push_back(i-1);
        }
        if(s.at(i-1)=='L'&&s.at(i)=='R'){
            top.push_back(i-1);
        }
    }
    top.push_back(MOD);
    ll topi=0,bottomi=0;
    For(i,n){
        if(i>top.at(topi)){
            topi++;bottomi++;
        }
        ans.at(bottom.at(bottomi)+(bottom.at(bottomi)+i)%2)++;
    }
    For(i,n){
        cout<<ans.at(i)<<" ";
    }
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define INF 1e9
#define endl '\n'
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define FORE(i, a, b) for (int i = (a), e = (b); i < e; ++i)
#define RFORE(i, a, b) for (int i = (b)-1, e = (a); i >= e; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())
using namespace std;
typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    vector<int> x(N);
    vector<int> y(N);
    vector<ll>  h(N);
    for (int i = 0; i < N; i++) {
        cin >> x.at(i) >> y.at(i) >> h.at(i);
    }
    FOR(Cx, 0, 101) {
        FOR(Cy, 0, 101) {
            FOR(i, 0, N) {
                if (h.at(i) > 0) {
                    int HH    = h.at(i) + abs(x.at(i) - Cx) + abs(y.at(i) - Cy);
                    int count = 0;
                    FOR(j, 0, N) {
                        if (h.at(j) ==
                            max(HH - abs(x.at(j) - Cx) - abs(y.at(j) - Cy),
                                0)) {
                            ++count;
                        }
                    }
                    if (count == N) {
                        cout << Cx << " " << Cy << " " << HH << endl;
                        exit(0);
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 3660
n,c,k = map(int,input().split())
t = []
for i in range(n):
    t.append(int(input()))

t.sort()

ans = 0
cnt = 0
tmp = 0
s = t[0]

while tmp < n:
    t1 = t[tmp]
    cnt += 1
    if t1 - s > k:
        ans += 1
        cnt = 1
        s = t[tmp]
    elif cnt == c:
        if tmp < n - 1:
            s = t[tmp + 1]
            ans += 1
            cnt = 0

    tmp += 1

if cnt > 0:
    ans += 1

print(ans)


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

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

    for( int i = a; i <= b; i++ ){
        if( i < a+k ) cout << i << endl;
        else if( (b-k) < i ) cout << i << endl; 
    }

    return 0;
}

Measured memory_bytes: 256
import re

def dfs(i, formula_str):
    if i == 4:
        res = int(formula_str[0])
        for j in range(2, 7, 2):
            if formula_str[j-1] == "+":
                res += int(formula_str[j])
            else:
                res -= int(formula_str[j])
        if res == 7:
            return True, formula_str
        return False, formula_str
    else:
        f_1, formula_str_1 = dfs(i+1, formula_str + "+" + s[i])
        f_2, formula_str_2 = dfs(i+1, formula_str + "-" + s[i])
        if f_1:
            return True, formula_str_1
        elif f_2:
            return True, formula_str_2
        else:
            return False, None

s = input()
f, ans = dfs(1, s[0])
print(ans + "=7")


Measured memory_bytes: 9932
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll n,k;
vector<ll> a,h,l;
ll ans,c0;

void f(ll lw,ll hi){
    if(lw>hi) return ;
    ll mid=(lw+hi)/2;
    ll cnt=0;

    //lから探す
    rep(i,l.size()){
        ll target=mid/l[i];
        ll idx=lower_bound(ALL(l),target+1)-l.begin();
        cnt+=max(0ll,idx-i-1);
    }
    rep(i,h.size()){
        ll target=mid/h[i];
        ll idx=lower_bound(ALL(h),target+1)-h.begin();
        cnt+=max(0ll,idx-i-1);
    }

    if(cnt>=k){
        ans=mid;
        f(lw,mid-1);
    }else{
        f(mid+1,hi);
    }
}

void g(ll lw,ll hi){
    if(lw>hi) return ;
    ll mid=(lw+hi)/2;
    ll cnt=0;
    //mid以上は何個?
    rep(i,h.size()){
        ll target=(h[i]+mid-1)/h[i];
        // cout<<target<<"="<<mid<<"/"<<h[i]<<endl;
        ll idx=l.end()-lower_bound(ALL(l),target);
        cnt+=idx;
    }
    if(cnt>=k){
        ans=mid;
        g(mid+1,hi);
    }else{
        g(lw,mid-1);
    }
}

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

    cin>>n>>k;
    a.resize(n);
    rep(i,n) cin>>a[i];
    sort(ALL(a));
    
    rep(i,n){
        if(a[i]<0){
            l.push_back(a[i]);
        }
        else if(a[i]==0){
            c0++;
        }else{
            h.push_back(a[i]);
        }
    }
    ll mians=(ll)(l.size()*h.size());
    ll plans=(l.size()+1)*l.size()/2+(h.size()+1)*h.size()/2;
    ll zrans=c0*(l.size()+h.size())+c0*(c0-1)/2;

    // debug(l);
    // debug(h);

    if(mians>=k){
        rep(i,l.size()) l[i]=-l[i];
        sort(ALL(l));
        g(0,LINF);
        cout<<-ans<<endl;
    }else if(mians+zrans>=k){
        cout<<0<<endl;
    }else{
        //答えが正
        k-=zrans;
        k-=mians;
        rep(i,l.size()){
            l[i]=-l[i];
        }
        reverse(ALL(l));
        f(0,LINF);
        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 4084
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		int ans = kazoeru(N);
		for(long i = 1L;i * i <= N; i++) {
			if(N % i != 0) {
				continue;
			}
			long b = N / i;
			int s = Math.max(kazoeru(i), kazoeru(b));
			if(ans > s) {
				ans = s;
			}
		}
		System.out.println(ans);
	}
	public static int kazoeru(long i) {
		int ret = 1;
		while(i >=10) {
			i /= 10;
			ret++;
		}
		return ret;
	}
}


Measured memory_bytes: 21844
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <stack>

using namespace std;

typedef long long LL;
#define FAST ios::sync_with_stdio(false);
const int MaxN = 105;
priority_queue <string,vector<string>,greater<string> > que;
int main()
{
	int n , l;
	cin >> n >> l;
	while(n--){
		string a;
		cin >> a;
		que.push(a);
		}
	while(!que.empty())
	{
		string s;
		s = que.top();
		cout << s;
		que.pop();
		}
	cout << endl;
	return 0;
	}

Measured memory_bytes: 256
a=int(input())
li = [int(input()) for i in range(a)]
li.sort()

ans=0
cnt=1
for i in range(a-1):
  if li[i+1]==li[i]:
    if cnt==1:
      cnt=0
    else:
      cnt=1
  else:
    if cnt==1:
      ans+=1
    else:
      cnt=1

if cnt==1:
  ans+=1

print(ans)

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

int main() {
  int N,A,B,p,q;
  cin>>N>>A>>B;
  p=N*A;
  q=B;
  if(p>=q){
    cout<<q<<endl;
  }else if(p<q){
  	cout<<p<<endl;
  }
  
 }

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

int n;
long m, a, c, s;
map<long, long> x;

int main(){
	cin >> n >> m;
	x.emplace(0, 1);
	c = 0;
	for (int i = 0; i < n; ++i){
		cin >> a;
		c = (c + a) % m;
		if (x.find(c) != x.end()) x.at(c)++;
		else x.emplace(c, 1);
	}
	s = 0;
	for (auto &e: x){
		s += e.second*(e.second-1)/2;
	}
	cout << s;
}

Measured memory_bytes: 4224
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e10
using namespace std;
typedef pair<ll, ll> P;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

int main(void){
	int n, k, ans = 0;
	string s;
	cin >> n >> k >> s;
	if (n == 1) {
		cout << 1 << endl;
		return 0;
	}
	vector<int>nums;
	if (s[0] == '0')nums.push_back(0);
	for (int i = 0;i < (int)s.size();) {
		int j = i;
		while (j < (int)s.size() && (s[j] == s[i]))++j;
		nums.push_back(j - i);
		i = j;
	}
	if (s.back() == '0')nums.push_back(0);
	vector<int>sum((int)nums.size() + 1, 0);
	for (int i = 0;i < (int)nums.size();++i)sum[i + 1] = sum[i] + nums[i];
	for (int i = 0;i < (int)sum.size();i+=2) {
		int x = i + 2 * k + 1;
		if (x >= (int)sum.size()) x = (int)sum.size() - 1;
		ans = max(ans, sum[x] - sum[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1272
#include <iostream>
#include <vector>
#include <map>
#include <set>

typedef long long int ll;

using namespace std;
ll a,b,c,aa[100000],bb[100000];
bool ra,rb,rc;
vector<int> va,vb;

#define CE cout<<endl
#define C cout<<
#define E <<endl


int main(){
    cin>>c;
    cin>>a>>b;
    ra=false;
    for(int i=1;i<=1000;i++){
        ra = ra or (a<=i and i<=b and i%c==0);
    }
    C (ra ? "OK":"NG") E;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;

int main()
{
	int A, B;
	char op;

	cin >> A >> op >> B;

	if (op == '+') cout << A + B << endl;
	else cout << A - B << endl;

	return 0;
}


Measured memory_bytes: 256
n=int(input())
lst=[list(map(int,input().split())) for _ in range(n)]
dp=[[0]*3 for i in range(n+1)]

def chmax(x,y):
    if x>y:
        return x
    else:
        return y

for i in range(1,n+1):
    for j in range(3):
        for k in range(3):
            if(j==k):
                continue
            dp[i][k]=max(dp[i][k],dp[i-1][j]+lst[i-1][k])
print(max(dp[n]))


Measured memory_bytes: 74104
import sys
sys.setrecursionlimit(10**7)
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 II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    A, B = LI()

    taps = 0
    while 1 + taps * (A - 1) < B:
        taps += 1
    print(taps)

main()

Measured memory_bytes: 3064