akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a>b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define endl "\n"
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
int dp[22][22][22][22]={};
int ma=0;
char s[22][22];
int h,w;

void con(P p,int w2,int h2,int cnt){
  rep(i,4){
    switch(i){
      case 0:
      if(w2+1<w)
        if(s[h2][w2+1]=='.'){
          if(cnt<dp[p.F][p.S][h2][w2+1]){
            dp[p.F][p.S][h2][w2+1]=cnt;
            con(p,w2+1,h2,cnt+1);
          }
        }
        break;
      case 1:
      if(w2-1>=0)
        if(s[h2][w2-1]=='.'){
          if(cnt<dp[p.F][p.S][h2][w2-1]){
            dp[p.F][p.S][h2][w2-1]=cnt;
            con(p,w2-1,h2,cnt+1);
          }
        }
        break;
      case 2:
      if(h2+1<h)
        if(s[h2+1][w2]=='.'){
          if(cnt<dp[p.F][p.S][h2+1][w2]){
            dp[p.F][p.S][h2+1][w2]=cnt;
            con(p,w2,h2+1,cnt+1);
          }
        }
        break;
      case 3:
      if(h2-1>=0)
        if(s[h2-1][w2]=='.'){
          if(cnt<dp[p.F][p.S][h2-1][w2]){
            dp[p.F][p.S][h2-1][w2]=cnt;
            con(p,w2,h2-1,cnt+1);
          }
        }
        break;
    }
  }
}

int main() {
  cin>>h>>w;
  rep(i,h){
    rep(j,w){
      cin>>s[i][j];
      rep(k,h){
        rep(l,w)
        dp[k][l][i][j]=1010101;
      }
    }
  }
  rep(i,h){
    rep(j,w){
    P p={i,j};
    if(s[i][j]=='.'){
      dp[i][j][i][j]=0;
    
      con(p,j,i,1);}}
  }
  rep(i,h){
    rep(j,w){
      rep(k,h){
        rep(l,w)
        if(dp[k][l][i][j]!=1010101)
        MAX(ma,dp[k][l][i][j]);
      }
    }
  }
  cout<<ma<<endl;
}


Measured memory_bytes: 1152
// A.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
	string s;
	cin >> s;
	string ans;
	if (s == "Sunny") {
		ans = "Cloudy";
	}
	if (s == "Cloudy") {
		ans = "Rainy";
	}
	if (s == "Rainy") {
		ans = "Sunny";
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
		public static void main(String[] args) {
		
	   Scanner sc = new Scanner(System.in);
	   
	   int H = sc.nextInt();
	   int W = sc.nextInt();
	   
	   String a[] = new String[H];
			   
	   for(int i=0; i<H; i++) {
		   a[i] = sc.next();
		   System.out.println(a[i]);
		   System.out.println(a[i]);
	   }
	  
		}
}


Measured memory_bytes: 23892
#include<iostream>
#include<string>

using namespace std;

bool _match(int pos, string a, string b) {
      size_t l = a.length();
      for(ulong i = 0; i < l; i++) {
        if(a[i] != b[(i + pos) % l]) return false;
      }
      return true;
}

bool match(string a, string b) {
    auto l = a.length();
    for(ulong i = 0; i < l; i++) {
        if(_match(i, a, b)) return true;
    }
    return false;
}

