akhauriyash/Code-Regression huggingface dataset:
package main

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

var n, m int
var g [][]int // graph

var dp []int // dp[v] = ノードvを始点としたときの、Gの有効パスの長さの最大値

func rec(v int) int {
	if dp[v] != -1 {
		return dp[v]
	}

	m := 0
	for _, nv := range g[v] {
		m = max(m, rec(nv)+1)
	}

	dp[v] = m
	return m
}

func max(a ...int) int {
	m := a[0]
	for i := 1; i < len(a); i++ {
		if m < a[i] {
			m = a[i]
		}
	}
	return m
}

func main() {
	n, m = readI(), readI()
	g = make([][]int, n)
	dp = make([]int, 1e5)

	// 0-indexed
	for i := 0; i < n; i++ {
		g[i] = make([]int, 0)
	}
	for i := 0; i < m; i++ {
		x, y := readI(), readI()
		g[x-1] = append(g[x-1], y-1)
	}

	//dp init
	for v := 0; v < n; v++ {
		dp[v] = -1
	}

	for v := 0; v < n; v++ {
		rec(v)
	}

	fmt.Println(max(dp...))
}

/*-----------Input utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const buf = 200100
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, buf), buf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

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

func readR() []rune {
	return []rune(readS())
}

func readI() int {
	i, _ := strconv.Atoi(readS())
	return i
}

func readF() float64 {
	f, _ := strconv.ParseFloat(readS(), 64)
	return f
}


Measured memory_bytes: 19808
package main

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

func main() {
	sc1 := bufio.NewScanner(os.Stdin)
	sc1.Split(bufio.ScanWords)
	sc1.Scan()
	n, _ := strconv.Atoi(sc1.Text())
	heap := make([]int, n+1)

	for i := 0; i < n; i++ {
		sc1.Scan()
		val, _ := strconv.Atoi(sc1.Text())
		heap[i+1] = val
	}

	// line := ""
	buildMaxHeap(heap)
	for i := 1; i <= n; i++ {
		// line += " " + strconv.Itoa(heap[i])
		fmt.Printf(" %d", heap[i])

	}
	fmt.Println()

}

func maxHeapify(A []int, i int) {

	l := i * 2
	r := i*2 + 1
	if l > len(A) {
		return
	}
	var largest int
	if l < len(A) && A[l] > A[i] {
		largest = l
	} else {
		largest = i
	}

	if r < len(A) && A[r] > A[largest] {
		largest = r
	}

	if largest != i {
		A[i], A[largest] = A[largest], A[i]
		maxHeapify(A, largest)
	}
}

func buildMaxHeap(A []int) {
	for i := len(A) / 2; i != 0; i-- {
		maxHeapify(A, i)
	}
}



Measured memory_bytes: 9988
#include <stdio.h>

int main(void){
    double a,b,c,d,e,f,x,y;
    while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){
        x=(c*e-b*f)/(a*e-b*d);
        y=(a*f-c*d)/(a*e-b*d);
        printf("%0.3f %0.3f\n",x+0.00005,y+0.00005);
    }
    return 0;
}

Measured memory_bytes: 656
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
#include <vector>
//#include <string>
//#include <list>
//#include <deque>
//#include <unordered_map>
//typedef long long LL;
//typedef long double LD;
using namespace std;

//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main() {
    int h;
    int w;
    cin >> h >> w;
    vector<vector<int>> s(h, vector<int>(w));
    char tmp_s;
    bool ans=true;
    bool tmp_ans;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> tmp_s;
            if(tmp_s=='#'){
                s[i][j]=1;
            }else{
                s[i][j]=0;
            }
        }
    }

    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            tmp_ans=false;
            if(s[i][j]==1){
                if(i>=1 && s[i-1][j]==1){
                    tmp_ans=true;
                }
                if(i<h-1 && s[i+1][j]==1){
                    tmp_ans=true;
                }
                if(j>=1 && s[i][j-1]==1){
                    tmp_ans=true;
                }
                if(j<w-1 && s[i][j+1]==1){
                    tmp_ans=true;
                }
                if(tmp_ans==false){
                    ans=false;
                }                            
            }
        }
    }
    if(ans==true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#include<stack>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;
//set<int>::iterator it;

int main(void){
    int r,D;
    int x;
    cin>>r>>D>>x;
    int ans=0;
    for(int i=0;i<10;i++){
        x=r*x-D;
        cout<<x<<endl;
    }
    return 0;
}



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

int main(){
    int N,H,W;
    cin >> N >> H >> W;
    vector<int>A(N);
    vector<int>B(N);
    int ans = 0;
    for(int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
        if(A[i] >= H &&  B[i] >= W) {
            ans++;
        }
    }
    cout << ans << endl;
} 


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

#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int

double dp[3002][3002];

double solve(vector<double>&v,int n,int x)
{
    // 0 heads required always 1
    if(x==0) return 1;
    // for (0,0) it will be 1 only
    
    // Can't get the desired no. of heads in 0 tosses
    if(n==0) return 0;

    if(dp[n][x] > -0.9) return dp[n][x];

    dp[n][x] = v[n]*solve(v,n-1,x-1) + (1-v[n])*solve(v,n-1,x);
    // cout<<dp[n][x]<<endl;
    return dp[n][x];
}

int main() {
    
    FASTIO;

    int n; cin>>n;
    vector<double> v(n+1);

    memset(dp,-1,sizeof dp);

    for(int i = 1;i<=n;i++){
        cin>>v[i];
    }

    // out of n tosses we want atleast (n+1)/2 heads
    double ans = solve(v,n,(n+1)/2);

    cout<<fixed<<setprecision(10)<<ans;

}


Measured memory_bytes: 70912
#include<bits/stdc++.h>
using namespace std;
#define optimizar_io ios_base::sync_with_stdio(0); cin.tie(0);
#define fore(i, a, b) for(int i = a; i < b; i++)
#define fori(i, a, b) for(int i = a; i <= b; i++)
#define pb push_back
#define popb pop_back
#define mk make_pair
#define fi first
#define se second
#define endl '\n'
#define MAX 60
typedef long long int lli;
typedef long double ld;
const double PI = acos(-1.0);
ld eps = 1e-9;

int main() {
	optimizar_io
	string str;
	cin >> str;
	bool ans = false;
	fore(i, 0, str.size()) {
		if(str[i] == '7') {
			ans = true;
			break;
		}
	}
	if(ans) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int d = Integer.parseInt(sc.next());
        System.out.println(a * b > c * d ? a * b : c * d);
    }
}

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

int main(){
  int n;
  while(cin >> n , n){
    int sum = 0;
    for(int i=0;i<n/4;i++){
      int a; cin >> a;
      sum += a;
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define ull unsigned long long int
#define ll long long
#define int long long
#define ld long double
#define endl '\n'
const int mod= 1e9+7;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define trace(x) cerr << #x << " is " << x << endl;
#define all(x) x.begin(),x.end()
#define reset(x,val) memset(x,val,sizeof(x))
#define flush fflush(stdout)
#define sz(a) a.size()
#define pii pair<int,int>
using namespace std;
const int N=100005;
int dp[N],n,k;
int32_t main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
    {
     cin>>a[i];
     dp[a[i]]=1;
    }
    for(int i=0;i<a[0];i++)
    dp[i]=0;
    
    sort(a,a+n);
    for(int i=a[0]+1;i<=k;i++)
    {
     bool p=!dp[i-a[0]];
     for(int j=1;j<n;j++)
     {
      if(a[j]>i)break;
      p=p|(!dp[i-a[j]]);
     }
     if(p)dp[i]=1;
    }
    if(dp[k])cout<<"First";
    else cout<<"Second";
    cout<<endl;
    return 0;
}



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

int main() {
	// your code goes here
	int n,k,cnt=0;
	cin>>n>>k;
	for(int i=0;i<n;++i)
	{
	    int q;cin>>q;if(q>=k)cnt++;
	}
	cout<<cnt;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

int n, d[16][16], dp[1<<15][16];
signed main(void)
{
  int m;
  cin >> n >> m;
  REP(i, n) REP(j, n) d[i][j] = INF;
  REP(i, m) {
    int s, t, dd;
    cin >> s >> t >> dd;
    d[s][t] = dd;
  }
  REP(i, 1<<n) fill(dp[i], dp[i]+n, INF);
  dp[(1<<n)-1][0] = 0;

  for(int s=(1<<n)-2; s>=0; --s) {
    REP(v, n) REP(u, n) {
      if(!(s>>u&1)) dp[s][v] = min(dp[s][v], dp[s|1<<u][u] + d[v][u]);
    }
  }
  if(dp[0][0] >= INF) cout << -1 << endl;
  else cout << dp[0][0] << endl;
  return 0;
}

Measured memory_bytes: 7056
/***************************************************
 * Problem Name : A.cpp
 * Problem Link :
 * Contest Name :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2018-10-06
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<cstring>
#include<string>
#include<sstream>
#include<cmath>
#include<vector>
#include<queue>
#include<cstdlib>
#include<deque>
#include<stack>
#include<map>
#include<set>
#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define SET(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define pll pair <ll, ll>
#define debug cout <<"#########\n";
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define Pow2(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define Max3(a, b, c) max(a, max(b, c))
#define Min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
std::string NumberToString ( T Number ) {
    std::ostringstream ss;
    ss << Number;
    return ss.str();
}
ll lcm (ll a, ll b) {
    return a * b / __gcd (a, b);
}
/************************************ Code Start Here ******************************************************/
int main () {
    //~ __FastIO;
    int n;
    cin >> n;

    if (n == 1) {
        cout << "Hello World\n";

    } else {
        int a, b;
        cin >> a >> b;
        cout << (a + b) << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    string s;
    cin >> s;
    int k;
    cin >> k;
    set<string> st;
    rep(i, 1, k + 1) {
        rep(j, 0, (int)s.size() - i + 1) {
            string tmp = s.substr(j, i);
            if (!st.count(tmp)) st.insert(tmp);
        }
    }
    int cnt = 0;
    for (auto i : st) {
        cnt++;
        if (cnt == k) cout << i << endl;
    }
    return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
int main() {
  int64_t A,B,N;
  cin>>A>>B>>N;
  int64_t x=min(B-1,N);
  cout<<(A*x/B)-A*(x/B)<<endl;
  return 0;
}

Measured memory_bytes: 3596
import java.util.*;
import java.io.*;
 
class Main{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        long sum=0;
        int min=Integer.MAX_VALUE,max=Integer.MIN_VALUE;
        int n = Integer.parseInt(br.readLine());
        String[]str = br.readLine().split(" ");
        //String s = br.readLine();
        //String[] str = s.split(" ");
         
        for(int i=0; i<n; i++){
            int num = Integer.parseInt(str[i]);
            if(max < num) max = num;
            if(min > num) min = num;
            sum += num;
        }
        System.out.println(min+" "+max+" "+sum);
    }
}

Measured memory_bytes: 25412
#include <stdio.h>

int main(void){
	int a, b, c, d, e, k,x=0;
	scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &k);
	if (k < e-a) {
		x = 1;
	}
	
	if (x == 0) {
		printf("Yay!");
	}
	else {
		printf(":(");
	}


    return 0;
}



