akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  ll i,j,A,B,C;
  cin>>A>>B>>C;
  if(A+B>=C)printyes;
  else printno;
  return 0;
}

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

int main()
{
    string n;
    cin >> n;
    if (n.at(0) == '7' || n.at(1) == '7' || n.at(2) == '7')
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3616
#!python3

import sys
from math import sqrt

sys.setrecursionlimit(1000000)

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = int(input())
    P = [list(iim()) for i in range(N)]

    def dist(i, j):
        x = P[i][0] - P[j][0]
        y = P[i][1] - P[j][1]
        return sqrt(x*x + y*y)

    def tsp(i, j, k):
        if i == 0 and j == 0:
            return dist(0, 1) + tsp(0, 1, 0)
        else:
            if dp[i][j]: return dp[i][j]
            if k == N: return dist(i, j)
            d1 = dist(i, k) + tsp(k, j, k + 1)
            d2 = dist(j, k) + tsp(i, k, k + 1)
            d = d1 if d1 < d2 else d2
            dp[i][j] = d
            return d

    dp = [[0]*N for i in range(N)]
    print(tsp(0,0,0))


if __name__ == "__main__":
    resolve()



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

#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...) void()
#endif

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  unordered_map<int, int> mp;
  for (int i = 0, a; i < n; i++) {
    cin >> a;
    mp[a]++;
  }
  int ans = 0;
  for (auto&& [i, cnt] : mp) {
    if (cnt < i) {
      ans += cnt;
    } else {
      ans += cnt - i;
    }
  }
  cout << ans << '\n';
  return 0;
}

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

using namespace std;

int main()
{
    int a,b;
    char op;
    for(int i=0;i<99999;i++)
    {
        cin >> a >> op >> b;
        if(op=='+')
        {
            cout << a+b << endl;
        }
        else if(op=='-')
        {
            cout << a-b << endl;
        }
        else if(op=='*')
        {
            cout << a*b << endl;
        }
        else if(op=='/')
        {
            cout << a/b << endl;
        }
        else if(op=='?')
        {
            return(0);
        }
    }
    

}


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

int main()
{
  float r;
  cin >> r;
  cout << (float)2.000000000 * r * (float)3.14159265358979 << endl;
  return 0;
}


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