int main() {
    string a, b;
    
    cin >> a;
    cin >> b;
    cout << (match(a, b) ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
struct interval{
    ll score;
int open,close;
};
class segtree{
    ll *tree;
    ll *upd;
    int n;
    public:
    segtree(int n)
    {
        this->n = n;
        tree = new ll[4*n]{0};
        upd = new ll[4*n]{0};
    }
    void push(int node)
    {
        tree[2*node+1] += upd[node];
        tree[2*node+2] += upd[node];
        upd[2*node+1] += upd[node];
        upd[2*node+2] += upd[node];
        upd[node] = 0;
    }
    void update(int idx,int s,int e,int l,int r,ll val)
    {
        if(l>e||r<s)
        return;
        if(s>=l&&e<=r)
        {
            tree[idx] += val;
            upd[idx] += val;
            return;
        }
        int mid = (s+e)/2;
        push(idx);
        update(2*idx+1,s,mid,l,r,val);
        update(2*idx+2,mid+1,e,l,r,val);
        tree[idx] =  max(tree[2*idx+1],tree[2*idx+2]);
    }
    ll query(int idx,int s,int e,int l,int r)
    {
        if(l>e||r<s)
        return LONG_MIN;
        if(s>=l&&e<=r)
        {
            return tree[idx];
        }
        int mid = (s+e)/2;
        push(idx);
        ll a = query(2*idx+1,s,mid,l,r);
        ll b = query(2*idx+2,mid+1,e,l,r);
        return max(a,b);
    }
};
ll solve(vector<interval> v,int n)
{
    vector<int> endings[n];
    for(int i=0;i<v.size();i++)
    {
        endings[v[i].close].push_back(i);
    }
    segtree dp(n);
    for(auto j:endings[0])
    {
        dp.update(0,0,n-1,v[j].open,v[j].close,v[j].score);
    }
    for(int i=1;i<n;i++)
    {
        ll large = max(dp.query(0,0,n-1,0,i-1),0ll);
        // cout<<i<<" "<<large<<endl;
        dp.update(0,0,n-1,i,i,large);
        for(auto j:endings[i])
        {
            dp.update(0,0,n-1,v[j].open,v[j].close,v[j].score);
        }
    }

    return max(dp.query(0,0,n-1,0,n-1),0ll);
}
int main() {
    int n,m;
    cin>>n>>m;
    vector<interval> v(m);
    for(int i=0;i<m;i++)
    {
        cin>>v[i].open>>v[i].close>>v[i].score;
        v[i].open--;
        v[i].close--;
    }
    cout<<solve(v,n);
}


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

// @author: pashka

int n;
vector<int> tree;

int get_max(int l, int r) {
    int res = 0;
    l += n;
    r += n;
    while (l <= r) {
        if (l % 2 == 1) res = max(res, tree[l]);
        if (r % 2 == 0) res = max(res, tree[r]);
        l = (l + 1) / 2;
        r = (r - 1) / 2;
    }
    return res;
}

void set_val(int i, int v) {
    i += n;
    while (i > 0) {
        tree[i] = max(tree[i], v);
        i /= 2;
    }
}

int main() {
    ios::sync_with_stdio(false);

    cin >> n;
    vector<pair<int, int>> a(n);
    for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
    sort(a.begin(), a.end());
    vector<int> u(n);

    tree.resize(2 * n);

    for (int i = n - 1; i >= 0; i--) {
        int x = a[i].first;
        int d = a[i].second;
        int l = i;
        int r = n;
        while (r > l + 1) {
            int m = (l + r) / 2;
            if (a[m].first < x + d) l = m; else r = m;
        }
        // i..l
        u[i] = max(get_max(i, l), i);
        set_val(i, u[i]);
    }

    vector<int> d(n + 1);
    d[n] = 1;
    for (int i = n - 1; i >= 0; i--) {
        d[i] = d[i + 1];
        d[i] += d[u[i] + 1];
        d[i] %= 998244353;
    }
    cout << d[0] << "\n";

    return 0;
}

Measured memory_bytes: 4992
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#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 CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



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


double N = 0;
int goal[2];
int M = 0;
vector<vector<int>>MV;


void input(void) {

	return;
}


int main(void) {
	double sum = 0;
	double num = 0;

	while (CI N) {
		sum += N;
		num = N;
		for (int i = 2; i <= 10; i++) {
			if (i % 2 == 0) {
				sum += num * 2;
				num *= 2;
			}
			if (i % 2 == 1) {
				sum += num / 3.0;
				num /= 3.0;
			}
		}
		printf("%.7f\n", sum);
		sum = 0;
		num = 0;
	}


	return 0;
}

Measured memory_bytes: 3184
# -*- coding: utf-8 -*-
# AtCoder 星には四種類の塩基 A, C, G, T が存在し、A と T、C と G がそれぞれ対になります。
#  が入力されます。これは A, C, G, T のいずれかです。塩基 
#  と対になる塩基を表す文字を出力するプログラムを書いてください。
# 制約は文字 A, C, G, T のいずれかである。
# 整数の入力
input = input()

if input == "A":
  	# 出力
	print("T")
    
elif input == "C":
	print("G")

elif input == "G":
	print("C")

else:
	print("A")
	

Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
using namespace std;
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<pin,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define sq(a) (a)*(a)
#define rev(s) reverse(s.begin(),s.end())
#define end_pr(s) cout << s <<endl;return 0
#define itn int
#define bs bitset<5001>

int kai_size = 120001;
vel kai(kai_size, 1);
vel ink(kai_size, 1);
int RE() {
	vel v(3, 2);
	return v.at(4);
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; }
	return ans % p;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, kai_size - 1) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, kai_size) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p; ans *= ink[n - r]; ans %= p;
	return ans;
}
vel dis(int mid1, vvel &way) {
	int n = way.size();
	vel dist(n, -1); dist[mid1] = 0;
	queue<int> q;
	q.push(mid1);
	while (!q.empty()) {
		int st = q.front(); q.pop();
		rep(i, way[st].size()) {
			int to = way[st][i];
			if (dist[to] == -1) {
				dist[to] = dist[st] + 1;
				q.push(to);
			}
		}
	}
	return dist;
}
pin most_far(int now, int n, vvel &way) {
	vel dist1 = dis(now, way);
	pin ans = mkp(-1, 0);
	rep(i, n) {
		if (dist1[i] > ans.first) { ans = mkp(dist1[i], i); }
	}
	return ans;
}

