akhauriyash/Code-Regression huggingface dataset:
n = int(input())

ans = []
i = 1

while True:
    """CHECK_NUM"""
    x = i
    if x % 3 == 0:
        ans.append(str(i))
    else:
        while True:
            """INCLUDE3"""
            if x % 10 == 3:
                ans.append(str(i))
                break

            x = int(x / 10)
            
            if x != 0: 
                continue
            else: 
                break
    i += 1
    if i <= n:
        continue
    else:
        break

print(" " + " ".join(ans))



Measured memory_bytes: 5932
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
#include <list>
using namespace std;
static const double EPS = 1e-8;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int(a.size()))
#define F first
#define S second
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};

int X,Y,tx,ty,kx,ky;
int wall[50][50];
bool vis[50][50][50][50];

typedef struct _node{
  int cost,tx,ty,kx,ky;
  int geth()const{
    return (abs(tx-kx)+abs(ty-ky))/2;
  }
  bool operator<(const _node& r)const{
    return cost+geth()>r.cost+r.geth();
  }
  _node (int c,int atx,int aty,int akx,int aky){
    cost=c;
    tx=atx;
    ty=aty;
    kx=akx;
    ky=aky;
  }
}node;

void solve(){
  scanf("%d%d%d%d",&tx,&ty,&kx,&ky);
  --tx,--ty,--kx,--ky;
  rep(i,Y)rep(j,X)scanf("%d",wall[i]+j);
  
  priority_queue<node>q;
  q.push(node(0,tx,ty,kx,ky));
  memset(vis,0,sizeof(vis));
  while(!q.empty()){
    int cc=q.top().cost;
    tx=q.top().tx;
    ty=q.top().ty;
    kx=q.top().kx;
    ky=q.top().ky;
    int h=q.top().geth();
    q.pop();
    if(cc+h>=100 || vis[tx][ty][kx][ky])continue;
    vis[tx][ty][kx][ky]=true;
    if(tx==kx && ty==ky){
      printf("%d\n",cc);
      return;
    }
    rep(i,4){
      int ntx=tx+dx[i],nty=ty+dy[i];
      int nkx=kx-dx[i],nky=ky-dy[i];

      if(0>ntx || ntx>=X ||
         0>nty || nty>=Y ||
         wall[nty][ntx])ntx=tx,nty=ty;
      if(0>nkx || nkx>=X ||
         0>nky || nky>=Y ||
         wall[nky][nkx])nkx=kx,nky=ky;
      if(vis[ntx][nty][nkx][nky])continue;
      q.push(node(cc+1,ntx,nty,nkx,nky));
    }
  }
  printf("NA\n");
}

main(){
  while(scanf("%d%d",&X,&Y),X)
    solve();
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

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

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; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	//ios_base::sync_with_stdio(false);
	ll X, Y, ans=0;

	cin >> X >> Y;

	if( X % Y == 0 ){
		cout << -1 << endl;
		return 0;
	}else if( X == Y ){
		cout << -1 << endl;
		return 0;
	}

	reps(k,2,1000006){
		if( X*(ll)k % Y ){
			cout << X*(ll)k << endl;
			break;
		}
	}

	return 0;
}

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

int main(void)
{
	int n;
	long long l[88];
	l[0] = 2;
	l[1] = 1;
	scanf("%d", &n);
	for (int i = 2; i <= n; i++) {
		l[i] = l[i - 1] + l[i - 2];
	}
	printf("%lld\n", l[n]);
}


Measured memory_bytes: 256
using System;
using System.Linq;
namespace _0001
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();       
             
            Array.Sort(a);
            Console.WriteLine(a[0]+" "+a[1]+" "+a[2]);
        }
    }
}

Measured memory_bytes: 9736
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        int a = Read.Int();
        int b = Read.Int();
        Console.WriteLine(b*2-a);
    }
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b) { return a / gcd(a, b) * b; }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        for (long i = 2; i < n; i++) { if (n % i == 0) return false; }
        return true;
    }
}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long() { return long.Parse(Console.ReadLine()); }
    public static long[] longs() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); }
    public static int Int() { return int.Parse(Console.ReadLine()); }
    public static int[] ints() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 11092