int main() {
    ll N; cin >> N;
    vector<pair<ll, ll>> v(N);
    for (ll i = 0; i < N; ++i) {
        ll a, b; cin >> a >> b;
        v[i] = {a, b};
    }
    sort(v.begin(), v.end(), [](auto x, auto y){ return x.first + x.second > y.first + y.second; });
    ll ans = 0;
    for (ll i = 0; i < N; ++i) {
        const auto &[a, b] = v[i];
        if (i % 2 == 0) ans += a;
        else ans -= b;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4844
#include <algorithm>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

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

	int cnt = 0;
	for (int i = 0; i < s.length(); ++i)
	{
		if (s[i] != t[i])
		{
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3868
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main()
{
    string s; cin >> s;
    string t; cin >> t;
    cout << t+s << endl;    
}

/*
Ctrl+@ でコンソールを開け、以下で実行。
g++ b.cpp
./a.out
*/

Measured memory_bytes: 256
h = int(input())
new_h = h
pow_num = 0
ans = 0
attack = 1
preattack = 1

if h == 1:
  print("1")
  exit()
while(1):
  new_h = new_h//2
  pow_num += 1
  if new_h == 1:
    break
for i in range(pow_num):
  preattack = preattack*2
  attack += preattack
print(attack)

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

int dfs(int idx, int rem, int res){
  if(rem == 0 && res == 0){
    return 1;
  }
  if(idx < 0 || rem < 0 || res < 0){
    return 0;
  }
  return dfs(idx-1, rem-1, res-idx) + dfs(idx-1, rem, res);
}

int main(){
  int n, s;
  while(true){
    cin >> n >> s;
    if(n == 0 && s == 0){
      break;
    }
    cout << dfs(9, n, s) << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] data = Console.ReadLine()
                .Split(' ')
                .Select(x => int.Parse(x))
                .ToArray();
            int r = data[0];
            int c = data[1];
            int[,] cell = new int[r + 1, c + 1];

            for (int i = 0; i < r; i++)
            {
                string line = Console.ReadLine();
                int[] row = line
                    .Split(' ')
                    .Select(x => int.Parse(x))
                    .ToArray();
                for (int j = 0; j < c; j++)
                {
                    cell[i, j]  = row[j];
                    cell[r, j] += row[j];
                    cell[i, c] += row[j];
                }
            }

            for(int j = 0; j < c; j++)
            {
                cell[r, c] += cell[r, j];
            }

            for (int i = 0; i < r + 1; i++)
            {
                StringBuilder output = new StringBuilder();
                for (int j = 0; j < c + 1; j++)
                {
                    output.Append(cell[i, j] + " ");
                }
                Console.WriteLine(output.ToString().Trim());
            }
        }
    }
}

Measured memory_bytes: 9780
//077 B - Around Square 2017/11/04
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

int main(){
    int n; cin >> n;
    uint64 x = (uint64)sqrt(n);
    cout << x * x << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
cin = [0, 0, 0, 0, 0, 0, 0, 0]
kin = 0
pin = 0
flag = 0
for i in A:
    if i < 3200:
        cin[i//400] += 1
        pin = 1
    else:
        kin += 1
        flag = 1
if pin == 0:
    print(1, kin)
else:
    print(8-cin.count(0), 8-cin.count(0)+kin)

Measured memory_bytes: 9112
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111


	void solve(){

		
		ini(n);
		ins(morty);
		int dp[31000];
		int rick = 0;
		FOR(i,1,n){
			ZERO(dp);
			FOR(i1,0,n-i){
				if(i1!=0)dp[i1]+=dp[i1-1];
				if(morty[i1] != morty[i1+i])dp[i1] = 0;
				else {
					dp[i1] = min(dp[i1]+1,i);
					rick = max(rick,dp[i1]);
				}
			}
		}
		out(rick);















	}









































int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}

Measured memory_bytes: 640
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

func Solve() {
  var N int
  var A []int
  NextInt(&N)
  NextIntVec(&A)
  U := make([]int, N + 2)
  U[0] = 1
  B := true
  for i := range A {
    if U[i] == 0 || U[i] < A[i] { B = false }
    U[i + 1] = MinInt((U[i] - A[i]) * 2, 1 << 50)
  }
  D := make([]int, N + 1)
  for d := N; 0 <= d; d-- {
    D[d] += A[d]
    if U[d] < D[d] { B = false }
    if d == 0 { break }
    D[d - 1] = MaxInt(MinInt(D[d], U[d] / 2), Ceil(D[d], 2))
  }
  if B {
    Write(SumInt(D...))
  } else {
    Write(-1)
  }
}

func main() {
  Solve()
  Output()
}

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}
func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}
func Ceil(x, y int) int {
  a := x / y
  if x % y > 0 { a++ }
  return a
}

Measured memory_bytes: 8600
#include <iostream>
#include <set>
#include <vector>
#include <limits.h>

using namespace std;

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

	vector<int> v = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101};
	set<int> s(v.begin(), v.end());

	//标注位置
	int data;
	for (int i=0; i<n; i++) {
		cin>>data;
		s.erase(data);
	}

	//二分查找
	set<int>::iterator it = s.lower_bound(x);
	int abs1 = abs(*it - x);
	int abs2 = INT_MAX;
	if (it != s.begin()) {
		it--;
		abs2 = abs(*it - x);
	}

	cout << (abs1<abs2 ? x+abs1 : x-abs2) << endl;

	return 0;
}

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