int per(int a, int b) {
	int ans = a % b;
	if (ans < 0) { ans += b; }
	return ans;
}
V<pin> uni(V<pin> &v) {
	sor(v);
	V<pin> ans(1, v[0]);
	for (int i = 1; i < v.size(); i++) {
		if (v[i] != v[i - 1]) { ans.push_back(v[i]); }
	}
	v = ans;
	return v;
}
int s_gcd(int a, int b) {
	if (b == 0) { return a; }
	return s_gcd(b, a%b);
}
int gcd(int a, int b) {
	if (a < b) { swap(a, b); }
	return s_gcd(a, b);
}
signed main() {
	int s; cin >> s;
	int val = 1000000000;
	int y1 = (s + val - 1) / val;
	int x1 = val * y1 - s;
	int x2 = val;
	int y2 = 1;
	cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << 0 << " " << 0 << endl;
	return 0;
}

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

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

    string s;
    cin >> s;

    int cnt0 = 0;
    int cnt1 = 0;
    REP(i, s.size()) {
        if (s[i] == '0') cnt0++;
        else cnt1++;
    }

    cout << min(cnt0, cnt1) * 2 << '\n';
    return 0;
}


Measured memory_bytes: 512
//
//  ROIGold.cpp
//  Main calisma
//
//  Created by Rakhman on 05/02/2019.
//  Copyright © 2019 Rakhman. All rights reserved.
//

#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>

#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define NL cout << '\n';
#define EX exit(0)
#define all(s) s.begin(), s.end()
#define FOR(i, start, finish, k) for(int i = start; i <= finish; i += k)

const int MXN = 1e6 + 200;
const long long MNN = 4e2 + 200;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const int OO = 1e9 + 500;

typedef long long llong;
typedef unsigned long long ullong;

using namespace std;

string s, t;
pair<int, pair<int, int> > dp[3010][3010];