n,k=map(int,input().split())
mod=10**9+7
bk = [pow((k//l),n,mod) for l in range(1,k+1)]

BK=[0]*(k+1)
for i in range(k,0,-1):
    hiku=0
    for j in range(k//i+1):
        if j*i>k:
            break
        hiku+=BK[i*j]
    BK[i] = bk[i-1]-hiku

ans=0
for i,bb in enumerate(BK):
#     print(i,bb)
    ans=ans+i*bb %mod
print(ans%mod)

Measured memory_bytes: 80340
n = list(map(int,input().rstrip()))
for i in range(2**3):
  ope = []
  ans = n[0]
  for j in range(3):
    if (i >> j) & 1:
      ope.append("+")
      ans += n[j+1]
    else:
      ope.append("-")
      ans -= n[j+1]
  if ans == 7:
    res = [ope[i]+str(n[1+i]) for i in range(3)]
    res = "".join(res)
    res = str(n[0]) + res + "=7"
    print(res)
    break

Measured memory_bytes: 3064
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin>>s;
    
    if(s.size()>=3) reverse(all(s));
    cout1(s)
}


Measured memory_bytes: 256
a = list(map(int,input().split()))

if 1 in a:
    if 9 in a:
        if 7 in a:
            if 4 in a:
                print("YES")
            else :
                print("NO")
        else :
            print("NO")            
    else :
        print("NO")
else :
    print("NO")


Measured memory_bytes: 2940
//package atCoderBeginnerContest167;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String T = scan.next();

        if(T.startsWith(S)){
        	System.out.println("Yes");
        }else {
        	System.out.println("No");

        }

	}

}


Measured memory_bytes: 35716
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
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; }

string s, t;

int main() {
    cin >> s >> t;
    int slen = s.length();
    int cnt = 0;
    for(int i = 0; i < slen; ++i) {
        if(s.at(i) != t.at(i)) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3868
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]
x=[]
s.sort()
t.sort()

for i in range(n):
    x.append(s.count(s[i])-t.count(s[i]))

print(max(max(x),0))

Measured memory_bytes: 3064
n,m = map(int, input().split())
xx = sorted(list(map(int, input().split())))
if n>m:
    print(0)
else:
    distance =[0]*(m-1)
    for i in range(m-1):
        distance[i] = abs(xx[i+1] - xx[i])
    distance = sorted(distance)
    print(sum(distance[0:len(distance)-n+1]))

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --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; }

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

const int MAX = 200;
const int INF = 1001001001;
const int MOD = 1000000007;

vector<ll> divisor(ll x) {
    vector<ll> res;
    for (int i = 2; (ll)i * i <= x; ++i) {
        if (x % i == 0) {
            ll j = x / i;
            if (i != j) {
                res.push_back(i);
                res.push_back(j);
            } else {
                res.push_back(i);
            }
        }
    }
    sort(res.begin(), res.end());
    if (1 < x) res.push_back(x);
    return res;
}

bool f(ll N, ll K) {
    if (N == K || N % K == 1) return true;
    if (1 < N % K) return false;
    return f(N / K, K);
}

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

    auto v = divisor(N);
    int ans = 0;
    for (auto &i : v) {
        if (f(N, i)) ans++;
    }

    v = divisor(N-1);
    ans += v.size();

    cout << ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> xs(n),ls(n);
  for(Int i=0;i<n;i++) cin>>xs[i]>>ls[i];

  using P = pair<Int, Int>;
  vector<P> vp;
  for(Int i=0;i<n;i++)
    vp.emplace_back(xs[i]+ls[i],xs[i]-ls[i]);
  sort(vp.begin(),vp.end());

  Int cnt=0,lst=-(1e9+10);
  for(auto p:vp){
    if(lst<=p.second){
      cnt++;
      lst=p.first;
    }
  }

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


Measured memory_bytes: 3956
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double eps = 0.0000000001;
	while (n--){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double s1 = x2 - x1,
			   t1 = y2 - y1,
			   s2 = x4 - x3,
			   t2 = y4 - y3;
		double v = fabs(s1 * t2 - s2 * t1);
		if (v < eps) cout << "YES\n";
		else         cout << "NO\n";
	}
	return 0;
}

Measured memory_bytes: 1196
# aoj0053.py

# input: n(<= 100000)
# output: sum of first n primes

LIM = 2000000

isPrime = [True for _ in range(LIM)]

isPrime[0] = isPrime[1] = False

# eratosthenes' sieve
for x in range(LIM):
    if isPrime[x]:
        for y in range(x*x, LIM, x):
            isPrime[y] = False

sumOfPrimes = [x for x in range(LIM) if isPrime[x]]

for i in range(1,len(sumOfPrimes)):
    sumOfPrimes[i] += sumOfPrimes[i-1]

while True:
    n = int(input())
    if n == 0:
        break

    print(sumOfPrimes[n-1])

Measured memory_bytes: 30016
s = int(input())
a = set([s])
x = s
ans = 1
while len(a) == ans:
  if x%2 == 0:
    x = int(x/2)
    a.add(x)
    ans += 1
  else:
    x = 3*x+1
    a.add(x)
    ans += 1