int main(){
  int N, M;
  cin >> N >> M;
  int graph[M][2];
  for(int i=0; i<M; i++){
    int a, b;
    cin >> a >> b;
    graph[i][0]=a;
    graph[i][1]=b;
  }
  vector<int> v(N);
  iota(v.begin(),v.end(),1);
  int ans=0;
  do{
    if(v.at(0)!=1) continue;
    int cnt=0;
    for(int i=0; i<N-1; i++){
      for(int j=0; j<M; j++){
        if(graph[j][0]==v.at(i) && graph[j][1]==v.at(i+1) || graph[j][0]==v.at(i+1) && graph[j][1]==v.at(i)) cnt++;
      }
    }
    if(cnt==N-1) ans++;
  }while(next_permutation(v.begin(), v.end()));
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
int main(){
  //N=Sn(-2)^n+…+S0(-2)^0の形で考えている.
  ll N; cin >> N;
  string ans = "";
  if(N == 0)ans = "0";
  else{
    while(N != 0){
      if(N % 2 != 0){
        ans = "1" + ans;//最下位の桁は1になる.
        N--;//最下位の桁を左辺に移行して,2の倍数にしておく.
      }
      else{
        ans = "0" + ans;
      }

      N /= -2;
    }
  }

  cout << ans << endl;
}


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

int main() {
    std::string S;
    std::cin >> S;

    std::string ret = "Good";
    for (std::size_t i = 0; i < S.size() - 1; ++i) {
        if (S[i] == S[i + 1]) {
            ret = "Bad";
            break;
        }
    }

    std::cout << ret << std::endl;
}


Measured memory_bytes: 256
def main():
    n, p = map(int, input().split())
    s = list(map(int, list(input())))
    now = 1
    now2 = 0

    dp = [0]*p
    cnt = 0
    if p != 5:
        for i in s:
            now2 = (now2*10+i) % p
            dp[((i-now2) % p)*pow(now, p-2, p) % p] += 1
            cnt += dp[((-now2) % p)*pow(now, p-2, p) % p]
            now = (now*10) % p
    else:
        for j, i in enumerate(s):
            if i in [0, 5]:
                cnt += j+1
    print(cnt)


main()


Measured memory_bytes: 6564
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define repi(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,a) repi(i,0,a)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define repit(i,a) for(__typeof((a).begin()) i=(a).begin();i!=(a).end();i++)

#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())

#define pb push_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;

typedef complex<double> point;

int N, D;

point solve()
{
    point x(0.0, 0.0);
    double t = 0.0;
    rep(i,N) {
	double ls, rs, time;
	cin >> ls >> rs >> time;
	time *= PI / 180;
	if (ls == rs) {
	    x += polar(time * ls, t + PI / 2);
	} else {
	    point dx = polar((double) D, t);
	    point l = x - dx;
	    point r = x + dx;
	    if (ls == 0) {
		t += time * rs / D / 2;
		x = l + polar((double) D, t);
	    } else if (rs == 0) {
		t -= time * ls / D / 2;
		x = r - polar((double) D, t);
	    } else {
		point o = (ls * r - rs * l) / (ls - rs);
		double dt = time * rs / abs(r - o);
		if ((ls < rs && rs < 0) || (0 < rs && rs < ls))
		    dt = -dt;
		x = o + polar(abs(x - o), arg(x - o) + dt);
		t += dt;
	    }
	}
    }
    return x;
}

int main()
{
    while (cin >> N >> D && N) {
	point ans = solve();
	printf("%.5f\n%.5f\n", ans.real(), ans.imag());
    }
    
    return 0;
}

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

int main() {
  while (true) {
      int x, y;
      cin >> x >> y;
      if (x == 0 && y == 0) {
          break;
      }
      else {
          cout << min(x, y) << " " << max(x, y) << endl;
      }
  }
}




Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
class Range {
    using T = long long;
    class Iterator {
        T val, step, diff;
    public:
        Iterator(T v, T s, T d): val(v), step(s), diff(d) {}
        T operator*() { return val + diff; }
        bool operator!=(const Iterator &itr) { return step > 0 ? val < itr.val : val > itr.val; }
        Iterator operator++() { val += step; return *this; }
    };
    Iterator _begin, _end;
public:
    Range(T b, T e, T s, T d): _begin(b, s, d), _end(e, s, d) {
        if (s < 0) { _begin = Iterator(e - 1, s, d); _end = Iterator(b - 1, s, d); }
    }
    Range(T b, T e, T s): Range(b, e, s, 0) {}
    Range(T b, T e): Range(b, e, 1, 0) {}
    Range(T e): Range(0, e, 1, 0) {}
    Iterator begin() { return _begin; }
    Iterator end() { return _end; }
};
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k;
    cin, n, k;
    vector<int> cnt(n, 0);
    for (ll i : Range(k)) {
        int d;
        cin, d;
        for (ll a : Range(d)) {
            int t;
            cin, t;
            cnt[t - 1]++;
        }
    }
    int ans = 0;
    for (ll i : Range(n)) {
        ans += (cnt[i] == 0);
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 3664
#include<iostream>
#include<queue>
#include<cstdio>
using namespace std;
const int INF=1000000;
int d[1005][1005];
int dx[4]= {1,0,-1,0};
int dy[4]= {0,1,0,-1};
char s[1005][1005];
int m,n,k;
//int sx,sy,gx,gy;
typedef pair <int,int >P;
P aim[15];
int isd(char ch)
{
    return ch>='0'&&ch<='9'?1:0;
}
int bfs(int sx,int sy,int gx,int gy)
{
    queue<P> que;
    for(int i=0; i<m; i++)
    {
        for(int j=0; j<n; j++)
        {
            d[i][j]=INF;
//            cout <<d[i][j]<<endl;
        }
    }
    que.push(P(sx,sy));
    d[sx][sy]=0;
    while(que.size())
    {

        P p=que.front();
        que.pop();
        if(p.first==gx&&p.second==gy)
        {
            break;
        }
        for(int i=0; i<4; i++)
        {
            int nx=p.first+dx[i];
            int ny=p.second+dy[i];
//            cout << nx << ":" << ny << endl;
//            cout << que.size()<<" "<<m<<" "<<n<<endl;
            if( nx>=0&&nx<m
                    &&ny>=0&&ny<n
                    &&s[nx][ny]!='X'
                    &&d[nx][ny]==INF)
            {

                que.push(P(nx,ny));

                d[nx][ny]=d[p.first][p.second]+1;
            }
        }
    }
    return d[gx][gy];
}
int main()
{
    cin >> m >> n >> k;
    int sum = 0;
    for(int i=0; i<m; i++)
    {
        for(int j=0; j<n; j++)
        {
            cin >> s[i][j];
            if(s[i][j]=='S')
            {
                aim[0].first=i;
                aim[0].second=j;
//                cout << i <<" "<< j <<endl;
            }
            if(isd(s[i][j]))
            {
                aim[s[i][j]-'0'].first=i;
                aim[s[i][j]-'0'].second=j;
//                cout << i << " "<<j <<endl;
            }

        }


    }
    for(int i=0; i<k; i++)
    {
        int steep=bfs(aim[i].first,aim[i].second,aim[i+1].first,aim[i+1].second);
        sum+=steep;
//            cout << steep <<endl;
    }
    cout << sum <<endl ;
}

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

typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) (in),(in)+(K)

#define INF 1e18
#define MOD 1000000007
#define SIZE 10005
#define PI 	3.14159265358979323846

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a, b)*b; } //最小公倍数