int main () {
    ios;
    cin >> s >> t;
    s = '#' + s;
    t = '#' + t;
    for(int i = 1; i < s.size(); i++){
        for(int j = 1; j < t.size(); j++){
            if(s[i] == t[j]){
                dp[i][j].F = dp[i - 1][j - 1].F + 1;
                dp[i][j].S = {i, j};
            }
            if(dp[i][j - 1].F > dp[i][j].F){
                dp[i][j] = dp[i][j - 1];
            }
            if(dp[i - 1][j].F > dp[i][j].F){
                dp[i][j] = dp[i - 1][j];
            }
        }
    }
    string ans = "";
    int i = dp[s.size() - 1][t.size() - 1].S.F, j = dp[s.size() - 1][t.size() - 1].S.S;
    while(i >= 1 && j >= 1){
        ans += s[i];
        i--,j--;
        pair<int, int> p = dp[i][j].S;
        i = p.F;
        j = p.S;
        //cout << i << ' ' << j << nl;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << nl;
}


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

#define FST first
#define SCD second
#define MODP 1000000007

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

int main() {
#ifdef FDB
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    int n, m, k;
    cin>>n>>m>>k;
    cout<<(k + max(n, m) - 1) / max(n, m)<<endl; 
    return 0;
}

Measured memory_bytes: 384
{-# LANGUAGE BangPatterns #-}
import           Control.Exception           (assert)
import           Control.Monad
import           Control.Monad.Primitive
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import qualified Data.Map.Strict             as Map
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector                 as VB
import qualified Data.Vector.Mutable         as VBM
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

inf :: Int
inf = 10^18

main = do
  (a:_) <- getLine
  if isLower a
    then putStrLn "a"
    else putStrLn "A"


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

string s;

bool judge(string a, string b){
    int n = a.length();

    for(int i = 0; i < n; i++){
        int cur = 0, posi = i, posj = 0;
        while(cur < n){
            while(posi < n && a[posi] != s[cur])    posi++;
            if(posi == n)   break;
            posi++, cur++;
            if(cur == n)    return true;
            while(posj < n && b[posj] != s[cur])    posj++;
            if(posj == n)   break;
            posj++, cur++;
            if(cur == n)    return true;
        }
    }

    return false;
}

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

    cout << ( (judge(s,t) || judge(t,s)) ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 3232
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main
{
    static long max_with_last_activity(int idx,int prev,int arr[][]){
        if(idx==0)
            return 0;

        if(dp[idx][prev]!=-1)
            return dp[idx][prev];

        long take=0l;
        for(int i=1;i<=3;i++)
            if(i!=prev)
                take=Math.max(arr[idx][i]+max_with_last_activity(idx-1,i,arr),take);

        return dp[idx][prev]=take;
    }

    static long dp[][];
    public static void process()throws IOException
    {
        int n=ni(),arr[][]=new int[n+1][4];

        dp=new long[n+1][4];
        for(long row[] : dp) Arrays.fill(row,-1l);

        for(int i=1;i<=n;i++){
            arr[i][1]=ni();
            arr[i][2]=ni();
            arr[i][3]=ni();
        } 

        pn(max_with_last_activity(n,0,arr));
    }
 
 
    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new FastReader();
 
        long s = System.currentTimeMillis();
        int t=1;
       // t=ni();
        while(t-->0)
            process();
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }
    
    
    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static int ni()throws IOException{return Integer.parseInt(sc.next());}
    static long nl()throws IOException{return Long.parseLong(sc.next());}
    static double nd()throws IOException{return Double.parseDouble(sc.next());}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    
    static long mod=(long)1e9+7l;
 
    static<T> void r_sort(T arr[],int n){
        Random r = new Random(); 
        for (int i = n-1; i > 0; i--){ 
            int j = r.nextInt(i+1); 
                  
            T temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } 
        Arrays.sort(arr); 
    }
    
/////////////////////////////////////////////////////////////////////////////////////////////////////////
    static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 60500
from bisect import insort_left, bisect_left
N = int(input())
S = list(input())
Q = int(input())
Query = [input() for _ in range(Q)]
dic = {chr(i+ord("a")):[] for i in range(26)}
for i, s in enumerate(S):
    dic[s].append(i)
for q in Query:
    t,a,b = q.split()
    a = int(a)-1
    if(t == "1"):
        if(S[a]==b):
            continue
        tmp_index = bisect_left(dic[S[a]],a)
        dic[S[a]].pop(tmp_index)
        insort_left(dic[b],a)
        S[a] = b
    elif(t == "2"):
        b = int(b)-1
        cnt = 0
        for li in dic.values():
            if li and a<=li[-1] and li[bisect_left(li, a)] <= b:
                cnt += 1
        print(cnt)

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

int main(){
  int N;
  cin>>N;
  vector<float> v(N);
  priority_queue<float,vector<float>,greater<float>> S;
  for(int i=0;i<N;++i){
    cin>>v.at(i);
    S.push(v.at(i));
  }

  while(S.size()>1){
    float s1,s2;
    s1=S.top();
    S.pop();
    s2=S.top();
    S.pop();
    S.push((s1+s2)/2);
  }

  printf("%lf\n",S.top());
}

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

#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}





void _main() {
        int a, b; cin >> a >> b;
        cout << (a <= 9 && b <= 9 ? a * b : -1);
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}



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

	vector<int> nums;

	queue<string> que;
	que.push("3");
	que.push("5");
	que.push("7");

	while (!que.empty()) {
		string k = que.front();
		if (k.size()>=3) {
			nums.push_back(stoi(k));
		}
		que.pop();
		if (k.size() <= 8) {
			que.push(k + "3");
			que.push(k + "5");
			que.push(k + "7");
		}
	}
	sort(all(nums));

	int ans = 0;
	for (int i = 0; i < nums.size();i++) {
		if (nums[i] <= n) {
			string check = to_string(nums[i]);
			bool c3 = false;
			bool c5 = false;
			bool c7 = false;
			for (int j = 0; j < check.size(); j++) {
				if (check[j] == '3') {
					c3 = true;
				}
				else if (check[j] == '5') {
					c5 = true;
				}
				else if (check[j] == '7') {
					c7 = true;
				}
			}
			if (c3&&c5&&c7) {
				ans++;
				//cout << nums[i] << endl;
			}
		}
		else {
			break;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 1792
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    string str;
    cin >> str;
    if (count(ALL(str), 'a') == 1 && count(ALL(str), 'b') == 1 && count(ALL(str), 'c') == 1) {
        cout << "Yes" << endl;
        return 0;
    } else {
        cout << "No" << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <limits>
#include <cstdint>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <cstring>
#include <deque>
#include <stack>
#include <queue>
#include <utility> 
#include <iomanip>      // std::setprecision
using namespace std;
typedef long long int l1;
typedef long long unsigned int lu1;
typedef long double ld;
#define FIO std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
// #define __gcd(a,b) __algo_gcd(a,b)
#define PI acos(-1.0)
#define pb push_back
// #define SORT(A) sort(A.begin(), A.end());
// #define REVERSE(A) reverse(A.begin(), A.end());
#define PrintArray(arr) for(int i=0;i<(int)arr.size();i++)cout<<arr[i]<<" ";cout<<endl;
#define pii pair<int,int>
#define pll pair<long long int , long long int>
#define puu pair<long long unsigned , long long unsigned>
const int MOD = 1e9+7;

// Let f(i, H) be the total happiness till the i-th day with Homework on the i-th day. 

// Similarly, let f(i, B) and f(i, S) represent the happiness on the i-th day if a bug is found or swimming is done on the i-th day respectively. 

// Then, f(i, H) = H[i] + Max{f(i - 1, B), f(i - 1, S)}

// We add whichever is better - Bug or Swimming on the (i-1) th day.

// Similarly, we find f(i, B) and f(i, S).

// Answer = max{f(N, H), f(N, B), f(N, S)}

int main()
{
    FIO;
    int t;
    t = 1;
    // cin>>t; 
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    for(int tc=0;tc<t;tc++)
    {   
        int n;
        cin>>n;
        vector<int> arr(n+1), brr(n+1), crr(n+1);
        for(int i1=1;i1<=n;i1++) 
        {
            cin>>arr[i1]>>brr[i1]>>crr[i1];
        }
        int dp[n+10][4];
        for(int j=0;j<=4;j++)
        {
            dp[0][j] = 0;
        }
        dp[1][1] = arr[1];
        dp[1][2] = brr[1];
        dp[1][3] = crr[1];
        for(int i=2;i<=n;i++)
        {
            dp[i][1] = arr[i]+max(dp[i-1][2],dp[i-1][3]);
            dp[i][2] = brr[i]+max(dp[i-1][1],dp[i-1][3]);
            dp[i][3] = crr[i]+max(dp[i-1][1],dp[i-1][2]);
        }
        cout<<max(dp[n][1],max(dp[n][2],dp[n][3]))<<"\n";
    }
    return 0;
}

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

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

int main() {
  for(int t, n; cin >> t >> n && (t|n); ) {
    map<pair<int,int>, int> cost;
    for(int i = 0; i < n; ++i) {
      int x, y;
      cin >> x >> y;
      cost[make_pair(x, y)] = 0;
    }
    int sx, sy;
    cin >> sx >> sy;
    int res = 1;
    queue<pair<int,int> > que;
    cost[make_pair(sx, sy)] = 0;
    que.push(make_pair(sx, sy));
    while(que.size()) {
      int x = que.front().first;
      int y = que.front().second;
      que.pop();
      for(int k = 0; k < 6; ++k) {
        int nx = x + dx[k];
        int ny = y + dy[k];
        if(cost.count(make_pair(nx, ny))) continue;
        res += 1;
        cost[make_pair(nx, ny)] = cost[make_pair(x, y)] + 1;
        if(cost[make_pair(nx, ny)] == t) continue;
        que.push(make_pair(nx, ny));
      }
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i=s;i<n;++i)
#define drep(i,s,n) for (int i=n;i>=s;--i)
#define all(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define print(x) cout<<(x)<<endl
using namespace std;
typedef long long ll;

int gcd(int a,int b)
{if (a%b == 0) return(b);
 else          return(gcd(b,a%b));}
int lcm(int a,int b)
{return a*b/gcd(a,b);}
void printv(vector<auto> v) {cout<<'[';rep(i,0,v.size()){cout<<v[i]<<',';}cout<<']'<<endl;}
void printvv(vector<vector<auto>> vv)
{
  cout<<'['<<endl;
  rep(q,0,vv.size()){cout<<'[';rep(p,0,vv.at(q).size())cout<<vv.at(q).at(p)<<',';cout <<']'<<endl;}
  cout<<']'<<endl;
}
void solve(); int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}
int step_x[] = {-1,0,0,1};
int step_y[] = {0,-1,1,0};
ll INF=10e12;
//------------------------------------------------------------
ll ans=0;
string S;
void solve() {
  cin>>S;

  char last = S[S.size()-1];

  if(last=='2'||last=='4'||last=='5'||last=='7'||last=='9') print("hon");
  else if(last=='0'||last=='1'||last=='6'||last=='8') print("pon");
  else print("bon");

  return;
}


Measured memory_bytes: 3660
# -*- coding: utf-8 -*-
import sys
n, y = map(int,input().split())

for i in range(y // 10000 + 1): #10000円札の枚数
    for j in range(y // 5000 + 1):
        if n - i - j >= 0 and n - i - j == (y - 10000 * i - 5000 * j) / 1000:
            print(i, j, n - i - j)
            sys.exit()
print(-1, -1, -1)


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

using namespace std;
int main(){
	
	int N;
	long cnt=0;
	cin>>N;
	int L[N],R[N];
	
	for(int i=0;i<N;i++){
		cin>>L[i]>>R[i];
		cnt=R[i]-L[i]+1+cnt;
	}
	
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using  namespace std;
int Nsum(int* X, int size){
  int sumnum=1, num=1, minNum=0, check[size];
  for(int i=0;i<size;i++){
    minNum = 0;
    num = 1;
    for(int j=i+1;j<size;j++){
      if(X[j]<X[i]){
        minNum++;
      }
    }
    for(int k=1;k<size-i;k++){
      num *= k;
    }
    if(minNum!=0){
      sumnum += num * minNum;
    }
  }
  return sumnum;
}

int main(){
  int n, ans;
  cin >> n;
  int P[n], Q[n];
  for(int i=0;i<n;i++){
    cin >> P[i];
  }
  for(int i=0;i<n;i++){
    cin >> Q[i];
  }
  int a, b;
  a = Nsum(P, n);
  b = Nsum(Q, n);
  ans = abs(a-b);
  cout << ans << endl;
  return 0;

}



Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    string s,t; 
    cin>>s>>t;
    int n=sz(s),m=sz(t); 
    for (int i=n-m;i>=0;i--){
        for (int j=i,k=0;j<n;j++,k++){
            if (s[j] != '?') 
                if (s[j] != t[k]) break; 
            if (k==m-1){
                for (k=0;k<m;k++,i++) s[i]=t[k];
                for (int i=0;i<n;i++) if (s[i]=='?') s[i]='a';
                cout << s << endl;
                return;
            }
        }
    }
    cout << "UNRESTORABLE" << endl;
    return;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3620
integer a,b
character(5),allocatable,dimension(:,:)::S
read*,a,b
allocate(S(a,b))
do i=1,a
  read*,S(i,:)
end do
do i=1,a
  do j=1,b
   if(S(i,j)=="snuke")then
     print"(A,i0)",char(ichar("A")-1+j),i
     stop
   endif
  end do
end do
end

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

int main()
{
  while(1){
    int i, j;
    vector<int> judge;
    string S;
    cin >> S;

    if(S == "#") break;

    for(i = 0; i < (int)S.size(); i++){
      if(S[i] == 'o') judge.push_back(0);
      else if(S[i] == 'e') judge.push_back(1);
    }

    int a;
    int sz = judge.size();
    if(judge[sz - 1] == 0) a = 0;
    else a = 90;
    int n = 1;

    for(j = sz - 2; j >= 0; j--){
      if(judge[j] == 0) a = (a * 2) - 90;
      else a = (a * 2) + 90;
      n *= 2;
    }

    int g;
    g = __gcd(a, n);
    a /= g;
    n /= g;

    cout << a;
    if(n != 1) cout << '/' << n;
    cout << endl;
  }

  return 0;

}



Measured memory_bytes: 3112
# Cyclic mod calculation renshuu

# kの倍数 -> N % k == 0 を探索する
# N%k の値は高々 k種類となる。k回のループで十分に網羅できる。
# kは10**6。制約上も問題がない。
k=int(input())
n=7%k
for i in range(1,k+1):
  if n==0:
    print(i)
    exit()
  # 計算量を抑えてmodするため、漸化式のような実装にすることがミソ。
  n=(n*10+7)%k 
print(-1)



Measured memory_bytes: 8932
#include<bits/stdc++.h>
#include<cmath>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
const ll MOD = 1e9+7;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
#define fs first
#define sc second


const int INF = 1e9;
const ll LLINF = 1e16;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
template<typename T>
T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T>
T ngcd(vector<T> a){
    T res;
    res = a[0];
    for(int i = 1; i < a.size() && res != 1; i++) {
        res = gcd(a[i], res);
    }
    return res;
}
 
template<typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

template<typename T>
T nlcm(vector<T> numbers) {
    T res;
    res = numbers[0];
    for (int i = 1; i < numbers.size(); i++) {
        res = lcm(res, numbers[i]);
    }
    return res;
}

// 割り算の切り上げ処理
template<typename T>
T round_up(T a, T b) {
  return (a + b - 1) / b;
}

// 約数列挙
template<typename T>
vector<T> calc_divisor(T n) {
   vector<T> res;
   for (T i = 1LL; i*i <= n; ++i) {
       if (n % i == 0) {
           res.push_back(i);
           T j = n / i;
           if (j != i) res.push_back(j);
       }
   }
   sort(res.begin(), res.end());
   return res;
}

// 素数判定
template<typename T>
bool isPrime(T x){
    T i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


using pint = pair<int, int>;
using pll = pair<ll, ll>;

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



int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    string s;
    cin >> s;
    rep(i, s.size() - 1){
        if(s[i] != s[i + 1]){
            print("Yes");
            return 0;
        }
    }
    print("No");
    
}


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

int main()
{
    int a,b;
    cin >> a >> b;
    int num = (a + b) % 2;
    if (num) {
        cout << (a + b) / 2 + 1 << endl;
    }
    else {
        cout << (a + b) / 2 << endl;
    }
    

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	int k,s,ans=0;
	cin>>k>>s;
	
	for (int i = 0; i <= k; ++i)
	{
		for (int j = 0; j <= k; ++j)
		{
			int z = s - i - j;
			if(z>=0 && z<=k){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int r, d, x;
	cin>>r>>d>>x;
	REP(i, 10){
		x=r*x-d;
		cout<<x<<'\n';
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int X = sc.nextInt();
    int cnt = 0;

    for (int i = 0; i <= A; i++) {
      for (int j = 0; j <= B; j++) {
        for (int k = 0; k <= C; k++) {
          int total = 500 * i + 100 * j + 50 * k;
          cnt = (X == total) ? cnt + 1 : cnt;
        }
      }
    }
    System.out.println(cnt);
  }
}


Measured memory_bytes: 23252
while gets do
  cs = $_.split(',').map(&:to_i)
  ch = Array.new(13){0}
  cs.each{ |i| ch[i-1] += 1 }
  str = ch.join('')
  ch.delete(0)

  case ch.sort
    when [1, 4]
      puts "four card"
    when [2, 3]
      puts "full house"
    when [1,1,1,1,1]
      puts (str =~ /1{5}/ or str =~ /10{8}1{4}/) ? "straight" : "null"
    when [1,1,3]
      puts "three card"
    when [1,2,2]
      puts "two pair"
    when [1,1,1,2]
      puts "one pair"
    else
      puts "null"
  end
end

Measured memory_bytes: 6108
#include <iostream>
using namespace std;
int main() {
    int N, x;
    char a;
    bool Spade[13] = {false}, Heart[13] = {false}, Club[13] = {false}, Diamond[13] = {false};
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> a >> x;
        if (a == 'S') {
            Spade[x - 1] = true;
        } else if (a == 'H') {
            Heart[x - 1] = true;
        } else if (a == 'C') {
            Club[x - 1] = true;
        } else if (a == 'D') {
            Diamond[x - 1] = true;
        }
    }
    for (int i = 0; i < 13; i++) {
        if (!Spade[i]) {
            cout << "S " << i + 1 << '\n'; 
        }
    }
    for (int i = 0; i < 13; i++) {
        if (Heart[i] == false) {
            cout << "H " << i + 1 << '\n'; 
        }
    }
    for (int i = 0; i < 13; i++) {
        if (Club[i] == false) {
            cout << "C " << i + 1 << '\n'; 
        }
    }
    for (int i = 0; i < 13; i++) {
        if (Diamond[i] == false) {
            cout << "D " << i + 1 << '\n'; 
        }
    }
}


Measured memory_bytes: 3072
package main

import (
    "fmt"
)

var n, m int
var ps [][]int
var cnt int

func main() {
    fmt.Scan(&n, &m)
    ps = make([][]int, n)
    for i := 0; i < m; i++ {
        var a, b int
        fmt.Scan(&a, &b)
        ps[a-1] = append(ps[a-1], b-1)
        ps[b-1] = append(ps[b-1], a-1)
    }

    mem := make(map[int]bool)
    search(0, mem)
    fmt.Println(cnt)
}

func search(pos int, mem map[int]bool) {
    mem[pos] = true
    if check(mem) {
        cnt++
        return
    }
    for _, v := range ps[pos] {
        if b, ok := mem[v]; ok && b {
            continue
        }
        search(v, cp(mem))
    }
}

func cp(m map[int]bool) map[int]bool {
    cm := make(map[int]bool)
    for k, v := range m {
        cm[k] = v
    }
    return cm
}

func check(mem map[int]bool) bool {
    var ng bool
    for i := 0; i < n; i++ {
        if b, ok := mem[i]; !ok || !b {
            ng = true
        }
    }
    return !ng
}


Measured memory_bytes: 2944
program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64):: n,d,x,y,d2,i,ans
    integer(int64), allocatable:: dist(:)

    read*, n,d
    allocate(dist(n))

    do i=1,n
        read*, x,y
        dist(i) = x*x + y*y
    end do

    d2 = d*d
    ans = 0
    do i=1,n
        if (dist(i) <= d2) ans=ans+1
    end do
    print'(i0)', ans
end program main

Measured memory_bytes: 4444
import math
N = int(input())
li = list(map(int,input().split()))
#合計
leng=sum(li)
#tasizan
leng2=0
count=0

for i in range(N):
  if leng2<leng/2:
    leng2+=li[i]  
  
  if leng2==leng/2 and leng%2 ==0:  #OK
    print(count)
    break
    
  elif leng2>leng/2:
    if i>0:
      xx = abs(leng/2 - leng2)#leng2がより大きい
      xxx = abs(leng/2 - leng2 + li[i])
      if xx < xxx:#差分が小さいほうを採用
        count = xx/0.5
      else:
        count = xxx/0.5
    elif i==0:
      xx = abs(leng/2 - leng2)#leng2がより大きい
      count = xxx/0.5
    print(int(count))
    break

Measured memory_bytes: 88528
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    ll h;
    int n;
    cin >> h >> n;
    ll sum = 0;
    rep(i,n) {
        ll ai;
        cin >> ai;
        sum += ai;
    }
    if (h<=sum) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}





























Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
    char tmp[10001];
    //?´???°???????????????????????¨????´???°?????\???
    fgets(tmp,sizeof(tmp),stdin);
    int start;
    int end;
    int divisor;
    //??????
    start=atoi(strtok(tmp," "));
    end=atoi(strtok(NULL," "));
    divisor=atoi(strtok(NULL,"\n"));
    //?´???°?????°????¨????
    int cnt;
    while(1){
        if(start>end)break;
        if(divisor%start==0)cnt++;
        start++;
    }
    printf("%d\n",cnt);
return 0;
}

Measured memory_bytes: 536
#include<stdio.h>
int prime[1000001];
int sum[1000002];
int main(){
  int right, i,k,ans;
  sum[0] = 0;
  for(i = 2; i <= 1000000; i++){
    prime[i] = 1;
  }
  for(i = 2; i*i <= 1000000; i++){
    if(prime[i]){
      for(k = 2 * i; k <= 1000000; k += i){
        prime[k] = 0;
      }
    }
  }
  for(i = 2; i <= 1000000; i++){
    sum[i+1] = sum[i] + prime[i];
  }
  while(scanf("%d",&right) != EOF){
     ans = sum[right+1];
     printf("%d\n",ans);
  }  
  return 0;
}

Measured memory_bytes: 8408
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int N; cin >> N;
    vector<int> a(N, 0);
    for (int i = 0; i < N; ++i) cin >> a[i];
    int cnt = 0, tmp = 10e7;
    for (int i = 1; i < N; ++i) {
        if (a[i] == a[i - 1]) {
            cnt++; a[i] = tmp; tmp--;
        }
    }
    printf("%d\n", cnt);
}


Measured memory_bytes: 3692
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <functional>
#define SIZE 500005
#define MOD 1000000007

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

int A[SIZE];
vector <int> pos[SIZE];
int rt[SIZE];

int get(int s,int t)
{
	if(s>t) return 0;
	return rt[t]-(s>0?rt[s-1]:0);
}
int main()
{
	int n;
	scanf("%d",&n);
	vector <int> vx;
	int now=0;
	for(int i=0;i<n;i++)
	{
		int x;
		scanf("%d",&x);
		now^=x;
		A[i]=now;
		vx.push_back(A[i]);
	}
	vx.push_back(0);
	sort(vx.begin(),vx.end());
	vx.erase(unique(vx.begin(),vx.end()),vx.end());
	for(int i=0;i<n;i++)
	{
		A[i]=lower_bound(vx.begin(),vx.end(),A[i])-vx.begin();
		pos[A[i]].push_back(i);
		rt[i]=(A[i]==0);
		if(i>0) rt[i]+=rt[i-1];
	}
	//for(int i=0;i<n;i++) printf("%d ",A[i]);puts("");
	ll ret=0;
	if(A[n-1]==0)//all 0
	{
		int cnt=pos[0].size()-1;
		ret=1;
		for(int i=0;i<cnt;i++) ret=ret*2LL%MOD;
	}
	for(int i=1;i<vx.size();i++)
	{
		if(A[n-1]!=0&&A[n-1]!=i) continue;
		ll odd=0,even=1;
		int bef=0;
		for(int j=0;j<pos[i].size();j++)
		{
			int to=pos[i][j];
			even+=odd*(ll) get(bef,to-1)%MOD;
			if(even>=MOD) even-=MOD;
			odd+=even;
			if(odd>=MOD) odd-=MOD;
			bef=to+1;
		}
		//printf("%lld %lld\n",odd,even);
		if(A[n-1]==0)
		{
			ret+=odd;
			ret%=MOD;
		}
		else
		{
			ret+=even;
			ret%=MOD;
		}
	}
	printf("%lld\n",ret);
	return 0;
}


Measured memory_bytes: 27376
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int N = 1e5+10;

int main(){
    string s;
    int n,t,f;
    deque<char> hd,ta;
    int rev = 0;
    cin >> s;
    cin >> n;
    char ch;
    while(n--){
        cin >> t;
        if(t == 1){
            rev ^= 1;
        }else{
            cin >> f >> ch;
            if(f == 1){
                if(!rev){
                    hd.push_front(ch);
                }else{
                    ta.push_back(ch);
                }
            }else{
                if(!rev){
                    ta.push_back(ch);
                }else{
                    hd.push_front(ch);
                }
            }
        }
    }
    if(!rev){
        for(char c:hd){
            cout << c;
        }
        cout << s;
        for(char c:ta){
            cout << c;
        }
        cout <<'\n';
    }else{
        for(auto i=ta.rbegin();i!=ta.rend();++i){
            cout << *i;
        }
        reverse(s.begin(),s.end());
        cout << s;
        for(auto i=hd.rbegin();i!=hd.rend();++i){
            cout <<*i;
        }
        cout <<'\n';
    }




    return 0;
}

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

using i64 = long long;

const int N = 1e5 + 5;

i64 n, a, b, c, d;

int main() {
#ifdef HOME
	freopen("agc17b.in", "r", stdin);
	freopen("agc17b.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);

	cin >> n >> a >> b >> c >> d; n-= 1;
	for (int i = 0; i <= n; ++i)
		if (i * c - (n - i) * d <= b - a && b - a <= i * d - (n - i) * c) {
			cout << "YES\n";
			return 0; }
	cout << "NO\n";

	return 0; }


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String N = sc.next();
        int tmp = 0;
        for(int i=N.length()-1; i>=0; i--) {
            int t = (N.charAt(i) - '0');
            tmp+=t;
        }
        System.out.println(tmp % 9 == 0 ? "Yes" : "No");
    }
}


Measured memory_bytes: 40240
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vstr> vvstr;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    yn(b - a == c - b);
    return 0;
}

Measured memory_bytes: 256