print(ans)

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

int main(){
  int h, w, a, b;
  cin >> h >> w >> a >> b;
  rep(i,h) {
    rep(j,w) {
      if(i < b) {
        if(j < a) cout << 0;
        else cout << 1;
      } else {
        if(j < a) cout << 1;
        else cout << 0;
      }
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1280
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

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


int main() {
	ll x;
	cin >> x;
	ll cnt;
	cnt = x / 500;
	x -= cnt * 500;
	ll ans = cnt * 1000;
	cnt = x / 5;
	ans += cnt * 5;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 200000000000000
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

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

#define S second
#define F first
// #define int long long  

//////////
int prr[3001][3001][2]={};
int dp[3001][3001]={};
int pr[3001][3001][2]={};
signed main()
{
    fastio;
    string s,t;
    cin>>s>>t;
    int n=s.length();
    int m=t.length();
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=m;++j)
        {
            dp[i][j]=dp[i-1][j];
            pr[i][j][0]=prr[i-1][j][0];
            pr[i][j][1]=prr[i-1][j][1];
            prr[i][j][0]=prr[i-1][j][0];
            prr[i][j][1]=prr[i-1][j][1];
            if(dp[i][j-1]>dp[i][j])
            {
                dp[i][j]=dp[i][j-1];
                pr[i][j][0]=prr[i][j-1][0];
                pr[i][j][1]=prr[i][j-1][1];
                prr[i][j][0]=prr[i][j-1][0];
                prr[i][j][1]=prr[i][j-1][1];
            }
            if(s[i-1]==t[j-1])
            {
                if(dp[i][j]<dp[i-1][j-1]+1)
                {
                    dp[i][j]=dp[i-1][j-1]+1;
                    pr[i][j][0]=prr[i-1][j-1][0];
                    pr[i][j][1]=prr[i-1][j-1][1];
                    prr[i][j][0]=i;
                    prr[i][j][1]=j;
                }
            }
        }
    }
    int i=prr[n][m][0];
    int j=prr[n][m][1];
    string ans;
    while(i>0)
    {
        ans.append(char_to_str(s[i-1]));
        int x=i,y=j;
        i=pr[x][y][0];
        j=pr[x][y][1];
    }
    reverse(ans.begin(), ans.end());
    cout<<ans;
}

Measured memory_bytes: 176128
import java.util.*;
import java.io.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        sc.close();

        out.printf("%d\n", Math.max(Math.max(A + B, A - B), A * B));
        out.flush();
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include <iomanip>
#include <math.h>
#define M 10000001
#define MAX 10000000000000010
#define mod 1000000007
#define ss second
#define ff first
#define ll long long int
#define pb push_back
#define ld double
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;

int main()
{
	ll n,r=0;
	cin>>n>>r;
	if(n>=10)
		cout<<r<<endl;
	else
	{
		r = r+100*(10-n);
		cout<<r<<endl;
	}

	return 0;
}

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

template <class Abel> struct BIT {
    const Abel UNITY_SUM = 0;                       // to be set
    vector<Abel> dat;
    
    /* [1, n] */
    BIT(int n) : dat(n + 1, UNITY_SUM) { }
    void init(int n) { dat.assign(n + 1, UNITY_SUM); }
    
    /* a is 1-indexed */
    inline void add(int a, Abel x) {
        for (int i = a; i < (int)dat.size(); i += i & -i)
            dat[i] = dat[i] + x;
    }
    
    /* [1, a], a is 1-indexed */
    inline Abel sum(int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i)
            res = res + dat[i];
        return res;
    }
    
    /* [a, b), a and b are 1-indexed */
    inline Abel sum(int a, int b) {
        return sum(b - 1) - sum(a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat.size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

int main() {
    long long N; cin >> N;
    vector<int> a(N); for (int i = 0; i < N; ++i) cin >> a[i];
    int low = 0, high = 1<<30;
    const int geta = N+1;
    while (high - low > 1) {
        int mid = (low + high) / 2;
        long long num = 0;
        BIT<long long> bit(N*2+10);
        int sum = 0;
        bit.add(sum+geta, 1);
        for (int i = 0; i < N; ++i) {
            int val;
            if (a[i] <= mid) val = 1; else val = -1;
            sum += val;
            num += bit.sum(1, sum+geta);
            bit.add(sum+geta, 1);
        }
        if (num > (N+1)*N/2/2) high = mid;
        else low = mid;
    }
    cout << high << endl;
}

Measured memory_bytes: 2176
#include <iostream>
using namespace std;
int main() {
  int i=0;
  int x;
  int y;
  int num[3000];
  int sum[3000];
  for(i=0; i<3000; i++){
    cin >> x >> y;
    if (x == 0 && y == 0)break;
    num[i] = x;
    sum[i] = y;
  }
  for(int h=0; h<i; h++){
  if(num[h] > sum[h])
      cout << sum[h] << ' ' << num[h] << endl;
  else
      cout << num[h] << ' ' << sum[h] << endl;
  }
  return 0;
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
#define rep(i, l, r) for(int i = (l), i##end = (r);i <= i##end;++i)
using std::cin; using std::cout;
const int maxn = 200200;
typedef long long ll;
const int mod = 998244353;
inline ll pow(ll a,int b,int ans = 1) {
	for(;b;b >>= 1,a = a * a % mod) if(b & 1)
		ans = ans * a % mod;
	return ans;
}
inline ll inverse(int x){ return pow(x, mod - 2); }
int n, h;
int fa[maxn], in[maxn], out[maxn], can[maxn];
inline int find(int x) {
	return fa[x] == x ? x : fa[x] = find(fa[x]);
}
int main() {
	std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> h;
	rep(i, 1, h + h) fa[i] = i;
	rep(i, 1, n) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		int x0 = c ? c + h : a;
		int x1 = d ? d : b + h;
		fa[find(x0)] = find(x1);
		++ out[x0], ++ in[x1];
	}
	rep(i, 1, h) {
		if(out[i] < in[i] || out[i + h] > in[i + h]) {
			cout << "NO" << '\n';
			return 0;
		}
		if(out[i] != in[i]) can[find(i)] = 1;
		if(out[i + h] != in[i + h]) can[find(i + h)] = 1;
	}
	rep(i, 1, h + h) {
		if(in[i] && out[i] && !can[find(i)]) {
			cout << "NO" << '\n';
			return 0;
		}
	}
	cout << "YES" << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define all(x) x.begin(),x.end()
#define ini(x,y) memset(x,y,sizeof(x))
#define cauto const auto &
#define cint const int &
#define F(x, y, z) for (int x = y; x <= z; x++)
#define D(x, y, z) for (int x = y; x >= z; x--)
using namespace std;
const int INF = 0x3f3f3f3f3f3f3f3f;
const int MAXN = static_cast<int>(1e5 + 25);
inline int read()
{
  int x = 0, y = 1, c = getchar();
  while (c > '9' || c < '0')
  {
    if (c == '-')
    {
      y = -1;
    }
    c = getchar();
  }
  while (c >= '0' && c <= '9')
  {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * y;
}
/*
 * 用最短的时间取得胜利！！！！
*/
struct road{
    int to,v;
    road(int to=0,int v=0):to(to),v(v){}
};

static vector<road> edge[MAXN];
struct heapnode{
    int to,val;
    heapnode(int T=0,int V=0):to(T),val(V){}
    bool operator<(const heapnode r)const{
        return val>r.val;
    }
};
static priority_queue<heapnode> q;
static int d[MAXN];
void dijkstra(){
    ini(d,0x3f);
    d[0]=0;
    q.push(heapnode(0,0));
    while(!q.empty()){
        int pos=q.top().to;
        q.pop();
        for(auto to:edge[pos]){

            if(d[pos]+to.v<d[to.to]){
                d[to.to]=d[pos]+to.v;//cout<<pos<<" "<<to.to<<" "<<d[to.to]<<endl;
                q.push(heapnode(to.to,d[to.to]));
            }
        }
    }
}
signed main(){
    int k=read();
    F(i,1,k-1){
        int now=i;
        F(j,1,9){
            edge[(i+j)%k].push_back(road(i,j));
            now*=10;
            edge[now%k].push_back(road(i,0));
        }
    }
    dijkstra();
//    int minn=INF;
    printf("%lld",d[1]+1);
    return 0;
}


Measured memory_bytes: 63728
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int n;
    ll ans = 0, sum = 0;

    cin >> n;

    vector<ll> l(n);

    for (int i = 0; i < n; i++)
    {
        cin >> l[i];
        sum += l[i];
        ans = max(ans, l[i]);
    }

    if (ans < sum - ans)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
using llong = long long;

int func(llong A, llong B) {
    llong C = max(A, B);
    int d = 0;
    while(C > 0) {
        C /= 10;
        ++d;
    }
    return d;
}

int main() {
    llong N;
    cin >> N;
    llong thresh = round(sqrt(N));
    llong A = 1, B;
    int fMin = 20;
    while (A <= thresh) {
        if (N%A == 0) {
            B = N / A;
            fMin = min(fMin, func(A, B));
        }
        ++A;
    }
    cout << fMin << endl;
}


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

using namespace std;

int main() {
    string in;
    int n;
    cin >> n >> in;
    vector<char> ans;
    for (int i=0; i<int(in.size()); ++i) {
        char tmp = in[i];
        ans.push_back(tmp);
    }

    for (int i=0; i<int(ans.size()); ++i) {
        ans.at(i) += n;
        if (ans.at(i) > 'Z') {
            int sub = ans.at(i) - 'Z' - 1;
            ans.at(i) = 'A';
            ans.at(i) += sub;
        }

        cout << ans.at(i);
    }
}


Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	int MAX = 55555;
	std::vector<int> primes(MAX+1,true);
	primes[0]=0;primes[1]=0;
	for(int x=2;x<=MAX;x++) {
		for(int y=2;x*y<=MAX;y++) {
			primes[x*y]=0;
		}
	}
	/*
	std::vector<int> count(5,0);
	rep(x,MAX+1) if(primes[x]) count[x%5]++;
	debug(count);
	*/

	std::vector<int> a;
	rep(x,MAX+1) if(primes[x] && x%5==2) a.emplace_back(x);
	rep(i,n) std::cout << a[i] << ' ';
	std::cout << ENDL;

	return 0;
}


Measured memory_bytes: 768
#![allow(clippy::needless_range_loop)]
#![allow(unused_macros)]
#![allow(dead_code)]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn set_bits(i: u32) -> u32 {
    let i = i - ((i >> 1) & 0x55555555);
    let i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
    (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24
}

fn main() {
    input! {
        n: usize,
        x: chars
    }
    let set = x.iter().filter(|x| **x == '1').count();
    let mut down = vec![0; n];
    down[0] = 1;
    let mut up = vec![0; n];
    up[0] = 1;
    for i in 1..n {
        if set > 1 {
            down[i] = down[i - 1] * 2 % (set - 1);
        }
        up[i] = up[i - 1] * 2 % (set + 1);
    }
    let down_sum = if set > 1 {
        x.iter().rev().zip(&down).fold(0, |acc, (x, y)| {
            (acc + (*x == '1') as usize * y) % (set - 1)
        })
    } else {
        0
    };
    let up_sum = x.iter().rev().zip(&up).fold(0, |acc, (x, y)| {
        (acc + (*x == '1') as usize * y) % (set + 1)
    });
    for (c, key) in x.iter().zip((0..n).rev()) {
        let mut r = if *c == '1' {
            if set == 1 {
                println!("0");
                continue;
            }
            (down_sum + (set - 1) - down[key]) % (set - 1)
        } else {
            (up_sum + up[key]) % (set + 1)
        } as u32;
        let mut cnt = 1;
        while r > 0 {
            r = r % set_bits(r);
            cnt += 1;
        }
        println!("{}", cnt);
    }
}


Measured memory_bytes: 6056
n = int(input())
# s = [str(9) for i in range(n)]

s = list(input())

c = 0



for i in range(100):
    i_str = str(i).zfill(2)
    p = 0
    for j in range(n):
        if(s[j] == i_str[p]):p+=1
        if(p==2):
            for j2 in range(10):
                if(str(j2) in s[j+1:]):
                    c+=1
                    # print(i_str,j2)
            break
print(c)


Measured memory_bytes: 3572
/**
       **********    ************
	  Author : Avi J Patel
	  University : DAIICT
       **********    ************
**/
#include<bits/stdc++.h>
#include<fstream>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair 
#define mt make_tuple
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define Mod 998244353
#define N 200001
#define large 1844674407370955161
#define For(i,m,n) for(long long i=m;i<n;i++)
#define st(x) sort(x.begin(),x.end())
#define re(x,i) reverse(x.begin()+i,x.end())
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define min_heap priority_queue<int, vector<int>, greater<int>>
#define max_heap priority_queue<int>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define pp pair<pair<ll,ll>,pair<ll,ll>>
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> 

bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) 
{ 
    if(a.ss < b.ss) return true; 
	else return false;
}
bool sortbyboth(const pair<int,int> &a, const pair<int,int> &b)
{
	if(a.ff>b.ff) return true;
	else if(a.ff==b.ff) return a.ss<b.ss;
	else return false;
} 
bool sortff_resortss(const pair<int,int> &a, const pair<int,int> &b)
{
	if(a.ff<b.ff) return true;
	else if(a.ff==b.ff) return a.ss>b.ss;
	else return false;
}
bool sortbystring(const string &a, const string &b)
{
	string c=a+b;
	string d=b+a;
	if(c>=d) return true;
	else return false;
}

ll modi(ll a, ll m) 
{ 
    ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) 
      return 0; 
    while (a > 1) 
    { 
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0; 
    return x; 
} 
ll Logn(ll  n, ll r) 
{ 
    return (n > r - 1) ? 1 + Logn(n / r, r) : 0; 
} 

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 

ll modinv(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 

int main()
{
	FAST
	int t=1;
//	cin>>t;
	while(t--)
	{
		string s,t;
		cin>>s>>t;
		int n=s.size();
		if(t.substr(0,n)==s)
		{
			cout<<"Yes"<<endl;
		}
		else
		{
			cout<<"No"<<endl;
		}
	}
	return 0;
}




















Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll)x.size()
#define hell            1000000007
#define inf             (ll)1e18 + 5
#define PI              (double)3.14159265358979323844
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
	ll n,m;
	cin>>n>>m;
	if (n%2){
		rep(i,0,m){
			cout<<i+1<<" "<<n-i<<endl;
		}
		return;
	}
	else{
		ll start=1,end=n,cnt=0;
		set <ll> s;
		while (cnt<m){
			if ((end-start==n/2) || (s.find(end-start)!=s.end()) || (s.find(n-end+start)!=s.end())){
				end--;
				continue;
			}
			s.insert(end-start);
			s.insert(n-end+start);
			cout<<start<<" "<<end<<endl;
			start++,end--;
			cnt++;
		}
	}
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 10084
#include <stdio.h>

int main()
{
	int a,b;
	int gcd,lcm;
	while(scanf("%d %d",&a,&b) != EOF)
	{
		int tmp[2] = {a,b};
		while(1)
		{
			tmp[0] %= tmp[1];
			if(tmp[0] == 0)
			{
				gcd = tmp[1];
				break;
			}
			else
			{
				tmp[1] %= tmp[0];
				if(tmp[1] == 0)
				{
					gcd = tmp[0];
					break;
				}
			}
		}
		lcm = a / gcd * b;
		printf("%d %d\n",gcd,lcm);
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void)
{
int H,W,i,j;
scanf("%d %d",&H,&W);

while(H != 0 || W != 0){
for(j=1; j<=H; j++){
for(i=1; i<=W; i++){
printf("#");
}
printf("\n");
}
scanf("%d %d",&H,&W);
printf("\n");
}
return 0;

}

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

int main(){
    int a, b, c;
    string str;
    cin >> a >> b >> c;
    if(  (a == 5 && b == 5 && c == 7)
       ||(a == 5 && b == 7 && c == 5)
       ||(a == 7 && b == 5 && c == 5)){
        str = "YES";
    }else{
        str = "NO";
    }
    cout << str << endl;
    return 0;
}


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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define int long long

typedef pair<int, int> ii;

const int N = 2e5 + 5;

const int inf = 1e15;

int n, h[N], a[N], sum, dp[N], bit[N];

void update(int pos, int val) {
    while(pos < N) {
        bit[pos] = max(bit[pos], val);
        pos += pos &(-pos);
    }
}

int get(int pos) {
    int ans = 0;
    while(pos > 0) {
        ans = max(ans, bit[pos]);
        pos -= pos & (-pos);
    }
    return ans;
}

signed main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> h[i];
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    int mx = 0;
    for(int i = 1; i <= n; i++) {
        dp[i] = get(h[i]) + a[i];
        update(h[i], dp[i]);
        mx = max(mx, dp[i]);
    }
    cout << mx;
}


Measured memory_bytes: 6528
#include<cstdio>
using namespace std;

typedef const int& cint;
typedef const short& csh;

const int MAXN = 110;

char str[MAXN];
int rsum[MAXN][MAXN], csum[MAXN][MAXN];
short f[MAXN][MAXN][MAXN][MAXN];

inline int Min(int a, int b){return a < b ? a : b;}

inline int Max(int a, int b){return a > b ? a : b;}

inline void chkmax(int& a, int b){if (b > a) a = b;}

inline void chkmax(short& a, short b){if (b > a) a = b;}

int main(){
	int H, W, sx, sy, ans = 0;
	scanf("%d %d", &H, &W);
	for (int i = 1; i <= H; ++i){
		scanf("%s", str + 1);
		for (int j = 1; j <= W; ++j){
			rsum[i][j] = rsum[i][j - 1], csum[i][j] = csum[i - 1][j];
			if (str[j] == 'o')
				++rsum[i][j], ++csum[i][j];
			else if (str[j] == 'E')
				sx = i, sy = j;
		}
	}
	for (int u = 0, d, l, r, t1, t2, del; sx - u >= 1; ++u)
		for (d = 0; sx + d <= H; ++d)
			for (l = 0; sy - l >= 1; ++l)
				for (r = 0; sy + r <= W; ++r){
					chkmax(ans, f[u][d][l][r]);
					if (sx - u > 1 && sx - u > d + 1){
						t1 = Max(sy - l, r + 1), t2 = Min(sy + r, W - l);
						if (t1 <= t2) 
							del = rsum[sx - u - 1][t2] - rsum[sx - u - 1][t1 - 1];
						chkmax(f[u + 1][d][l][r], f[u][d][l][r] + del);
					}
					if (sx + d < H && sx + d < H - u){
						t1 = Max(sy - l, r + 1), t2 = Min(sy + r, W - l);
						if (t1 <= t2) 
							del = rsum[sx + d + 1][t2] - rsum[sx + d + 1][t1 - 1];
						chkmax(f[u][d + 1][l][r], f[u][d][l][r] + del);
					}
					if (sy - l > 1 && sy - l > r + 1){
						t1 = Max(sx - u, d + 1), t2 = Min(sx + d, H - u);
						if (t1 <= t2) 
							del = csum[t2][sy - l - 1] - csum[t1 - 1][sy - l - 1];
						chkmax(f[u][d][l + 1][r], f[u][d][l][r] + del);
					}
					if (sy + r < W && sy + r < W - l){
						t1 = Max(sx - u, d + 1), t2 = Min(sx + d, H - u);
						if (t1 <= t2) 	
							del = csum[t2][sy + r + 1] - csum[t1 - 1][sy + r + 1];
						chkmax(f[u][d][l][r + 1], f[u][d][l][r] + del);
					}
				}
	printf("%d", ans);
	return 0;
}


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

using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	map<int, int> memo;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		memo[a[i]] = i;
	}

	sort(a.begin(), a.end());
	int ans = 0;
	for (int i = 0; i < n; i++) {
		ans += (memo[a[i]] % 2 != i % 2);
	}
	cout << ans / 2 << endl;
	return 0;
}

Measured memory_bytes: 5376
#include <iostream>
#include <stdio.h>
#include <vector> 
#include <math.h> 
using namespace std;

int main(void) {
    double a,b; cin >> a >> b;
    int sum = 0;
    int i = 0;
    while (i < 2) {
        if (a > b) {
            sum += a;
            a--;
        } else {
            sum += b;
            b--;
        }
        i++;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3684
from collections import defaultdict

s = input()

def judge() :
    d = defaultdict(int)
    for s_ in s :
        d[s_] += 1
    
    if len(d) == 3 :
        one = []
        for k, v in d.items() :
            if v == 1 :
                one.append(k)
        
        if len(one) == 1 :
            for i in range(1, len(s) - 1) :
                if s[i] == one[0] :
                    if s[i-1] != s[i+1] :
                        return 'First'
                    else :
                        return 'Second'

    if (len(s) + (1 if s[0] == s[-1] else 0)) % 2 == 1 :
        return 'First'
    else :
        return 'Second'
       
print(judge())

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

const int M = 100000;

int n, m, x[M], y[M], z[M];

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

int main() {
  cin >> n >> m;
  rep(i, m) {
    cin >> x[i] >> y[i] >> z[i];
    x[i]--;
    y[i]--;
  }
  UnionFind uf(n);
  rep(i, m) uf.unite(x[i], y[i]);
  set<int> st;
  rep(i, n) st.insert(uf.find(i));
  int ans = st.size();
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 9400
from collections import defaultdict

def read_input():
    n = int(input())
    blue_cards = []
    for i in range(n):
        blue_cards.append(input())

    m = int(input())
    red_cards = []
    for i in range(m):
        red_cards.append(input())

    return n, m, blue_cards, red_cards

def submit():
    n, m, blue_cards, red_cards = read_input()

    blue_file = defaultdict(int)
    for b in blue_cards:
        blue_file[b] += 1

    red_file = defaultdict(int)
    for r in red_cards:
        red_file[r] += 1

    all_words = set(list(blue_file.keys()) + list(red_file.keys()))

    x = 0
    for word in all_words:
        p = blue_file[word] - red_file[word]
        if p > x:
            x = p

    print(x)



if __name__ == '__main__':
    submit()


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

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	int M, m;
	M = max(max(A, B), C);
	m = min(min(A, B), C);

	int H, h;
	H = (A == M) + (B == M) + (C == M);
	h = (A == m) + (B == m) + (C == m);

	if (H == 2 || h == 2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}

Measured memory_bytes: 256
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())

delta1 = A1 - B1
delta2 = A2 - B2

d = delta1 * T1 + delta2 * T2
T = T1 + T2

if d == 0:
    print("infinity")
    exit()

if delta1 * delta2 > 0:
    print(0)
    exit()

if delta1 * d > 0:
    print(0)
    exit()

n = int(delta1 * T1 // d) * (-1)
ans = 2 * n - 1
if delta1 * T1 == n * d * (-1):
    ans += 1

print(max(ans, 0))

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string.h>
#include <math.h>
using namespace std;
int main()
{
    long long n;
    while(~scanf("%lld",&n))
    {
        long long  s=sqrt(n);
        if(s*s==n)
        {
            printf("%lld\n",n);
        }
        else
            printf("%lld\n",s*s);
    }
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  int A=0; int B=0; int C=0; int D=0;
  for (int i=0;i<N; i++){
    string S;
    cin >> S;
    if (S=="AC") A++;
    if (S=="WA") B++;
    if (S=="TLE") C++;
    if (S=="RE") D++;
  }

  cout << "AC x " << A << endl;
  cout << "WA x " << B << endl;
  cout << "TLE x " << C << endl;
  cout << "RE x " << D << endl;
  return 0;
}

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

int main() {
    int x;
    cin>>x;
    vector<string> vt(10);
    vt.at(0)="pon";
    vt.at(1)="pon";
    vt.at(2)="hon";
    vt.at(3)="bon";
    vt.at(4)="hon";
    vt.at(5)="hon";
    vt.at(6)="pon";
    vt.at(7)="hon";
    vt.at(8)="pon";
    vt.at(9)="hon";
    cout<<vt[x%10]<<endl;

  return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,p;
  while(1){
    cin >> n >> p;
    if(n==0&&p==0){
      break;
    }
    int wan=p;
    int hito[10000]={0},num=0;
    while(1){
      //cout<<"hito[num]="<<hito[num]<<" wan="<<wan<<endl;
      if(wan==0){
	if(hito[num]==p){
	  cout<<num<<endl;
	  break;
	}
	else{
	  wan+=hito[num];
	  hito[num]=0;
	}
      }else{
	wan--;
	hito[num]++;
      }
      num++;
      if(num==n){
	num=0;
      }
    }

    /*while(1){
      wan++;
      if (p>0)break;
      }*/
  }
  return 0;
}
  
 
    
    
  



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

#define FASTIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
using ll = long long;


int main() {
	FASTIO
	int n;
	cin >> n;
	vector<ll> a(n);
	ll ans = 0;
	ll mx = 0;
	for (ll &i : a) {
		cin >> i;
		if (i > mx) {
			mx = i;
		} else ans += mx - i;


	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4784
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define dbgi(x) cout << #x << " = " << (x) << "\n";
#define dbgvi(x) cout << #x << " = "; for(int i = 0; i < (x.size()); ++i) cout << x[i] << " ";
#define mrk() cout << "HERE\n"
#define vi vector < int >
#define vs vector < string >
#define int long long
#define vii vector < vi >
#define viii vector < vii >
#define viiii vector < viii >
#define pii pair < int, int >
#define foru(i, a, b) for(int i = a; i < b; ++i)
#define ford(i, b, a) for(int i = b; i > a; --i)
using namespace std;

signed main(){
    int n;
    cin >> n;
    cout << 48 - n;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FScanner sc = new FScanner();
		int M = sc.nextInt();
		int D = sc.nextInt();
		long count = 0;
		for (int i = 2; i <= M; i++) {
			for (int j = 22; j <= D; j++) {
				int ten = 0;
				int iti = 0;
				ten = (int) j / 10;
				iti = j % 10;
				if (ten < 2 || iti < 2) {
					continue;
				}
				if (i == ten * iti) {
					count++;
				}
			}
		}
		System.out.println(count);
	}

}

class FScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

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

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

S = cin()[0]
dp = [0] * 3000
INF = 10 ** 9 + 7
dp[0] = 1
for i in range(S + 10):
    for j in range(3, S + 10):
        if(i + j <= 2100):
            dp[i + j] += dp[i]
            dp[i + j] %= INF
ans = dp[S]
print(ans)

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

int main() {
	string s;
	int c[26] = { 0 };
	while(getline(cin, s))
	{
		for(int i=0; i<s.length(); i++)
		{
			//If it is upper case, make it lowercase... The input count for corresponding lowercase character value will be increment by one according to the example provided in the input.
			if ((int)s[i]>64 && (int)s[i]<92)
			{
				s[i] = s[i] - 'A' + 'a';
			}

			// Special character (Space, # $ % . etc) may come in input, don't process those....
			if((int)s[i]>96 && (int)s[i]<124)
	 		{
			    int index = (int)s[i] - 'a' ;
				c[index] = c[index]  +1;
			}
		}
	}
	for(int i = 0; i<26; i++)
		{
			char ch ;
			ch = i + 'a';
			cout<<ch << " : " << c[i] << "\n";
		}
	return 0;
}


Measured memory_bytes: 3132