ll input(){
  ll a;
  cin >> a;
  return a;
}

vi sub(vector<bool> fin,ll n) {
  vi ret;
  REP(i,n) {
    if(fin.at(i))continue;
    vector<bool> cp = fin;
    cp.at(i) = true;
    vi result = sub(cp,n);
    ret.insert(ret.end(),result.begin(),result.end());
  }
  return ret;
}

int main() {
  ll n,k;
  cin >> n >> k;
  vi a(n);
  REP(i,n) cin >> a.at(i);
  sort(a.begin(),a.end());
  ll ans=0;
  REP(i,n-k)ans+=a.at(i);
  cout << ans << endl;
}


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

int n, mx, ans, A[200001];
string a, b, c;
int main() {
	cin >> n >> a >> b >> c;
	rep(i, n) {
		A['z' - a[i]]++;
		A['z' - b[i]]++;
		A['z' - c[i]]++;
		rep(i, 27) { mx = max(mx, A[i]); };
		ans += 3 - mx;
		mx = 0;
		fill(A, A + 27, 0);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}


int main(void) {
  ll N, K;
  cin >> N >> K;
  
  
  if(K==1) {
    pt(0);
  }else {
    pt(N-K);
  }
  
  
}
  
  
  
  
  
  
  
  
  
  


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < (i##_MACRO); i++)
#define RANGE(i, a, b) for(int i = (a); i < (b); i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), ((a) + (n))
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define MODNUM (static_cast<int>(1e9 + 7))
#define MOD(x) ((x) % MODNUM)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

const int INF = 2e9;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	char s[4];
	scanf("%s", s);
	if(s[0] == 'S') {
		if(s[1] == 'U') {
			puts("7");
		} else {
			puts("1");
		}
	} else if(s[0] == 'M') {
		puts("6");
	} else if(s[0] == 'T') {
		if(s[1] == 'U') {
			puts("5");
		} else {
			puts("3");
		}
	} else if(s[0] == 'W') {
		puts("4");
	} else {
		puts("2");
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int64_t f(int64_t b, int64_t n) {
    if(n < b) {
        return n;
    } else {
        return f(b, n/b) + n%b;
    }
}
 
int main(void) {
    int64_t n, s;
    cin >> n >> s;
 
    int64_t ans = numeric_limits<int64_t>::max();
    for(int64_t b=2; b*b<=n; b++) {
        if(f(b, n) == s) {
            ans = min(ans, b);
        }
    }
 
    if(n == s) {
        ans = min(ans, n+1);
    }
 
    for(int64_t i=1; i*i<=n; i++) {
        int64_t j = s - i;
        if((n-j) % i == 0) {
            int64_t b = (n-j) / i;
            if(b < 2) continue;
            if(i >= b || j >= b || j < 0) continue;
            ans = min(ans, b);
        }
    }
 
    if(ans == numeric_limits<int64_t>::max()) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3648
#!/usr/bin/env python3

from copy import deepcopy

def main():
    n, a, b = map(int, input().split())
    v = list(map(int, input().split()))
    dp = [[0, 0] for i in range(n + 1)]
    dp[0] = [0, 1]
    for j in range(n):
        dppre = deepcopy(dp)
        for i in range(n):  # 配る
            vnew = dppre[i][0] + v[j]
            ways = dppre[i][1]
            if vnew > dp[i + 1][0]:
                dp[i + 1] = [vnew, ways]
            elif vnew == dp[i + 1][0]:
                dp[i + 1][1] += ways

    maxave = 0.0
    for i in range(a, b + 1):
        maxave = max(maxave, dp[i][0] / i)
    ways = 0
    for i in range(a, b + 1):
        if dp[i][0] / i == maxave:
            ways += dp[i][1]
    print(maxave)
    print(ways)

if __name__ == "__main__":
    main()


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

#define mod 1000000007
#define ll long long
#define ld long double
typedef vector< long long > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define pii pair<int,int>
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(x) x.begin(),x.end()
#define fill(a,b) memset(a,b,sizeof(a))
#define sp(x) setprecision(x)
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container),element) != container.end())
#define deb(x) cout<<#x <<x <<endl
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
        ll n,m;
        cin>>n>>m;
        ll a[n+1];
        rep(i,n)
        cin>>a[i+1];
        vi v[n+1];
        ll x,y;
        while(m--){
        	cin>>x>>y;
        	v[x].push_back(y);
        	v[y].push_back(x);
        }
        ll count=0,flag;
        for(int i=1;i<=n;i++){
        	flag=0;
        	for(int j=0;j<v[i].size();j++){
        		if(a[i]<=a[v[i][j]]){
        			flag=1;
        			break;
        		}
        	}
        	if(flag==0)
        		count++;
        }
        cout <<  count<< '\n';

        

}