Measured memory_bytes: 128
from collections import Counter

N, K = map(int, raw_input().split())
A = map(int, raw_input().split())
C = Counter(A)
D = C.items()[:]
D.sort(key=lambda x: x[1])

ans = 0
X = len(D)
for e, v in D:
    if X > K:
        ans += v
    X -= 1
print ans


Measured memory_bytes: 80392
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

class Main{
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		int N=sc.nextInt();
		int H=sc.nextInt();
		int W=sc.nextInt();
		int cnt=0;

		for(int i=0;i<N; i++) {
			int a=sc.nextInt();
			int b=sc.nextInt();
			if(a>=H && b>=W) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 21716
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main() {
	string[] inputs = split(readln());
	int A = to!int(inputs[0]);
	int B = to!int(inputs[1]);
	if(A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) "Possible".writeln;
	else "Impossible".writeln;
}


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

using namespace std;

#define rep(i,x) for(int i=0;i<x;++i)
#define fst first
#define scd second
#define PB push_back

using data=tuple<int,int,int>;
using P=pair<int,data>;

const int inf = 1e9;

struct edge{int to,cost;};
vector<edge> G[10010];

int d[10010][2][205];

int n,m,x;
int t[10010];

signed main()
{
    cin>>n>>m>>x;

    rep(i,n){
        cin>>t[i];
        if (t[i]==2)t[i]=1;
        else if (t[i]==1)t[i]=2;
    }

    rep(i,m) {
        int a,b,d;cin>>a>>b>>d;
        --a,--b;
        G[a].PB(edge{b,d});
        G[b].PB(edge{a,d});
    }

    priority_queue<P,vector<P>,greater<P>> q;

    rep(i, n) rep(j, 2) rep(k, 205) d[i][j][k] = inf;
    d[0][0][0] = 0;

    q.push(P(0, data(0, 0, 0)));

    while (q.size()) {
        P p = q.top(); q.pop();

        int dist = p.fst;
        int v, type, tim;
        tie(v,type,tim) = p.scd;

        if (d[v][type][tim] < dist) continue;

        if (v == n-1) {
            cout << dist << endl;
            return 0;
        }

        for (edge &e : G[v]) {
            if (t[e.to] == 2) {
                int ntim = min(x, tim+e.cost);
                if (d[e.to][type][ntim] > d[v][type][tim] + e.cost) {
                    d[e.to][type][ntim] = d[v][type][tim] + e.cost;
                    q.push(P(d[e.to][type][ntim], data(e.to, type, ntim)));
                }
            } else {
                if (type != t[e.to] && tim + e.cost < x) continue;
                if (d[e.to][t[e.to]][0] > d[v][type][tim] + e.cost) {
                    d[e.to][t[e.to]][0] = d[v][type][tim] + e.cost;
                    q.push(P(d[e.to][t[e.to]][0], data(e.to,t[e.to],0)));
                }
            }
        }
    }
}

Measured memory_bytes: 20132
#include<iostream>
#include<string>
#include<sstream>
using namespace std;
int main()
{
	int n,m;
	string a,b,p,c;
	stringstream ss;
	getline(cin,p);
	ss.str(p);
	ss>>a;
	ss>>b;
	cin>>n>>m;
	getchar();
	cin>>c;
	if(a==c)n--;
	if(b==c)m--;
	cout<<n<<" "<<m;
 } 

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

int main(){
    int Q;
    cin >> Q;
    multiset<ll> l, r;
    ll fmin = 0, x = 0;
    
    for (int z = 0; z < Q; z++) {
        int op;
        cin >> op;
        if (op == 1) {
            ll a, b;
            cin >> a >> b;
            fmin += b;
            if (z == 0) {
                l.insert(a);
                r.insert(a);
                x = a;
            }else {
                auto it1 = l.end();
                it1--;
                auto it2 = r.begin();
                ll t = *it1;
                ll u = *it2;
                if (a < t) {
                    l.erase(it1);
                    r.insert(t);
                    l.insert(a);
                    l.insert(a);
                    fmin += t-a;
                    x = *(l.rbegin());
                }else if(u < a) {
                    r.erase(it2);
                    l.insert(u);
                    r.insert(a);
                    r.insert(a);
                    fmin += a-u;
                    x = *(l.rbegin());
                }else {
                    l.insert(a);
                    r.insert(a);
                    x = a;
                }
            }
        }
        if (op == 2) {
            printf("%lld %lld\n", x, fmin);
        }
    }
    return 0;
}


Measured memory_bytes: 18944
#include<iostream>
using namespace std;
int main(){
	int a,b,c,d,l,r;
	cin>>a>>b>>c>>d;
	l=a+b;
	r=c+d;
	if(l>r)
	cout<<"Left"<<endl;
	if(l==r)
	cout<<"Balanced"<<endl;
	if(l<r)
	cout<<"Right"<<endl;
	return 0;
}

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

int main(void){
    int a, b;
    cin >> a >> b;
    if(a <= 0 && b >= 0){
        cout << "Zero" << endl;
    }else if(b < 0){
        int sum = 0-a;
        sum += b + 1;
        if(sum%2==0){
            cout << "Positive" << endl;
        }else{
            cout << "Negative" << endl;
        }
    }else if(a > 0){
        cout << "Positive" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

int n, k;
int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> k;
	printf("%d\n", (n + k - 3) / (k - 1));
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
  string s;
  int a=0;
  cin>>s;
  int x=s.size();
  sort(s.begin(),s.end());
  for(int i=0;i<x;i++){
    if(s[i]==s[i+1])
      a++;
  }
  if(a>0)
    cout<<"no"<<endl;
  else
    cout<<"yes"<<endl;
  return 0;
}


Measured memory_bytes: 256
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
int main(){
    int l,r,d;
    cin>>l>>r>>d;
    int ans=0;
    for (int i=l; i<=r; i++){
        if (i%d==0) ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 3672
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long a = sc.nextLong();
        long b;
        n--;
        
        while (n-- > 0) {
            b = sc.nextLong();
            a = gcd(a, b);
        }
        
        System.out.println(a);
    }
    
    public static long lcm(long m, long n) {
        return m * (n / gcd(m, n));
    }
    
    public static long gcd(long a, long b) {
        if (b == 0) return a;
        
        return gcd(b, a % b);
    }
}

Measured memory_bytes: 47532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7,MAX = 1e5;

int main()
{
	int h,w;
	cin >> h >> w;
	vector<string> a(h);
	for(int i = 0;i<h;i++)cin >> a[i];
	vector<int> cnt(26);
	for(int i=0;i<h;++i)
	{
		for(int j = 0;j<w;++j)
		{
			cnt[a[i][j]-'a']++;
		}
	}
	
	for(int i =0;i<26;i++)cnt[i]%=4;
	//両方奇数奇数がひとつだけでおｋ
	if((h%2==1)&&(w%2==1))
	{
		ll is  = 0;
		ll c = 0;
		for(int i = 0;i<26;i++)
		{
			is+=cnt[i]&1;
			c += cnt[i]/2;
		}
		if(is>1||c>(h+w)/2)
		{
			cout<<"No"<<endl;
		}
		else
		{
			cout<<"Yes"<<endl;
		}
		
	}//片方偶数奇数が残ってたらアウト
	else if((h%2==1&&w%2==0)||(h%2==0&&w%2==1))
	{
		//cout<<';'<<endl;
		ll c = 0;
		for(int i = 0;i<26;i++)
		{
			c += cnt[i]/2;
			if(cnt[i]%2==1)
			{
				cout<<"No"<<endl;
				return 0;
			} 
		}
		ll gusu = h&1?w:h;
		//cout<<gusu<<endl;
		//cout<<c<<endl;
		if(c>gusu/2)
		{
			cout<<"No"<<endl;
		}
		else
		{
			cout<<"Yes"<<endl;
		}
		

	}
	else//両方偶数全部ゼロ
	{
		
		bool is = true;
		for(int i =0;i<26;i++)
		{
			if(cnt[i])
			{
				cout<<"No"<<endl;
				return 0;
			}
		}
		cout<<"Yes"<<endl;


	}
	return 0;
}

Measured memory_bytes: 256
N, M, X = map(int, input().split())
A_list = [int(x) for x in input().split()]
minus_counter = 0
plus_counter = 0
for i in range(len(A_list)):
    if A_list[i] > X:
        break
    minus_counter += 1
for i in range(minus_counter, len(A_list)):
    plus_counter += 1
print(min(minus_counter, plus_counter))

Measured memory_bytes: 3064
#include "bits/stdc++.h"

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;

void solve(){
	int a,b;
	cin >> a >> b;
	if(a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0){
		P("Possible");
	}else{
		P("Impossible");
	}
}

int main() {
    solve();
    return 0;
}


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

int main() {
  int k,a,b;
  cin >> k>>a>>b;
  int c=1,d;
  while(c){
    d=c*k;
    if(d>=a && d<=b){
      cout << "OK" << endl;
      break;
    }
    if(d>b){
      c=0;
      break;
    }
    c++;
  }
  
  if(!c)cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

constexpr int INF = 1e8;

vector<pair<int,int>> e[100000]; // (q,c)
int dist[100000];
set<int> coms[100000];

int main(void) {
    int i, n, m;
    scanf("%d%d",&n,&m);
    REP (i,m) {
        int p, q, c;
        scanf("%d%d%d",&p,&q,&c);
        p--; q--;
        e[p].emplace_back(q,c);
        e[q].emplace_back(p,c);
    }
    priority_queue<pair<int,int>> q; // (-d,v)
    q.push(make_pair(0,0));
    REP (i,n) dist[i] = INF;
    dist[0] = 0;
    while (!q.empty()) {
        int d = -q.top().first;
        int v = q.top().second;
        q.pop();
        if (dist[v] < d) continue;
        for (auto p: e[v]) {
            int cost = d + (!coms[v].count(p.second));
            if (dist[p.first] > cost) {
                dist[p.first] = cost;
                q.push(make_pair(-cost,p.first));
                coms[p.first].clear();
                coms[p.first].insert(p.second);
            }
            else if (dist[p.first] == cost)
                coms[p.first].insert(p.second);
        }
    }
    if (dist[n-1] == INF)
        puts("-1");
    else
        printf("%d\n",dist[n-1]);
    return 0;
}


Measured memory_bytes: 23412
///----> bismillahir rahmanir rahim <---- -- { ^ _ ^ }
///     { ^_^ }   { ^ _ ^ }
#include<bits/stdc++.h>
#include<bits/stdc++.h>
using namespace std;

//<--------------------------------------------typo section--------------------------------------------->
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;
typedef priority_queue<int>piwi;
typedef queue<int>kiwi;
typedef map<int,int>mi;
typedef map<string,int>mis;
typedef multimap<int,int>muli;
typedef multimap<string,int>muls;
typedef multiset<int>si;

//<----------------------------------------------------Narcos----------------------------------------------->
#define endl "\n"
#define Y cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define yes cout<<"Yes"<<endl;
#define no cout<<"No"<<endl;
#define sp " "
#define PB push_back
#define F first
#define S second
#define as(a) (a).begin(),(a).end()
#define ras(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()
#define ki 1LL
#define MOD 1000000007
#define over return 0;
#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))
#define test int t;cin>>t;while(t--)


//<-----------------------------------------------------Const--------------------------------------------------->
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;


//<--------------------------------------------------------------------------------------------------->
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

const long long MAX_SIZE = 1000001; vector<long long >isprime(MAX_SIZE , true); vector<long long >prime; vector<long long >SPF(MAX_SIZE); void manipulated_seive(int N) { isprime[0] = isprime[1] = false ; for (long long int i=2; i<N ; i++) { if (isprime[i]) { prime.push_back(i); SPF[i] = i; } for(int j=0;j < (int)prime.size() && i*prime[j] < N && prime[j] <= SPF[i]; j++) { isprime[i*prime[j]]=false; SPF[i*prime[j]] = prime[j] ; } } }
int man_seive(int n){ manipulated_seive(n); for(int i=0;i<prime.size() && prime[i]<=n;i++)
cout<<prime[i]<<endl;
}
ll gcd ( ll a, ll b ) { return __gcd ( a, b ); }
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }

//continue;

//-----------------------------> YOUR JOURNEY STARTS HERE ------------------------------------>>

int main(){
    optimize();

    string s;cin>>s;
    string t;cin>>t;
    for(int i=0;i<s.size();i++){
        if(s==t){
            yes
            over
        }
        s=s.back()+s.substr(0,s.size()-1);
    }
    no
over
}

Measured memory_bytes: 18604
S = input()


count_0 = 0
count_1 = 0

current_0 = 0
current_1 = 1 
for s in S:
    if int(s) != current_0:
        count_0 += 1

    if int(s) != current_1:
        count_1 += 1

    current_0 += 1
    current_0 %= 2 

    current_1 += 1
    current_1 %= 2 

print(min(count_0, count_1))





Measured memory_bytes: 41452
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
using LL = long long int;
using ULL = unsigned long long;

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, n) {
        cin >> p[i];
    }
    auto p2 = p;
    sort(p2.begin(), p2.end());
    LL cnt = 0;
    rep(i, n) {
        if (p[i] != p2[i]) cnt++;
    }
    if (cnt <= 2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<cstdio>
#include<iomanip>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int INF = 1e9 + 7;
int main() {
	int N, K;
	cin >> N >> K;
	priority_queue<ll>kind[N];
	for (int i = 0; i < N; ++i) {
		ll t, d;
		cin >> t >> d;
		kind[t - 1].push(d);
	}
	priority_queue<ll>best, remain;
	for (int i = 0; i < N; ++i) {
		if (!kind[i].empty()) {
			best.push(kind[i].top());
			kind[i].pop();
			while (!kind[i].empty()) {
				remain.push(kind[i].top());
				kind[i].pop();
			}
		}
	}
	vector<ll>bsum = { 0 };
	vector<ll>rsum = { 0 };
	while (!best.empty()) {
		bsum.push_back(bsum.back() + best.top());
		best.pop();
	}
	while (!remain.empty()) {
		rsum.push_back(rsum.back() + remain.top());
		remain.pop();
	}
	ll ans = 0;
	for (ll i = 1; i <= K; ++i) {
		if (i >= bsum.size())break;
		if (K - i >= rsum.size())continue;
		ans = max(ans, bsum[i] + rsum[K - i] + i * i);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8820
#include <stdio.h>
 
int main(void) {

 
    char str[8];
    scanf("%s", str);
  
  if('7'==str[2]){
    printf("Yes");
  }else if('7'==str[1]){
    printf("Yes");
  }else if('7'==str[0]){
     printf("Yes");
  }else{
        printf("No");}
 
 
    return 0;
}

Measured memory_bytes: 1684
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

int n, m;
int mincost[100][100];
int a[1000], b[1000], c[1000];

int main() {
	cin >> n >> m;
	
	fill(mincost[0], mincost[n], INF);
	
	REP(i, n) mincost[i][i] = 0;
	REP(i, m) {
		scanf("%d %d %d", &a[i], &b[i], &c[i]);
		a[i]--; b[i]--;
		mincost[a[i]][b[i]] = mincost[b[i]][a[i]] = c[i];
	}
	REP(k, n) REP(i, n) REP(j, n) {
		mincost[i][j] = min(mincost[i][j], mincost[i][k] + mincost[k][j]);
	}
	
	int ans = 0;
	REP(i, m) {
		if (mincost[a[i]][b[i]] < c[i]) ans++;
	}
	cout << ans << endl;
	return 0;
}

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

long long power(long long x,long long y)
{
    long long res = 1; x=x%m;
    while (y > 0)
    {
        if (y & 1) res = (res*x)%m;
        y = y>>1;
        x = (x*x)%m;
    }
    return res%m;
}


int main()
{
    long long n; cin>>n;
    long long x=n/500;
    long long ans=1000*x;
    n=n%500;
    ans+=(n/5)*5;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args) {
 
    while(kbd.hasNext()){
        int m = kbd.nextInt();
        int f = kbd.nextInt();
        int r = kbd.nextInt();
 
        if(!(m==-1 && f==-1 && r==-1)){
        int p = m+f;
        if(m==-1 || f==-1) System.out.println("F");
        else if(p>=80) System.out.println("A");
        else if(p>=65 && p<80) System.out.println("B");
        else if(p>=50 && p<65) System.out.println("C");
        else if(p>=30 && p<50) {
            if(r>=50) System.out.println("C");
            else System.out.println("D");
        }
        else System.out.println("F");
        }
    }
    }
}

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  ll N;
  scanf("%lld", &N);

  ll v1 = 0;
  ll v2 = 0;
  ll v3 = 0;

  // vector<ll> list;
  ll ans = 1;
  for (ll i = 0; i < N; i++) {
    ll v;
    scanf("%lld", &v);
    // list.emplace_back(v);

    ll num = 0;
    if (v1 == v) num++;
    if (v2 == v) num++;
    if (v3 == v) num++;

    if (v1 == v) {
      v1++;
    } else if (v2 == v) {
      v2++;
    } else if (v3 == v) {
      v3++;
    }

    ans = (ans * num) % MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;

int n, k;
ld win = 0;

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

  for (int i = 1; i <= n; i++) {
    int flips = 0;
    int j = i;
    while (j < k) {
      flips++;
      j += j;
    }
    win += 1.0 / n * 1.0 / pow(2, flips);
  }

  printf("%.12LF\n", win);


  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int N,K,X,Y,a,b,c;
	scanf("%d %d %d %d",&N,&K,&X,&Y);
	if(N>K){
		a=K*X;
		b=(N-K)*Y;
		c=a+b;
		printf("%d\n",c);
	}
	else{
		a=N*X;
		printf("%d\n",a);
	}
	return 0;
}

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

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

  int cnt = 0;
  for ( int i = 0; i < n; i++ ) {
    int a;
    cin >> a;
    bool flag = true;
    for ( int j = 2; j <= sqrt(a); j++ ) {
      if ( a % j == 0 ) {
	flag = false;
	break;
      }
    }
    if ( flag ) cnt++;
  }

  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 3080
n=input()
l=sorted(map(int,input().split()))
n=len(l)
if n<3:
  print(0)
  exit()
c=0
for i in range(n-2):
  for j in range(i,n-1):
    for k in range(j,n):
      if l[i]==l[j]:
        continue
      if l[j]==l[k]:
        continue
      if l[i]+l[j]>l[k]:
        c+=1
print(c)

Measured memory_bytes: 9188
//============================================================================
// Name        : ATcoder.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>
using namespace std;

int main() {

	char chr;
	int n;
	int m;
	int d;
	int a[200][200]={};
	int flg;
	int total=0;
	cin>>n>>m>>d;


	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			cin>>chr;
			if(chr=='.')a[i][j]=1;
		}
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			flg=0;
			for(int k=0; k<d; k++){
				if(a[i][j+k]==0){
					flg=1;
				}
			}
			if(flg==0)++total;
		}
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			flg=0;
			for(int k=0; k<d; k++){
				if(a[i+k][j]==0){
					flg=1;
				}
			}
			if(flg==0)++total;
		}
	}
	cout<<total<<endl;


}

