akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#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>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline long toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline long toLong(string s) {long v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-6;
const long INF = 1e10;

int mis[51][11],sum[51],cnt[51];
int main(){
	int M,T,P,R;
	while(cin>>M>>T>>P>>R){
		if(M==0&&T==0&&P==0&&R==0)break;
		CLR(mis);CLR(sum);CLR(cnt);
		REP(i,R){
			int m,t,p,j;
			cin>>m>>t>>p>>j;
			if(j==0){
				sum[t]+=20*mis[t][p]+m;
				cnt[t]++;
			}else{
				mis[t][p]++;
			}
		}
		vector<pair<pair<int,int>,int> >res;
		REP(i,T)res.PB(MP(MP(-cnt[i+1],sum[i+1]),-(i+1)));
		SORT(res);
		REP(i,SZ(res)){
			cout<<-res[i].second;
			if(i==SZ(res)-1)cout<<endl;
			else if(res[i].first==res[i+1].first)cout<<"=";
			else cout<<",";
		}
	}
	return 0;
}

Measured memory_bytes: 1200
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>

using namespace std;

int main() {
	int i, j;
	string S;

	cin >> S;

	for (i = 1; i <= S.length(); i++) {
		if (i % 2 == 1) {
			cout << S[i-1];
		}

	}
	cout << endl;




	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (ll i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    rep(i, 5){
        int x;
        cin >> x;
        if(x==0){
            cout << i+1 << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3532
#include<bits/stdc++.h>
using namespace std;
#define int long long
int w,h,v,t,l;
struct Point{
  int x,y;
  Point(){}
  Point(int x,int y):x(x),y(y){}
  Point operator+(Point a){return Point(x+a.x,y+a.y);};
  Point operator-(Point a){return Point(x-a.x,y-a.y);};
  bool operator==(Point a)const{
    return x==a.x&&y==a.y;
  }
};
Point s,e;
int norm(Point p){
  return p.x*p.x+p.y*p.y;
}
int norm2(Point p){
  p.x*=w;p.y*=h;
  p=p-s;
  //cout<<p.x*p.x+p.y*p.y<<endl;
  return p.x*p.x+p.y*p.y;
}
int check(Point p){
  int res=0;
  if(norm2(p)<=l*l) res++;
  p.x++;
  if(norm2(p)<=l*l) res++;
  p.y++;
  if(norm2(p)<=l*l) res++;
  p.x--;
  if(norm2(p)<=l*l) res++;
  p.y--;
  if(!res){
    if(p.y==0){
      if(p.x>=0){
	//cout<<s.x+p.x*w<<":"<<l<<endl;
	if(p.x*w-s.x<=l) return 5;
      }else{
	if(s.x-(p.x+1)*w<=l) return 5;
      }
    }
    if(p.x==0){
      if(p.y>=0){
	if(p.y*h-s.y<=l) return 5;
      }else{
	if(s.y-(p.y+1)*h<=l) return 5;
      }
    }
  }
  return res;
}
int check2(Point p){
  if(check(p)==4) return 0;
  Point r=Point(p.x*w,p.y*h);
  if(abs(p.x)%2) r.x+=w-e.x;
  else r.x+=e.x;
  if(abs(p.y)%2) r.y+=h-e.y;
  else r.y+=e.y;
  return norm(r-s)<=l*l;
}

signed main(){
  cin>>w>>h>>v>>t;
  cin>>s.x>>s.y>>e.x>>e.y;

  int ans=0;
  l=v*t;
  //cout<<l<<endl;
  Point tp,bt,nt,nb;
  tp=bt=Point((s.x+l)/w,0);
  check(Point(0,0));
  for(int i=bt.x+1;s.x-l<=(i+2)*w;i--){
    tp.x=bt.x=i;

    nt=tp;nb=bt;
    nt.y++;nb.y--;
    while(check(nt)==4){
      tp=nt;
      nt.y++;
    }
    while(check(nb)==4){
      bt=nb;
      nb.y--;
    }

    while(check(tp)!=4&&tp.y>bt.y){
      tp.y--;
    }
    while(check(bt)!=4&&tp.y>bt.y){
      bt.y++;
    }

    nt=tp;nb=bt;
    if(tp==bt) nb.y--;    
    while(check(nt)){
      ans+=check2(nt);
      nt.y++;
    }
    while(check(nb)){
      ans+=check2(nb);
      nb.y--;
    }
    
    //cout<<tp.x<<" "<<tp.y<<":"<<bt.x<<" "<<bt.y<<endl;
    //cout<<check(tp)<<" "<<check(bt)<<endl;
    assert(tp.y>=bt.y);
    if(check(tp)==4&&check(bt)==4) ans+=tp.y-bt.y+1;
  }
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3108
#include <stdio.h>

int main(void) {
	int a[4],b[4];
	int hit,brow;
	int i,j;
	while(!feof(stdin)) {
		if(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])==-1)break;
		scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);
		hit=0;brow=0;
		for(i=0;i<4;i++) {
			if(a[i]==b[i]) {
				hit++;
				a[i]=-1;
				b[i]=-1;
			}
		}
		for(i=0;i<4;i++) {
			if(a[i]==-1)continue;
			for(j=0;j<4;j++) {
				if(j==i)continue;
				if(a[i]==b[j]) {
					brow++;
					a[i]=-1;
					b[j]=-1;
					break;
				}
			}
		}
		printf("%d %d\n",hit,brow);
	}
	return 0;
}

Measured memory_bytes: 0
S = list(input())
N = len(S)


Z = 0
SUM = 0
for s in S:
  if s == "1":
    SUM += 1
    Z = max(Z,SUM)
  else:
    SUM -= 1

ruiseki_max = [0]
MAX = SUM
for s in S[1:][::-1]:
  if s == "1":
    SUM -= 1
  else:
    SUM += 1
    MAX = max(MAX,SUM)
  ruiseki_max.append(MAX-SUM)

def f(Z):
  SUM = 0
  MIN = 0
  for i in range(N):
    s = S[i]
    if s == "1":
      SUM += 1
    elif s == "0":
      SUM -= 1
      MIN = min(MIN,SUM)
    else:
      if SUM + 1 + ruiseki_max[N-1-i] <= Z:
        SUM += 1
      else:
        SUM -= 1
        MIN = min(MIN,SUM)
  return MIN

print(min(Z-f(Z),(Z+1-f(Z+1))))

Measured memory_bytes: 171420
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > piii;
#define pb push_back
#define NeedForSpeed ios_base::sync_with_stdio(0), cin.tie(0)
#define PI acos(-1)
#define all(c) c.begin(), c.end()
#define SET(x, y) memset((x), y, sizeof(x))
const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
const ll INF64 = 1e18;

template <typename T>
string to_string(const vector<T> &v) {
  string ret = "<";
  for (auto it : v)
    ret += to_string(it) + ", ";
  ret.pop_back(); ret.pop_back();
  ret += ">";
  return ret;
}

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

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

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

void debug_print() { cerr << endl; }

template <typename T, typename ...U>
void debug_print(T t, U... u) {
  cerr << " " << to_string(t);
  debug_print(u...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_print(__VA_ARGS__)
const int N = 1e5 + 5;

string s;

int main() {
  cin >> s;
  int ans = 0;
  int cur = 0;
  for (char c : s) {
    if (c == 'R')
      cur++;
    else cur = 0;
    ans = max(ans, cur);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
#pragma warning disable
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
using System.Collections;
using static System.Math;
using static System.Console;

class E { static void Main() => new J(); }
class J
{
	const int Mod = 1000000007;
	int F() => int.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	public J()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var I = G();
		int N = I[0], W = I[1];
		var w = new int[N];
		var v = new int[N];
		for (var i = 0; i < N; i++)
		{
			I = G();
			w[i] = I[0]; v[i] = I[1];
		}
		var mW = 3 * N;
		var dp = new int[N + 1, N + 1, mW + 1];
		for (var j = 0; j <= N; j++) for (var k = 0; k <= mW; k++) if (j != 0 || k != 0) dp[0, j, k] = -Mod;
		for (var i = 1; i <= N; i++)
		{
			var t = w[i - 1] - w[0];
			for (var j = i + 1; j <= N; j++) for (var k = 0; k <= mW; k++) dp[i, j, k] = -Mod;
			for (var j = 0; j <= i; j++) for (var k = 0; k <= mW; k++)
				{
					dp[i, j, k] = dp[i - 1, j, k];
					if (j > 0 && k >= t) dp[i, j, k] = Max(dp[i, j, k], dp[i - 1, j - 1, k - t] + v[i - 1]);
				}
		}
		var ans = 0;
		for (var j = 0; j <= N; j++) for (var k = 0; k <= mW; k++) if (k + (long)j * w[0] <= W) ans = Max(ans, dp[N, j, k]);
		WriteLine(ans);
	}
	long GCD(long a, long b)
	{
		var n = (ulong)Abs(a); var m = (ulong)Abs(b);
		if (n == 0) return (long)m; if (m == 0) return (long)n;
		int zm = 0, zn = 0;
		while ((n & 1) == 0) { n >>= 1; zn++; }
		while ((m & 1) == 0) { m >>= 1; zm++; }
		while (m != n)
		{
			if (m > n) { m -= n; while ((m & 1) == 0) m >>= 1; }
			else { n -= m; while ((n & 1) == 0) n >>= 1; }
		}
		return (long)n << Min(zm, zn);
	}
}

Measured memory_bytes: 25056
#include<iostream>

using namespace std;

int main(){
  int n,a,b; //1<=a<=b<=36
  int i,r,c,res;
  
  cin>>n>>a>>b;
  
  for(i=1;i<=n;i++){
    r=0;
    c=i;
    while(c!=0){
  	  r+=c%10;
      c/=10;
    }
    if(a<=r&&r<=b)
      res+=i;
  }
  cout<<res<<endl;    
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        int in;
        cin >> in;
        a[in] = i;
    }
    cout << a[1];
    for (int i = 2; i <= n; i++) {
        cout << " " << a[i];
    }
    cout << "\n";
    return 0;
}


Measured memory_bytes: 1152
n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)

if n % 2 == 0:
  cnt = n // 2
  cnf = a[0] + sum(a[1:cnt]) * 2

else:
  cnt = n //2
  cnf = a[0] + sum(a[1:cnt]) * 2 + a[cnt]

print(cnf)


Measured memory_bytes: 31556
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
 
ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
 
ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}


int n, right_low[200005];
ll DP[200005], arr[200005];


int main(){

    ios_base::sync_with_stdio(0);

    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>arr[i];

    stack<int> st;
    right_low[n] = n+1;
    st.push(n);
    for(int i=n-1;i>=1;i--){
        while(!st.empty() && arr[st.top()] >= arr[i])
            st.pop();
        if(st.empty())  right_low[i] = n+1;
        else    right_low[i] = st.top();
        st.push(i);
    }

// for(int i=1;i<=n;i++)   cout<<right_low[i]<<" ";cout<<endl;

    DP[n] = arr[n];
    for(int i=n-1;i>=1;i--){
        DP[i] = (right_low[i]-i)*arr[i] + DP[right_low[i]];
    }

    ll ans = 0;
    for(int i=1;i<=n;i++)
        ans += DP[i];
    cout<<ans;
    return 0;
}






Measured memory_bytes: 4992
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	a := readInt()
	s := read()
	if a >= 3200 {
		fmt.Println(s)
	} else {
		fmt.Println("red")
	}
}


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

func readInt() int {
	i, e := strconv.Atoi(read())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <numeric>
#include <map>
#include <climits>

int main(void) {
  int N, M;
  std::cin >> N;
  
  std::map<std::string, int> map;
  for (int i = 0; i < N; i++) {
    std::string s;
    std::cin >> s;
    if (map.count(s)) {
      map[s]++;
    } else {
      map[s] = 1;
    }
  }

  std::cin >> M;
  for (int i = 0; i < M; i++) {
    std::string s;
    std::cin >> s;
    if (map.count(s)) {
      map[s]--;
    } else {
      map[s] = -1;
    }
  }

  int max = 0;
  for (auto& point : map) {
    if (point.second > max) {
      max = point.second;
    }
  }
  
  std::cout << max << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


struct UnionFind {
    vll par;
    vll count;

    UnionFind(ll n) {
        par.resize(n), count.resize(n);
        rep(i, n) par[i] = i, count[i] = 1;
    }

    ll root (ll x) {
        if (par[x] == x) {
            return x;
        } else {
            return par[x] = root(par[x]);
        }
    }

    void unite(ll x, ll y) {
        ll rx = root(x);
        ll ry = root(y);
        if (rx == ry) return;
        if (rx > ry) {
            count[rx] += count[ry];
            par[ry] = rx;
        } else {
            count[ry] += count[rx];
            par[rx] = ry;
        }
    }

    bool same (ll x, ll y) {
        return root(x) == root(y);
    }

    ll size (ll x) {
        return count[root(x)];
    }
};

int main()
{
    ll N, M; cin >> N >> M;
    vll A(M), B(M);
    rep(i, M) {
        cin >> A[i] >> B[i]; A[i]--, B[i]--;
    }

    UnionFind tree(N);
    vll ans(M);

    ll res = N * (N - 1) / 2;
    for (ll i = M - 1; i >= 0; i--) {
        ll a, b;
        a = A[i], b = B[i];
        ans[i] = res;
        if (tree.same(a, b) == false) {
            // この橋が異なるグループをつなぐようなら
            ll asize = tree.size(a), bsize = tree.size(b);
            res -= asize * bsize;
        }
        tree.unite(a, b);
    }

    rep(i, M) {
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 5248
n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())
mx=max(a)
for i in range(n):
    if a[i] == mx:
        mx_index = i
        break
a.sort()
for i in range(n):
    print(a[n-2] if i == mx_index else a[n-1])

Measured memory_bytes: 12540
from collections import Counter

N=int(input())
L=list(map(int,input().split()))
M=Counter(L)
Z={}
#print(M)
pft=0
for i,j in M.items():
	Z[i]=(j*(j-1)//2,((j-2)*(j-1)//2))
	pft+=Z[i][0]
#print(Z)
for i in range(N):
	print(pft-Z[L[i]][0]+Z[L[i]][1])

Measured memory_bytes: 38944
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define umap unordered_map
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
    if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
    }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
    int k;
    cin >> k;

    deque<ll> que;

    repo(i,10){
    que.pb(i); 
    }

    ll ans;
    while (k) {
      ll v = que.front(); 
      que.pop_front();
      
      if(v%10!=0) que.pb(v*10+v%10-1);
      que.pb(v*10+v%10);
      if(v%10!=9) que.pb(v*10+v%10+1);      
      
      ans=v;
      k--;
    }

    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
   	string s, t;
  	cin >> s;
  	t = s; reverse(all(t));
    cout << (s == t ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#include<vector>
#define fo(i,n) for(long long i=0;i<n;i++)
#define ll long long int
#define inf 999999999999999999
#define pb push_back
#define MOD 1000000007
#define tr(c,it) for(auto it = (c).begin(); it != (c).end(); ++it)
#define fio ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
//cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a * a);
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
	if(b%a==0)
	   return a;
	return gcd(b%a,a);
}
int32_t main() 
{
    fio
	ll j,i,n,t,l,r,h,k,m,maxi,d,x;
	cin>>n;
	ll a[n],b[n],c[n],ans;
	fo(i,n)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
	ll dpa[n],dpb[n],dpc[n];
	dpa[0]=a[0];
	dpb[0]=b[0];
	dpc[0]=c[0];
	for(i=1;i<n;i++)
	{
		dpa[i]=max(a[i]+dpb[i-1],a[i]+dpc[i-1]);
		dpb[i]=max(b[i]+dpa[i-1],b[i]+dpc[i-1]);
		dpc[i]=max(c[i]+dpa[i-1],c[i]+dpb[i-1]);

	}
	ans=max(dpa[n-1],dpb[n-1]);
	ans=max(ans,dpc[n-1]);
	cout<<ans;
}



	

		

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

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

  cout << ((a * b) & 1 ? "Odd" : "Even") << endl;


  
  return 0;
}

Measured memory_bytes: 256
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque



def run():
    L, R, d = map(int, input().split())
    ans = R // d - (L-1) // d
    print(ans)



if __name__ == "__main__":
    run()


Measured memory_bytes: 9152
#include <bits/stdc++.h>
using namespace  std;
typedef long long int ll;
typedef long double ld;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define rsz(a,n) a.resize(n)
#define test(t) ll t;cin>>t;while(t--)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define fillv(a,k) memset(a,k,sizeof(a))
#define filla(a,k,n) memset(a,k,sizeof(a[0])*n)
#define leadzero(a) __builtin_clz(a) //count leading zeros
#define trailzero(a) __builtin_ctz(a) //count trailing zeros
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln cout<<"\n"
#define sp cout<<" "
#define spaceprint(a,i,s,n) {forsn(i,s,n) { cout<<a[i]; sp;}}
#define lineprint(a,i,s,n) {forsn(i,s,n) {cout<<a[i]; ln;}}
#define maxe(a) *max_element(a.begin(),a.end())
#define maxi(a) max_element(a.begin(),a.end())-a.begin()
#define mine(a) *min_element(a.begin(),a.end())
#define mini(a) min_element(a.begin(),a.end())-a.begin()
#define all(c) c.begin(),c.end()
#define trav(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element)  (find(all(container),element) != container.end())// check the presence of element
//copy(from_begin, from_end, to_begin); copy function
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<string> vs;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM = 1e5+5, MOD = 1e9+7;
#define sumv(v) accumulate(all(v),ll(0))
#define productv(v) accumulate(all(v), ll(1), multiplies< ll >())
long double a[3005],sum[3005],rsum[3005];
long double dp[3005][3005];
void solve(ll i,ll j)
{
	if(dp[i][j]!=-1)
	{
		return;
	}
	if(i==0 or j==0)
	{
		dp[i][j]=sum[i]*rsum[j];
		// cout<<i<<" "<<j<<" "<<dp[i][j];
		// ln;
		return ;
	}
	solve(i-1,j);
	solve(i,j-1);
	dp[i][j]=a[i+j]*dp[i-1][j]+(1-a[i+j])*dp[i][j-1];
	//cout<<i<<" "<<j<<" "<<dp[i][j];
	//ln;
	return;

}
int main()
{
	ll n,i;
	cin>>n;
	for(ll i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	//cout<<a[1];
	sum[0]=rsum[0]=1;
	for(i=1;i<=n;i++)
	{
		sum[i]=a[i]*sum[i-1];
		rsum[i]=(1-a[i])*rsum[i-1];
	}
	for(ll i=0;i<=n;i++)
		for(ll j=0;j<=n;j++)
			dp[i][j]=-1;
	long double sum1=0;
	for(i=0;i<=n;i++)
	{
		if(n-i>i)
		{
			solve(n-i,i);
			sum1+=dp[n-i][i];
		}

	}
	cout<<setprecision(15)<<sum1;



}


Measured memory_bytes: 141440
#include <stdio.h>
int f(int r,int n,int i){
	int t=0;
	if(n==1)return r>i&&r<10;
	for(++i;i<9&&i<=r;++i)t+=f(r-i,n-1,i);
	return t;
}
int n,s;
int main(void){
	for(;scanf("%d%d",&n,&s),n;printf("%d\n",f(s,n,-1)));
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define speed_up ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ara(A,N) sort(A,A+N)
#define rev(A,N) sort(A,A+N,greater<int>())
using namespace std;
int main()
{
    speed_up;
    map<ll,ll>m;
    ll i, ans = 1, a, flag = 0, n;
    cin>>n;
    a = n;
    while(a--)
    {
        ll j;
        cin>>j;
        m[j]++;
        if(m[j]>2) flag++;
    }
    if(flag != 0)
    {
       cout<<0<<endl;
       return 0;
    }
    if(n%2 != 0 && m[0] != 1)
    {
        cout<<0<<endl;
        return 0;
    }
        for(i = 1; i<=n; i+=2)
        {
            if(m[i]!=2 && n%2 == 0)
            {
                cout<<0<<endl;
                return 0;
            }

        }
       for(i = 1; i<=n/2; i++)
       {
           ans*=2;
           ans%= (ll) 1e9 + 7;
       }
       cout<<ans<<endl;


       return 0;


}


Measured memory_bytes: 7500
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

typedef long long ll;
typedef std::pair<ll,int> P;

const ll INF = 1001001001001001001;
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

const int MAX_N = 100000, MAX_R = 1000000;

class SegmentTree{
public:
    SegmentTree(){}
    SegmentTree(int n){init(n);}
    void init(int n){
        size = 1;
        while(size < n){
            size *= 2;
        }
        REP(i, size*2-1){
            seg1[i] = -INF;
            seg2[i] = -1;
        }
    }
    void update(int index, int v){
        index += size - 1;
        seg1[index] += v;
        seg2[index] = index - (size-1);
        while(index > 0){
            index = (index-1)/2;
            //std::cout << index << "," << seg1[index*2+1] << "," << seg1[index*2+2] << std::endl;
            if(seg1[index*2+1] >= seg1[index*2+2]){
                seg1[index] = seg1[index*2+1];
                seg2[index] = seg2[index*2+1];
            }else{
                seg1[index] = seg1[index*2+2];
                seg2[index] = seg2[index*2+2];
                //std::cout << seg2[index] << std::endl;
            }
        }
    }
    P root(){
        return mp(seg1[0], seg2[0]);
    }
private:
    ll seg1[MAX_N*4];
    int seg2[MAX_N*4];
    int size;
};

struct Record{
    int d, t, x;
};

int N, R, L;
Record rs[MAX_R];
SegmentTree st;

int main(){
    std::cin >> N >> R >> L;
    st.init(N);
    REP(i, R){
        std::cin >> rs[i].d >> rs[i].t >> rs[i].x;
        rs[i].d--;
    }

    int ts[MAX_N];
    std::fill(ts, ts+N, 0);

    if(R > 0){
        REP(i, N){
            st.update(i, 0);
        }

        int prev = rs[0].t;
        st.update(rs[0].d, rs[0].x);
        FOR(i, 1, R){
            //if(i+1 >= R || rs[i].t < rs[i+1].t){
                //printf("wa-i: %d +%d\n", st.root().second, rs[i].t - prev);
                ts[st.root().second] += rs[i].t - prev;
                //}
            st.update(rs[i].d, rs[i].x);
            prev = rs[i].t;
        }
        ts[st.root().second] += L - prev;
    }

    int max_team = 0, max_t = -1;
    REP(i, N){
        if(ts[i] > max_t){
            max_team = i+1;
            max_t = ts[i];
        }
    }   

    //std::cout << max_t << std::endl;
    std::cout << max_team << std::endl;
}

Measured memory_bytes: 15880
a, b = map(int, input().split())
lists = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]
if lists.index(a) > lists.index(b):
  print("Alice")
elif lists.index(a) == lists.index(b):
  print("Draw")
else:
  print("Bob")

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

int main() {
ios_base::sync_with_stdio(0); cin.tie(0); 
int n;
cin >> n;
string s;
cin >> s;
int temp{};
int ans{};
for(int i{}; i<n; i++){
	if(s[i] == 'I'){
		++temp;
	}else if(s[i] == 'D'){
		--temp;
	}

ans = max(ans,temp);
}
	cout << ans << "\n";
	return 0;
}


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

const int maxn = 20;
int n, m;
bool swaped[maxn], used[maxn], ans;
string s[20];

bool check()
{
    memset(used, false, sizeof(used));
    for(int i = 0; i < m; i ++) {
        if(used[i])
            continue;
        for(int j = 0; j < m; j ++) {
            bool cur = true;
            if(i == j || used[j])
                continue;
            for(int k = 0; k < n; k ++) {
                if(s[k][i] != s[n - 1 - k][j]) {
                    cur = false;
                    break;
                }
            }
            if(cur) {
                used[i] = used[j] = true;
                break;
            }
        }
    }

    int cnt = 0, noused = -1;
    for(int i = 0; i < m; i ++)
        if(!used[i])
            cnt ++, noused = i;
    if((cnt >= 2 ) || (cnt && (m % 2 == 0)))
        return false;
    for(int i = 0; i < n; i ++)
        if(s[i][noused] != s[n - 1 - i][noused])
            return false;
    return true;
}

void dfs(int u, int flag)
{
    if(u == (n + 1)/ 2) {
        if(check()){
            printf("YES");
            exit(0);
        }
        return;
    }

    for(int i = u; i < n; i ++) {
        if(!swaped[i]) {
            swaped[i] = true;
            for(int j = i + 1; j < n; j ++) {
                if(swaped[j])
                    continue;
                swaped[j] = true;

                dfs(u + 1, flag);
                swap(s[i], s[j]);
                dfs(u + 1, flag);
                swap(s[i], s[j]);

                swaped[j] = false;
            }
            if(flag) {
                dfs(u + 1, false);
            }
            swaped[i] = false;
            break;
        }
    }
}

int main()
{
    scanf("%d%d", &n, &m);
    for(int i = 0; i < n; i ++)
        cin >> s[i];

    if(n & 1)
        dfs(0, true);
    else
        dfs(0, false);
    printf("NO");
    return 0;
}


Measured memory_bytes: 384
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

h,w,k = map(int, input().split())
x1,y1,x2,y2 = map(lambda x: int(x)-1, input().split())
s = [None]*h
for i in range(h):
    s[i] = input()
    
from queue import deque
q0 = deque([(0,x1,y1,(0,0),0)])
q1 = deque()

dx = [0,1,0,-1]
dy = [1,0,-1,0]
# dist = [[None]*w for _ in range(h)]
dist = [None]*(w*h)
dist[x1*w+y1] = 0
# done = [[0]*w for _ in range(h)]
done = [0]*(w*h)
done[x1*w+y1] = 15

while q0 or q1:
    if not q0:
        q0 = q1
        q1 = deque()
    d, x, y, t, td = q0.popleft()
    for i,(xx, yy) in enumerate(zip(dx,dy)):
        if (-xx,-yy)==t:
            continue
        nx, ny = xx+x, yy+y
        if nx<0 or nx>=h or ny<0 or ny>=w or s[nx][ny]=="@":
            continue
        if (xx,yy)==t and td<k:
            nd = d
            ntd = td+1
            q = q0
        else:
            nd = d+1
            ntd = 1
            q = q1
        if dist[nx*w+ny] is None or nd<dist[nx*w+ny]:
            q.append((nd,nx,ny,(xx,yy),ntd))
            dist[nx*w+ny] = nd
            done[nx*w+ny] = 1<<(i)
        elif nd==dist[nx*w+ny]and ((done[nx*w+ny]&1<<(i))==0):
            q.append((nd,nx,ny,(xx,yy),ntd))
            done[nx*w+ny] |= 1<<(i)
            
if dist[x2*w+y2] is None:
    print(-1)
else:
    print(dist[x2*w+y2])

Measured memory_bytes: 117612
#include<stdio.h>
int price(int x,int y);
int main(void){
int X,Y;
//数字の読み取り
scanf("%d %d", &X,&Y);
//解のprice関数の出力
printf("%d",price(X,Y)) ;
      
        
        return 0;
}
int price(int x,int y){
    //(x,y)=(1<=3,1<=3)の６通りの場合わけ
    if (x ==1){
        if (y==1){
        return 1000000;
        }
        if (y ==2){
            return 500000;
        }
    if (y ==3){
        return 400000;
    }
        if (y >=4){
            return 300000;
        }
    }
    
    if (x==2){
        if(y ==1){
            return 500000;
    }
    if (y ==2){
        return 400000;
    }
    if (y ==3){
        return 300000;
    }
    if (y>=4){
        return 200000;
            
        }
    }
    if (x==3){
        if (y ==1){
            return 400000;
        }
        if (y == 2){
            return 300000;
        }
        if (y ==3){
            return 200000;
        }
        if (y >=4){
            return 100000;
        }
    }
    if (x>=4){
        if (y ==1){
            return 300000;
        }
        if (y ==2){
            return 200000;
        }
        if (y==3){
            return 100000;
        }
       if (y >= 4){
         return 0;
       }
    }
}


Measured memory_bytes: 128
#include <stdio.h>

#define MAX(A,B)    (A)>(B) ? A : B

static char ch[5000];
static int A[5000];

int maxPrefixZAlgo( char S[], int size ) {
    int i, j;
    int c;
    int val;

    val = 0;
    c = 0;
    for (i=1; i<size; ++i) {
        // Z window の内側の場合
        if ( i+A[i-c] < c+A[c] ){
            A[i] = A[i-c];
        } else {
            j = MAX( 0, c+A[c]-i );
            while ( ( i+j < size )          // 文字列サイズ以下
                &&  ( S[j] == S[i+j] ) ) {  // かつ 文字が同じ場合
                ++j;    // 同一文字数をインクリメント
            }
            A[i] = j;
            c = i;

            // 問題用の結果の更新
            if ( ( A[i] > val )         // 文字長がこれまでより長い場合
              && ( i >= A[i] ) ) {      // 部分文字列の重複がない
                val = A[i];
            } 
        }
    }
    // printf("A: ");
    // for (i=0;i<size;++i) {
    //     printf("%d ", A[i]);
    // }
    // printf("\nval : %d\n", val);

    return val;
}


int main( void ) {
    int N;
    int i;
    int val, tmp;

    scanf("%d", &N);
    N = N > 5000 ? 5000 : N;
    scanf("%s", ch);

    // for(i=0;i<N;++i) {
    //     printf("%c", ch[i]);
    // }
    val = 0;
    for (i=0;i<N;++i) {
        tmp = maxPrefixZAlgo( &ch[i], N-i );
        // printf("tmp : %d\n", tmp);
        if ( tmp > val ) {
            val = tmp;
        }
        if ( val > N-i-1 ) {
            break;
        }
    }

    printf("%d", val);

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef short int si;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

#define st first
#define nd second
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REV(a) reverse(a.begin(),a.end())
#define SORT(a) sort(a.begin(),a.end())
#define inf (int)1e9
#define linf (ll)1e18

int n;
int a[100000];
map<int,int>p;

int main() {
		ios::sync_with_stdio(false);
		cin>>n;
		FOR(I,0,n){
				int x;
				cin>>x;
				p[x]++;
		}
		int ans=0;
		for(map<int,int>::iterator i=p.begin();i!=p.end();i++){
				if(i->second>i->first){
						ans+=i->second-i->first;
				}
				else if(i->second<i->first){
						ans+=i->second;
				}
		}
		cout<<ans<<endl;





		return 0;
}


Measured memory_bytes: 4736
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N, A, B = M()
print(min(N*A, B))

Measured memory_bytes: 38420
#include <iostream>
#include <cstdio>
#include <set>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <fstream>
#include <iomanip>
//#include <unordered_map>
using namespace std;
#define dbg(x) cerr << #x " = " << x << endl;
typedef pair<int, int> P;
typedef long long ll;
#define FIN freopen("in.txt", "r", stdin);

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    int x = tx - sx;
    int y = ty - sy;
    for(int i = 0; i < y; i++)
    {
        cout << 'U';
    }
    for(int i = 0; i < x; i++)
    {
        cout << 'R';
    }
    for(int i = 0; i < y; i++)
    {
        cout << 'D';
    }
    for(int i = 0; i <= x; i++)
    {
        cout << 'L';
    }
    for(int i = 0; i <= y; i++)
    {
        cout << 'U';
    }
    for(int i = 0; i <= x; i++)
    {
        cout << 'R';
    }
    cout << "DR";
    for(int i = 0; i <= y; i++)
    {
        cout << 'D';
    }
    for(int i = 0; i <= x; i++)
    {
        cout << 'L';
    }
    cout << 'U';
    cout << endl;
    //cout << "UURRURRDDDLLDLLULUUURRURRDDDLLDL" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int a,b,c;
int min,mid,max;
int tmp;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
 
if(a<b){
min = a;
mid = b;
}else{
min = b;
mid = a;
}
 
if(mid<c){
max = c;
}else{
max = mid;
mid = c;
}
 
if(mid<min){
tmp = mid;
mid = min;
min = tmp;
}
 
printf("%d %d %d\n", min, mid, max);
 
  
return 0;
}

Measured memory_bytes: 596
// ref. https://atcoder.jp/contests/keyence2020/submissions/9549557

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> b(n);
  rep(i, n) {
    cin >> a[i];
  }
  rep(i, n) {
    cin >> b[i];
  }

  // dp[mask][k] .. minimum count when mask is selected and k is last.
  vector<vector<ll>> dp(1ll<<n, vector<ll>(n, INF));
  ll m = 1ll << n;
  rep(i, n) {
    dp[1ll<<i][i] = 0;
  }
  rep(i, m) { // i is current state
    ll c = __builtin_popcount(i);
    if (c == 1) { continue; } // skip 1 bit

    ll pos = c-1; // position of last element
    ll cnt = c; // inversion number
    rep(j, n) { // j is last element
      if ((1ll<<j) & i) {
        --cnt; // e.g. when first element is located at k, then inversion number is k-1 (1-indexed)
        ll pre = i^(1ll<<j); // pre is prev state
        rep(k, n) {
          if ((1ll<<k) & pre) { // k is prev element
            ll prv = ((pos-1)^k)%2 ? b[k] : a[k]; // check the parity of (pos-1)-k
            ll cur = (pos^j)%2     ? b[j] : a[j]; // check the parity of pos-j
            if (prv <= cur) { // valid
              chmin(dp[i][j], dp[pre][k] + cnt);
            }
          }
        }
      }
    }
  }

  ll ans = INF;
  rep(i, n) {
    chmin(ans, dp[m-1][i]);
  }
  if (ans == INF) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
}


Measured memory_bytes: 47488
#include <bits/stdc++.h>
#define int long long
using namespace std;

class DiameterOfTree{
public:
  typedef pair<int,int> P;
  int V;
  vector<vector<P> > G; //(to, cost)
  vector<int> nodeCost; //ノードに重みがある場合
  int start, end, length;
  int ok;
  DiameterOfTree():V(-1){}
  DiameterOfTree(int V):V(V),G(V),nodeCost(V, 0),ok(false){};

  void add_edge(int a,int b,int c = 1){
    ok = false;
    assert(a < V && b < V);
    assert(a >= 0 && b >= 0);
    G[a].push_back( P(b, c) );
    G[b].push_back( P(a, c) );
  }
  
  //O(V + E);
  void build(int start=0){
    ok = true;
    assert(start < V);
    dfs(start);
    dfs(end);
  }
  
  void dfs(int pos,int pre = -1,int len = 0){
    if(pre == -1) start = pos, length = -1;
    len += nodeCost[pos];
    if(len > length) length = len, end = pos;
    for(P p:G[pos]) if(p.first != pre) dfs(p.first, pos, len+p.second);
  }

  //s-t間のパスを取得 : O(V + E)
  vector<int> getPath(int s,int t){
    assert(0 <= s && s < V);
    assert(0 <= t && t < V);
    
    vector<int> res;
    function<int(int,int)> dfs = [&](int pos,int pre){
      if(pos == s) {res.push_back(pos); return 1;}
      for(P p:G[pos]){
        int to = p.first;
        if(to != pre && dfs(to, pos)){res.push_back(pos); return 1;}
      }
      return 0;
    };

    dfs(t, -1); //{s, . . .,t}の順で入っている
    assert(res[0] == s && res.back() == t);
    return res;
  }
};

int n;

signed main(){
  
  cin>>n;
  
  DiameterOfTree T(n);
  
  for(int i=0;i<n-1;i++){
    int a, b;
    cin>>a>>b;
    T.add_edge(a-1, b-1);
  }
  
  T.build();
  
  int r = T.length + 1;
  
  if( ( r + 1 ) % 3 == 0 ) cout<<"Second"<<endl;
  else cout<<"First"<<endl;
  
  return 0;
}


Measured memory_bytes: 22784
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

std::vector<pair<int, int>> veven(500000);
std::vector<pair<int, int>> vodd(500000);

bool comp(pair<int, int>& x, pair<int, int>& y)
{
    return x.first > y.first;
}

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

    int N;
    cin >> N;

    int odd, even;
    for (int i = 0; i < N; i += 2)
    {
        cin >> odd >> even;
        vodd[odd - 1].first++;
        vodd[odd - 1].second = odd - 1;
        veven[even - 1].first++;
        veven[even - 1].second = even - 1;
    }

    sort(veven.begin(), veven.end(), comp);
    sort(vodd.begin(), vodd.end(), comp);

    if (veven[0].second != vodd[0].second)
    {
        cout << N - veven[0].first - vodd[0].first << "\n";;
    }
    else if (veven[1].first > vodd[1].first)
    {
        cout << N - veven[1].first - vodd[0].first << "\n";
    }
    else
    {
        cout << N - veven[0].first - vodd[1].first << "\n";;
    }

    return 0;
}



Measured memory_bytes: 8064
io = STDIN
s=io.gets.to_i
def f(i)
  return i/2 if i.even?
  3*i+1
end
def search(s)
  ar={}
  (1..1000000).each do |i|
    return i if ar[s]
    ar[s]=true
    s=f(s)
  end
end
puts search(s)


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main(){
    map<string, bool> doors;
    int n, m, i;
    cin >> n;
    string id;
    bool st = true;
    for (i=0;i<n;i++){
        cin >> id;
        doors[id]=true;
    }
    cin >> m;
    for (i=0;i<m;i++){
        cin >> id;
        if (doors.find(id)==doors.end()){
            cout << "Unknown " << id << endl;
        }else if(st){
            cout << "Opened by " << id << endl;
            st=false;
        }else{
            cout << "Closed by " << id << endl;
            st=true;
        }
    }
}

Measured memory_bytes: 1236
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

ans = sum(b)
for i in range(n-1):
    if a[i]+1 == a[i+1]:
        ans += c[a[i]-1]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)

void print(vector<int>& a){
    int n=a.size();
    for(int i=a.size()-1;i>=0;--i){
        cout << a[i];
        if(i!=0) cout << ' ';
    }
    cout << endl;
}

void insertionSort(vector<int>& a,int& n,int g,long long int& cnt){
    F(i,g,n){
        int v=a[i];
        int j=i-g;
        while(j>=0 && a[j]>v){
            a[j+g]=a[j];
            j=j-g;
            ++cnt;
        }
        a[j+g]=v;
    }
}

void shellSort(vector<int>& a,int& n){
    long long int cnt=0;
    vector<int> g;
    for(int h=1; ; ){
        if(h>n) break;
        g.push_back(h);
        h=3*h+1;
    }
    cout << g.size() << endl;
    print(g);
    for(int i=g.size()-1;i>=0;--i) insertionSort(a,n,g[i],cnt);
    cout << cnt << endl;
}

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    F(i,0,n) cin >> a[i];

    shellSort(a,n);
    F(i,0,n){
        cout << a[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 6712
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
for Ai in range(A+1):
  for Bi in range(B+1):
    for Ci in range(C+1):
      price = Ai*500 + Bi*100 + Ci*50
      if price == X:
        count += 1
print(count)

Measured memory_bytes: 3060
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()
ans = 0
for i in range(len(t)):
    if i < k:
        if t[i] == "r":
            ans += p
        elif t[i] == "s":
            ans += r
        else:
            ans += s
    else:
        if t[i-k] == t[i]:
            t = t[:i]+"a"+t[i+1:]
        else:
            if t[i] == "r":
                ans += p
            elif t[i] == "s":
                ans += r
            else:
                ans += s
print(ans)

Measured memory_bytes: 3456
N = int(input())

L = []
for _ in range(N):
    s, t = input().split()
    L.append([s, int(t)])

X = input()

ans = 0
flag = False
for s, t in L:
    if flag:
        ans += t
    if s == X:
        flag = True
        
print(ans)



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

int main(){
    int n;
    cin >> n;
    vector<int> v;
    for(int i=0;i<2*n;++i){
        int l;
        cin >> l;
        v.push_back(l);
    }

    sort(v.begin(), v.end());

    int ans = 0;
    for(int i=0;i<v.size();i+=2)ans += v[i];

    cout << ans << endl;

    return 0;
}


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

vector<int> edges[100010];
int dp[100010];

const int MOD = 1000000007;
int mult_mod(int a, int b){
	return (long)a * b % MOD;
}

// returns a pair my vertex can be {black, white}
pair<int, int> dfs(int i, int parent){
	// 現在の頂点を黒に塗ることができる(子ノードが全て白) の部分木の場合の数
	int all_white = 1;
	// 子ノードに黒い頂点が含まれる部分木の場合の数
	int involve_black = 0;
	for(auto x: edges[i]) {
		if(x == parent) continue;
		pair<int, int> p = dfs(x, i);
		int temp = all_white;
		all_white = mult_mod(all_white, p.second);
		involve_black = (mult_mod(temp, p.first) + mult_mod(involve_black, p.first + p.second)) % MOD;
	}
	return make_pair(all_white, (all_white + involve_black) % MOD);
}

int main(){
	int n, x, y;
	scanf("%d", &n);
	for(int i = 0; i < n-1; i++) {
		scanf("%d%d", &x, &y);
		edges[x-1].push_back(y-1);
		edges[y-1].push_back(x-1);
	}
	pair<int, int> p = dfs(0, -1);
	printf("%d\n", (p.first + p.second) % MOD);
}

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if (b - a == c - b) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

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

int main(){
	string s,c;
	cin >> s;
	long long count = 0,gcount=0;
	for(int i = 0;i<(int)s.length();i++){
		if(s[i] == 'B') count++;
		else gcount+=count;
	}
	cout << gcount;
			
     
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e9;
const long long int mod = 1e9+7;
typedef pair<ll,ll> pairs;
vector<pairs> p;


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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

vector<vector<ll>> combination(ll n, ll r){
    vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
    for(ll i=0;i<v.size();++i){
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for(ll i=1;i<v.size();++i){
        for(ll j=0;j<i;++j){
            v[i][j] = (v[i - 1][j - 1] + v[i - 1][j]);
        }
    }
    return v;
}
// ------------------------------------

int main(){
    ll n, m, k;
    cin>>n>>m>>k;
    string ans = "No";
    for(ll i=0;i<=n;++i){
        for(ll j=0;j<=m;++j){
            if(i*(m-j)+j*(n-i) == k){
                ans = "Yes";
                break;
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
// not code by me 

#include <cstdio>
#include <iostream>
 
int n, k;
int main() {
    std::ios::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0);
    std::cin >> k;
    if (k == 1) { std::cout << "1\n1\n"; return 0; }
    std::cout << (n = k + 3 >> 2 << 1) << '\n';
    for (int i = 0; i < n; ++i, std::cout.put('\n'))
        for (int j = 0, t; j < n; ++j)
            t = (i + j) % n + 1 + (i & 1) * n,
            std::cout << (t > k ? t - n : t) << ' ';
    return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
  int l,r,d; cin >> l >> r >> d;
  int ans = 0;
  repr(i,l,r+1){
    if(i%d == 0) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3588