Measured memory_bytes: 10268
#include <cstdio>

int main(){
    int H,W;
    while(true){
        scanf("%d %d",&H,&W);
        if(H == 0 && W == 0) break;
        for(int i = 0;i < H;i++){
            for(int j = 0;j < W;j++){
                if(i == 0 || i == H - 1 || j == 0 || j == W - 1){
                printf("#");}
                else printf(".");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2544
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n;
    while(cin>>n, n>=0){
        string hoge;
        int yebi=n;
        while(1){
            string t=to_string(yebi%4);
            hoge.push_back(t[0]);
            if(!(yebi/4))break;
            yebi/=4;
        }
        reverse(all(hoge));
        cout<<hoge<<endl;
    }
}

Measured memory_bytes: 3104
#include <stdio.h>
#include <algorithm>
#include <tuple>
using namespace std;
int n, ret, res, ptr; tuple<int, int, int> d[100000];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d%d%d", &get<0>(d[i]), &get<1>(d[i]), &get<2>(d[i]));
	sort(d, d + n);
	for (int i = 0; i < n; i++) {
		res = get<2>(d[i]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]), get<1>(d[i]) + 2, 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) && get<1>(d[ptr]) == get<1>(d[i]) + 1) res += get<2>(d[ptr]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]) + 1, get<1>(d[i]) + 1, 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i])) res += get<2>(d[ptr]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]) + 1, get<1>(d[i]) + 2, 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i]) + 1) res += get<2>(d[ptr]);
		ret = max(res, ret);
		res = get<2>(d[i]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]), get<1>(d[i]), 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) && get<1>(d[ptr]) == get<1>(d[i]) - 1) res += get<2>(d[ptr]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]) + 1, get<1>(d[i]) + 1, 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i])) res += get<2>(d[ptr]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]) + 1, get<1>(d[i]), 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i]) - 1) res += get<2>(d[ptr]);
		ret = max(res, ret);
	}
	printf("%d / 1\n", ret);
	return 0;
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

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;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    int n,ans=0;
    cin>>n;
    Vi a(n);
    REP(i,0,n) cin>>a[i];
    multiset<int> se;
    REP(i,0,n) se.insert(a[i]);
    
    while(!se.empty()){
        auto itr=se.rbegin();
        int M=*itr;
        int s=1;
        while(s<=M) s*=2;
        se.erase(se.find(M));
        if(se.count(s-M)){
            se.erase(se.find(s-M));
            ans++;
        }
    }
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#else
#define eprintf(...) 42
#endif
#define y0 y12345
#define y1 y54321
typedef unsigned long ul;
typedef long long ll;
//typedef pair<int, int> mpair;
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(a>b){a=b;return 1;}return 0;}
using namespace std;

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	int n,m;
	   cin>>n>>m;
	   if(n >= m){
		   cout << 10 << endl;
	   }else{
		   cout << 0 << endl;
	   }
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

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

    vector<int> g[55];
    rep(i,m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].emplace_back(b);
        g[b].emplace_back(a);
    }
   rep(i,n){
       cout << g[i].size() << endl;
   }
}


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