Measured memory_bytes: 3236
#include <iostream>
#define rep(i,n) for (i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    ll l, r;
    cin >> l >> r;
    r = min(r, l+4038);
    int ans = 2018;
    for(ll i = l; i <= r; i++){
        for(ll j = i+1; j <= r; j++){
            int x = i*j%2019;
            ans = min(ans, x);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
        int D;
        scanf("%d", &D);
        
        switch(D) {
        case 22:
                puts("Christmas Eve Eve Eve");
                break;
        case 23:
                puts("Christmas Eve Eve");
                break;
        case 24:
                puts("Christmas Eve");
                break;
        case 25:
                puts("Christmas");
                break;
        }

        return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a % 2 == 0 || b % 2 == 0) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  vector<pair<int64_t,char>> deli(a+b+c);
  for(int64_t i = 0; i < (a+b+c); i++){
    int d; cin >> d;
    char dc;
    if(i < a)
      dc = 'r';
    else if (i < (a+b))
      dc = 'g';
    else
      dc = 'w';
    deli[i] = make_pair(d, dc);
  }
  sort(deli.begin(), deli.end());
  reverse(deli.begin(), deli.end());
  
  int64_t sum = 0, cnt_r = 0, cnt_g = 0, cnt = 0;
  
  for(int64_t i = 0; i < (a+b+c); i++){
    char color = deli[i].second;
    if(color == 'r' && cnt_r == x)
      continue;
    if(color == 'g' && cnt_g == y)
      continue;
    
    sum += deli[i].first;
    cnt++;
    
    if(color == 'r')
      cnt_r++;
    if(color == 'g')
      cnt_g++;
    
    if(cnt == (x+y))
      break;
  }
  
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 4992
#include <iostream>

using namespace std;

int main() {
    int N;
    int K;
    cin >> N >> K;
    int index = 0;
    for (int i = 0; i < N; ++i) {
        int tmp;
        cin >> tmp;
        if (tmp == 1) {
            index = i;
            break;
        }
    }

    int ans = 0;
    if (index != 0) {
        int p = index - K + 1;
        ++ans;
        if (p < 0) {
            index = K - 1;
        } else {
            while (p > 0) {
                p = p - K + 1;
                ++ans;
            }
            index = index + (-1 * p);
        }
    }

    while (index < (N - 1)) {
        index = index + K - 1;
        ++ans;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vll vector<ll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define Fo(i,s,e) for(ll i=(s);(s>e)?i>e:i<e;(s>e)?i--:i++)
ll mod1 = 1e9 + 7;
ll mod2 = 998244353;

//ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}

ll g(ll x,ll y){
	ll ans = 1;
    while(y>1){
    	ll temp = __gcd(x,y);
    	y/= temp;
    	ans*= temp;
    	if(temp == 1)break;
    }
    return ans;
}
const long double pi = 3.141592653589793238;
void solve(){
 	ll r;
 	cin>>r;
 	long double c = (long double)2*pi*r;
 	printf("%0.20Lf",c);
}





int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    //freopen("error.txt" , "w" , stderr) ;
    #endif
    ll t = 1;
    //cin>>t;
    while(t--){
    	solve();
    }
    
    		






}

Measured memory_bytes: 3768
#include<bits/stdc++.h>
#define pb push_back
#define pf push_front
#define clr(x) memset(x, 0, sizeof(x))
#define all(a) a.begin(),a.end()
#define forn(i, a,b) for(int i = int(a); i < int(b); ++i)
#define forn_r(i, b, a) for(int i = int(b); i > int(a); i--)
#define trav(a,x) for (auto& a : x)
#define printArray(array, length) for(int i = 0; i < length; i++) cout<< array[i] << (i == length - 1 ? '\n' : ' '); 
#define print(x) cout << x << '\n'
#define print2(x, y) cout << x << ' ' << y << '\n'
#define debug(x) cout << #x << "=" << x << endl
#define debug2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
template <typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template <typename T> bool chmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }

using namespace std;
typedef long long ll; 
const int INF = 0x3f3f3f3f;
const ll LNF  = 0x3f3f3f3f3f3f;
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline ll  gcd(ll  a, ll  b) { return b ? gcd(b, a % b) : a; }
inline int lcm(int a, int b) { return a * b / gcd(a, b); }
int r,c,k;
const int MAXR =3005, MAXC=3005;
int grid[MAXR+1][MAXC+1];
ll dp[MAXR+1][MAXC+1][4];
ll ans;
ll calc(int x,int y, int re){
	
	if(dp[x][y][re]!=-LNF)
		return dp[x][y][re];
	if(x>r || y>c){
		return dp[x][y][re]=0;
	}
	else if(re==3){
		ans = calc(x+1,y,0); 	
	}
	else{
		ans = max({grid[x][y]+calc(x+1,y,0),grid[x][y]+calc(x,y+1,re+1),calc(x+1,y,0),calc(x,y+1,re)});
	}
	dp[x][y][re]=ans;

	return ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t =1;
    
    while(t--){
    	cin>>r>>c>>k;
    	int t1,t2,v;
    	forn(i,0,k){
    		cin>>t1>>t2>>v;
    		grid[t1][t2]=v;
    	}
    	forn(i,0,MAXR+1)forn(j,0,MAXC+1)forn(k,0,3)dp[i][j][k]=-LNF;
    	
    	ll temp=calc(1,1,0);
    	print(temp);
    	//forn(i,0,r+1)forn(j,0,c+1)forn(k,0,3) print(dp[i][j][k]);
    }
    return 0;
}

Measured memory_bytes: 321988
H, W, K = map(int, input().split())
S = [input() for _ in range(H)]
hbit, wbit = 1 << H, 1 << W
cnt = 0
for i in range(hbit):
  for j in range(wbit):
    ccnt = 0
    for k in range(H):
      for l in range(W):
        if not (((i>>k)&1) + ((j>>l)&1)):
          ccnt += (S[k][l] == '#')
    cnt += (ccnt == K)
print(cnt)

Measured memory_bytes: 9192
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int n,k,now,top,t;
int main()
{
	scanf("%d%d",&n,&k);
	scanf("%d",&now);
	top=now;
	for(int i=2;i<=n;++i)
	{
		scanf("%d",&t);
		top=max(top,t);
		now=__gcd(t,now);
	}
	if(k>top)
	{
		printf("IMPOSSIBLE");
	}
	else 
	{
		printf((k%now==0?"POSSIBLE":"IMPOSSIBLE"));
	}
	return 0;
}

Measured memory_bytes: 256
N = gets.to_i
S = gets.to_i
M = 320_000
(2..M).each do |b|
  n = N
  a = 0
  while n > 0
    a += n % b
    n /= b
  end
  if a == S
    puts b
    exit
  end
end
d = N - S
if d == 0
  puts N + 1
  exit
else
  M.downto(1).each do |c|
    if d % c == 0 && (b = d / c + 1) > M && (q = S - c) >= 0 && q < b
      puts b
      exit
    end
  end
end
puts(-1)


Measured memory_bytes: 1916
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#ifdef _debug
#define dout(i) cout << #i << ' ' << i << ' '
#else 
#define dout(i) //
#endif
using ll = long long;
using ull = unsigned long long;
using ul = unsigned;
using db = double;
int dif = 0;
const int maxn = 300000;
ll a[maxn], b[maxn];
int n;
ll res, sum;
int pos;
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n;
	for(int i = 1;i <= n;++i){
		cin >> a[i] >> b[i];
		sum += b[i];
	}
	for(int i = 1;i <= n;++i){
		if(a[i] > b[i])res = max(res, sum-b[i]);
	}
	cout << res << '\n';
}