string x[4] = {"dream", "dreamer", "erase", "eraser"};
string s;

bool dfs(int n) {
    if(n == s.size()) return true;

    for(string i : x) {
        if(s.substr(n, i.size()) != i) continue;

        if(dfs(n + i.size())) return true;
    }
    return false;
}

int main() {
    cin >> s;

    cout << (dfs(0) ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 2048
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{

    internal class Solution
    {
        public int N, A, B;

        public void Run()
        {
            var line = Input.ReadIntArray();
            N = line[0];
            A = line[1];
            B = line[2];
                
            long ret = 0;
            for (int i = 1; i <= N; i++)
            {
                int d = 0;
                int x = i;
                while (x > 0)
                {
                    d += x % 10;
                    x /= 10;
                }

                if (A <= d && d <= B) ret += i;
            }

            Console.WriteLine(ret);
        }

    }

    internal static class Input
    {
        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13396
#include<iostream>
#include<iomanip>
#include<sstream>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<numeric>

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define np string::npos
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define repc(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto n :(array))

typedef long long ll ;
typedef vector<int> vi ;
typedef vector<ll> vl ;
typedef map<string,int> dict;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
double eps = 1e-10 ;

template <typename T>
void out(vector < T > v)
{
  for(size_t i = 0; i < v.size(); i++)
  {
    debug(v[i]);
  }
}

template<typename T>
string ntos( T i ) {
  ostringstream s ;
  s << i ;
  return s.str() ;
}

template<typename T>
T ston(string str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void call(int n){
  repc(i,1,n+1){
    int x = i;
    if(x % 3 == 0){
      cout << " " << i;
    }
    else{
      while(x){
        if(x % 10 == 3){
          cout << " " << i ;
          break;
        }
        x /= 10;
      }
    }
  }
  cout << endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  call(n);
  return 0;
}

Measured memory_bytes: 3136
def cin():
	return map(int,input().split())

def cino(test=False):
    if not test:
        return int(input())
    else:
        return input()
def cina():
  return list(map(int,input().split()))


a,b,c  = cin()
p = -1
q = 1e9
r = -1
s = 1e9
for i in range(c):
  x,y,z = cin()
  if z==1:
    p = max(x,p)
  elif z==2:
    q = min(x,q)
  elif z==3:
    r = max(r,y)
  else:
    s = min(s,y)

if p==-1:
    p = 0
if q==1e9:
    q = a
if r==-1:
    r=0
if s==1e9:
    s=b

ans = (q-p)*(s-r)
if p>q or r>s:
    print(0)
else:
    print(ans)



Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#define ll  long long
#define ull unsigned long long
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define main() int main()
#define ff1(i,n) for(int i=1;i<=n;++i)
#define ff0(i,n) for(int i=0;i<n;++i)
#define pi acos(-1.0)
#define ms(a, x) memset(a, x, sizeof(a))
#define lowbit(x) ((x)&(-(x)))
#define pb push_back
#define binarycount __builtin_popcount(x)
#define tr t[root]
#define lson t[root << 1]
#define rson t[root << 1 | 1]
#define fir first
#define sec second
#define debug(x) cout<<x<<'\n'
#define sa(a) scanf("%d", &a)
#define sab(a, b) scanf("%d%d", &a, &b)
#define pa(a) printf("%d",a)
#define pab(a,b) printf("%d%d",a,b)
#define pii pair<int,int>
using namespace std;

#define maxn 10000005
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-8;
ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}
ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}
ll powmod(ll a,ll b){
    ll ans = 1, pow = a%mod;
    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }
    return ans%mod;
}
map<int,int> mp;
main(){
	IO;
	ll ans=0,x,y;
	cin>>x;
	y=100;
	while(y<x){
		y=y+y*0.01;
		ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3636
n,m= map(int,input().split())
check=[-1]*n
for i in range(m):
    s,c=map(int,input().split())
    s-=1
    if(check[s]!=-1 and check[s]!=c):
        print(-1)
        exit()
    check[s]=c
#print(check)
if(check[0]==0):
    if(n==1):
      print(0)
    else:
      print(-1)
    exit()
elif(check[0]==-1):
    check[0]=1
    if(n==1):
      check[0]=0
    

for i in range(n):
    if(check[i]==-1):
        check[i]=0
    print(check[i],end="")

    


Measured memory_bytes: 3064
import sys
n = int(input())
b_ls = [int(i) for i in sys.stdin.readline().split()]
a_ls = [0 for i in range(n)]
a_ls[-1] = b_ls[-1]
for i in range(n-2,-1,-1):
    if i == 0:
        a_ls[0] = b_ls[0]
    else:
        a_ls[i] = min(b_ls[i], b_ls[i-1])
print(sum(a_ls))

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

int main() {
    int n;
    std::cin >> n;
    std::vector<int> p(n);
    for (int i = 0; i < n; i++) {
        std::cin >> p[i];
    }
    int max = 0;
    int sum = 0;
    for (auto pi : p) {
        max = std::max(max, pi);
        sum += pi;
    }
    std::cout << sum - max / 2 << std::endl;
}

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

int main() {
  string s;
  getline(cin,s);
  for(int a = 0; a < s.length(); ++a) {
    if(islower(s[a])) {
      s[a] = toupper(s[a]);
    }else if(isupper(s[a])) {
      s[a] = tolower(s[a]);
    }
  }

  cout << s << endl;

  return 0;
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10;
int main() {
  int X;
  cin >> X;
  vector<bool> primes(MAX, true);
  primes[0] = false;
  primes[1] = false;
  for (int i = 2; i < MAX; ++i) {
    if (!primes[i]) {
      continue;
    }
    for (int k = 2; i * k < MAX; ++k) {
      primes[i * k] = false;
    }
  }
  vector<int> table;
  for (int i = 2; i < MAX; ++i) {
    if (primes[i]) {
      table.push_back(i);
    }
  }
  auto it = lower_bound(table.begin(), table.end(), X);
  cout << *it << endl;
  return 0;
}
  
  

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    string str;
    int ma,co=0;
    while(cin>>str){
        for(int i=0;;i++){
            if(str[i]=='\0'){
               ma=i;
               break;
            }
        }
        if(ma==1)co++;
        for(int i=0;i<ma/2;i++){
            if(str[i]!=str[ma-(i+1)])break;
            if(i==ma/2-1)co++;
        }
       // cout<<co<<endl;
    }
    cout<<co<<endl;
}

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

using namespace std;

typedef long long ll;

#define newline cout<<"\n"
#define deb(x) cout<<#x<<" "<<x<<endl;

template<typename... T>
void read(T&... args){
    ((cin>>args), ...);
}

template<typename... T>
void write(T... args){
    ((cout<<args<<" "), ...);
}

void printarr(vector<int> &v){
    for(int x: v){
        cout<<x<<" ";
    }
    newline;
}

const int MOD = 1e9+7;
const int nax = 1e7+7;

int dig_sum(int n){
    int ans = 0;
    while(n>0){
        ans += n%10;
        n/=10;
    }
    return ans;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    
    int n; cin>>n;

    int ds = dig_sum(n);

    if(n%ds==0){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
    
    return 0;
}

Measured memory_bytes: 3612
#include <stdio.h>

int main(void) {
	
	int i, j;
	
	for (i = 1; i <= 9; i++) {
		for (j = 1; j <= 9; j++) {
			printf("%dx%d=%d\n",i,j,i*j);
		}
	}

	return 0;
}

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

int main() {

  long long int in, v0, v1;
  char c;
  while( cin >> in >> c ) {
    long long int d[10];
    d[0] = in;
    for ( int i = 1; i < 10; i++ ) {
      cin >> in >> c;
      d[i] = d[i-1] + in;
    }
    cin >> v0 >> c >> v1;
    double f = 1.00 * v0 * d[9] / ( v0 + v1 );
    for ( int i = 0; i < 10; i++ ) {
      if ( f <= d[i] ) {
	cout << i + 1 << endl;
	break;
      }
    }
  }

  return 0;

}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n;
    cin >> n;
    setint s;
    rep(i, n)
    {
        int d;
        cin >> d;
        s.insert(d);
    }
    cout << s.size() << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    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;

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

  ll ans = n * (n - 1) / 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256