Measured memory_bytes: 2432
import java.util.Scanner;
import java.util.InputMismatchException;
 
class Main {
  public static void main(String args[]) {
	Scanner scanner = new Scanner(System.in);
    int input1 = scanner.nextInt();
    int input2 = scanner.nextInt();
    int input3 = scanner.nextInt();
    int input4 = scanner.nextInt();
    int input5 = scanner.nextInt();
    
    int int1 = input3 - input1;
    int1 = int1 * 60;
    int int2 = input4 - input2;
    int int3 = int1 + int2;
    int3 = int3 - input5;
    System.out.println(int3);
  };
};

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

int main(){
  int i,n,m;
  string s,t;

  cin >> s;
  cin >> t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if(s<t) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int main(){
    string S;
    cin >> S;
    string s = S;
    transform(s.begin(), s.end(), s.begin(), ::tolower);
    if (S == s) cout << "a" << endl;
    else cout << "A" << endl;
}



Measured memory_bytes: 3624
r,d,x = map(int,input().split())

def ike(n,r,d,x):
    if n == 0:
        return x
    return r*ike(n-1,r,d,x)-d

if __name__ == "__main__":
    for i in range(10):
        print(ike(i+1,r,d,x)) 

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

int main(){
  int n,m;
  cin >> n >> m;
  int s = 0;
  while(m--){
  int temp;
    cin >>temp;
    s += temp;
  }
  if(s > n)cout << -1 << endl;
  else cout << n-s << endl;
return 0;
}

Measured memory_bytes: 3592
N = int(input())
s = N
l = len(str(s))
ans = 0
for i in range(l):
    if (l - i) % 2 == 1:
        ans += N - 10 ** (l - i - 1)
    N = 10 ** (l - i - 1)
if l % 2 == 1:
    print(ans + 1)
else:
    print(ans)

Measured memory_bytes: 3060