akhauriyash/Code-Regression huggingface dataset:
import math
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

answer=0

n=int(input())
k=int(input())
now=n
keta=0
alist=[]
while now!=0:
    amari=now%10
    now=now//10
    alist.append(amari)
    keta+=1
alist.reverse()
zlist=[]
for al in range(len(alist)):
    if alist[al]!=0:
        zlist.append([al, alist[al]])

if k>keta:
    print(0)
else:
    moto=10**(keta-1)
    first=n//moto
    if k>=2:
        second=(n-first*moto)//(moto//10)
        if k>=3:
            third=(n-first*moto-second*(moto//10))//(moto//100)
    #print(keta)
    #print(first, second)
    if keta-1>=k:
        answer+=cmb(keta-1, k)*(9**k)
    answer+=max(first-1, 0)*cmb(keta-1, k-1)*(9**(k-1))
    if k==1:
        answer+=1
    elif k==2:
        if keta-1>=k and second!=0:
            answer+=cmb(keta-2, k-1)*(9**(k-1))
        answer+=cmb(keta-2, k-2)*max(second-1, 0)*(9**(k-2))
        if second!=0:
            answer+=1
        else:
            swit=0
            kaz=0
            for zl in zlist:
                if zl[0]>=1 and swit==0:
                    swit=zl[0]
                    kaz=zl[1]
            if swit!=0:
                answer+=(keta-swit-1)*9
                answer+=kaz
    else:
        if keta-1>=k and second!=0:
            answer+=cmb(keta-2, k-1)*(9**(k-1)) #30xxxx
        answer+=cmb(keta-2, k-2)*max(second-1, 0)*(9**(k-2)) #31xxxx, 32xxxx
        if keta-1>=k and third!=0 and second!=0:
            answer+=cmb(keta-3, k-2)*(9**(k-2)) #330xxx
        if second!=0:
            if keta-1>=k:
                if third!=0:
                    answer+=third
                else:
                    swit=0
                    keta2=0
                    kaz=0
                    for zl in zlist:
                        if zl[0]>=2 and swit<=0:
                            swit+=1
                            keta2=zl[0]
                            kaz=zl[1]
                    if swit>0:
                        answer+=(keta-keta2-1)*9
                        answer+=kaz
            else:
                if third!=0:
                    answer+=third
        else:
            if keta-1>=k:
                if True:
                    swit=0
                    keta2=0
                    kaz=0
                    for zl in zlist:
                        if zl[0]>=2 and swit<=1:
                            swit+=1
                            keta2=zl[0]
                            kaz=zl[1]
                    if swit>1:
                        answer+=(keta-keta2-1)*9
                        answer+=kaz
                    elif swit==1:
                        if keta2!=keta:
                            answer+=cmb(keta-keta2-1, 2)*81
            else:
                if third!=0:
                    answer+=third
    
    print(answer)

Measured memory_bytes: 38384
#include <stdio.h>

int main(void)
{
	int A = 0;
	int B = 0;
	
	scanf("%d %d",&A, &B);
	
	if((A <= 8) && (B <= 8)){
		printf("Yay!\n");
	}
	
	else{
		printf(":(\n");
	}
	
	return(0);
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
    int i,m,n;
    double l,temp,sum=0;
    cin >> n >> m;
    int a[100];
    for(i=0;i<n;i++){
        cin >> a[i];
        sum += a[i];
    }
    sort(a,a+n,greater<int>());
    l = 4*m;
    temp = sum/l;
    if(a[m-1] >= ceil(temp))cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
    int n, ans = 0, prev_r = 0;    
    std::cin >> n;
    for (int a, i = 0; i < n; ++i) {
        std::cin >> a;
        int lg = 31 - __builtin_clz(a); // log_2, rounded down
        if ((1 << lg) == a) {
            ans += lg - std::min(prev_r, lg);
            prev_r = lg;
        } else {
            ans += lg + 1;
            if (prev_r <= lg)
                ans -= prev_r, prev_r = lg + 1;
            else
                ans -= lg + 1, prev_r = lg;
        }
    }
    std::cout << ans << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
def gcd(x, y):
  if y == 0:
    return x
  return gcd(y, x % y)

N, K = map(int, input().split())
A = list(map(int, input().split()))
g = 0
for i in A:
  g = gcd(g, i)
ans = "IMPOSSIBLE"
for i in A:
  if i >= K and (K - i) % g == 0:
    ans = "POSSIBLE"
    break
print(ans)

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define dbg(x) cout<<#x" = "<<(x)<<ln

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

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, a, od;

int main() {
	cin >> n;
	rep(i,n) {
		cin >> a;
		od += a%2==1;
	}
	if (od%2==0) cout << "YES" << ln;
	else cout << "NO" << ln;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main() {
  
  int s;
  cin >> s;
  
  long long ans[2005] = {};
  ans[0] = 0;
  ans[1] = 0;
  ans[2] = 0;
  ans[3] = 1;
  for (int i = 4; i <= s; ++i) {
    ans[i] += 1;
    for (int j = 3; j <= i - 3; ++j) {
      ans[i] += ans[j];
      ans[i] %= 1000000007ll;
    }
  }
  
  cout << ans[s];
  
  return 0;
}

Measured memory_bytes: 3160
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
int main()
{
	ll a,b;
	cin>>a>>b;
	if((a+b)&1)
	{
		cout<<"IMPOSSIBLE"<<endl;
		return 0;
	}
	ll ans=(a+b)/2;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)

//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int N,M;

int main()
{
  while(cin>>N>>M,N||M){
    int me,meb;
    int board[1001];
    int saikoro[1001];
    for(int i = 1;i <= N;i++){
      cin >>meb;
      board[i] =meb;
    }
    for(int i = 1;i <= M;i++){
      cin >>me;
      saikoro[i] =me;
    }
    int p = 1;//現在地
    int ans = 0;
    for(int i = 1;i <=M;i++){
      p += saikoro[i];
      p += board[p];
      if(p >=N){
	ans = i;
	break;
      }
    }
    cout <<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1164
n = gets.to_i
m = []
p_num = 0

n.times{
  m += [gets.to_i]
}

for x in m
  flag = 0
  for y in 2..(x**0.5)
    if x % y == 0
      flag = 1
      break
    end
  end
  if flag == 0
    p_num += 1
  end
end

puts p_num

Measured memory_bytes: 13980
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
// #include<vor>
using namespace std;
typedef long long int ll;
#define pb push_back
ll mod = 1e9+7;

ll powm(ll a , ll b , ll mod)
{
  ll res = 1;
  while(b)
  {
    if(b & 1)
    res = (res *a)%mod;
    a = (a*a)%mod;
    b>>1;
  }
  return res;
}
ll gcd(ll a , ll b);
ll power(ll x , ll y , ll m);

ll modInverse(ll a , ll m)
{
  ll g = gcd(a,m);
  if(g != 1)
  return 1;
  else
  return power(a,m-2,m);

}

ll power(ll x , ll y , ll m)
{
  if(y == 0)
  return 1;
  ll p = power(x , y/2 , m)%m;
  p = (p*p)%m;

  return (y%2 == 0) ? p : (x *p) % m;
}

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

vector<int>adj[1000001] , ans;
int dis[1000001] , cnt[1000001];
bool vis[1000001];



int freq[1000001];
void solve()
{
    int r;
    // double pi = 6.28318530717958623200/2;
    cin>>r;
    cout<<2*M_PI*r<<"\n";

}

int main()
{
  int tc;
  // cin>>tc;
  tc = 1;
  while(tc--)
  {
    solve();
  }
}


Measured memory_bytes: 27216
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        int height = scanner.nextInt();
        int width = scanner.nextInt();
        int[][] array = Arrays.stream(new int[height])
                .mapToObj(i -> scanner.next().chars().map(c -> c == '#' ? -1 : 0).toArray())
                .toArray(int[][]::new);

        int xLength = array.length - 1;
        for (int x = 0; x <= xLength; x++) {
            int yLength = array[x].length - 1;
            for (int y = 0; y <= yLength; y++) {
                if (array[x][y] == -1)
                    continue;

                boolean flag1 = false;
                boolean flag2 = false;

                if (x != 0) {
                    if (array[x - 1][y] == -1) array[x][y]++;
                    flag1 = true;
                } if (x != xLength) {
                    if (array[x + 1][y] == -1) array[x][y]++;
                    flag2 = true;
                } if (y != 0) {
                    if (array[x][y - 1] == -1) array[x][y]++;
                    if (flag1 && array[x - 1][y - 1] == -1) array[x][y]++;
                    if (flag2 && array[x + 1][y - 1] == -1) array[x][y]++;
                } if (y != yLength) {
                    if (flag1 && array[x - 1][y + 1] == -1) array[x][y]++;
                    if (flag2 && array[x + 1][y + 1] == -1) array[x][y]++;
                    if (array[x][y + 1] == -1) array[x][y]++;
                }
            }
        }

        Arrays.stream(array)
                .map(a -> Arrays.stream(a)
                        .mapToObj(b -> b == -1 ? "#" : Integer.toString(b))
                        .collect(Collectors.joining()))
                .forEach(System.out::println);
    }
}

Measured memory_bytes: 29268
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
 int a , as;
  int b , bs;
  cin>>a>>as>>b>>bs;
  int t;
  cin>>t;
  if(as <= bs){
   cout<<"NO"<<endl;
    return 0;
  }
  int net = as - bs;
  double val = (double)abs(b-a)/(double)net;
  if(val <= t){
   cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 3564
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
using namespace std;
int main() {
	string a, b, c, yan;
	char now = 'a';
	long long int ac, bc, cc;
	cin >> a >> b >> c;
	ac = a.size(), bc = b.size(), cc = c.size();
	while (1) {
		if (now == 'a') {
			if (!ac) {
				cout << 'A' << endl;
				break;
			}
			now = a[0];
			a.erase(a.begin());
			ac--;
			yan = a;
		}
		if (now == 'b') {
			if (!bc) {
				cout << 'B' << endl;
				break;
			}
			now = b[0];
			b.erase(b.begin());
			bc--;
			yan = b;
		}
		if (now == 'c') {
			if (!cc) {
				cout << 'C' << endl;
				break;
			}
			now = c[0];
			c.erase(c.begin());
			cc--;
			yan = c;
		}
	}
	return 0;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    int N, Q;
    string S;
    cin >> N >> S >> Q;
    vector<set<int>> is(26);
    rep(i, N) is[S[i] - 'a'].insert(i);

    rep(_, Q) {
        int type;
        cin >> type;
        if (type == 1) {
            int i;
            char c;
            cin >> i >> c;
            i--;
            is[S[i] - 'a'].erase(i);
            S[i] = c;
            is[S[i] - 'a'].insert(i);
        } else {
            int l, r;
            cin >> l >> r;
            l--;
            int ans = 0;
            rep(i, 26) {
                auto it = is[i].lower_bound(l);
                if (it != is[i].end() && *it < r) ans++;
            }
            cout << ans << endl;
        }
    }
}


Measured memory_bytes: 26244
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	N := ReadInt()
	a := ReadInts(N)
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	ans := 0
	for i := 0; i < N; i++ {
		if i%2 == 0 {
			ans += a[i]
		} else {
			ans -= a[i]
		}
	}
	fmt.Println(ans)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1840
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

ll dp[55][1048580];

int main()
{
   FAST/**/
   ll powa[64];
   powa[0] = 1;
   for(ll i=1;i<64;i++)
        powa[i] = powa[i-1]*2;
   memset(dp,0,sizeof(dp));
   ll n;
   cin>>n;
   
   ll floyd[n][n];
   repi(i,n)
        repi(j,n)
            if(i!=j)
                floyd[i][j] = inf;
            else floyd[i][j] = 0;    
   
   pair<ll,ll> ed[n];
   
   rep(n-1)
   {
       ll a,b;
       cin>>a>>b;
       a--,b--;
       ed[i+1] = mp(a,b);
       floyd[a][b] = 1;
       floyd[b][a] = 1;
   }
   
   ll m;
   cin>>m;
   
   pair<ll,ll> cond[m+1];
   rep(m)
        cin>>cond[i].ff>>cond[i].ss, cond[i].ff--, cond[i].ss--;
  
   repi(i,n)
        repi(j,n)
            repi(k,n)
                floyd[j][k] = min(floyd[j][k], floyd[j][i] + floyd[i][k]);  
   
   
   /*repi(i,n)
        repi(j,n)
        {
            cout<<"B/W "<<i+1<<" , "<<j+1<<" = "<<floyd[i][j]<<"\n";
        }
   */        
   
   ll lim = (1ll<<(m));
   dp[0][0] = 1;
   for(ll i=1;i<=n-1;i++)
   {
       ll m1 = 0;
       repi(j,m)
       {
           if(floyd[ed[i].ff][cond[j].ff] + 1 + floyd[ed[i].ss][cond[j].ss] == floyd[cond[j].ff][cond[j].ss] || floyd[ed[i].ff][cond[j].ss] + 1 + floyd[ed[i].ss][cond[j].ff] == floyd[cond[j].ff][cond[j].ss])
                m1+=(powa[j]);
       }
       
       //cout<<"At "<<i<<" = "<<m1<<"\n";
       
       for(ll mask=0;mask<lim;mask++)
       {
           dp[i][mask|m1]+=dp[i-1][mask];
           dp[i][mask]+=dp[i-1][mask];
       }
   }
   
   cout<<dp[n-1][lim-1];
   
   return 0;        
}  
   

Measured memory_bytes: 450944
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//typedef tree < int , null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> TREE;
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define pss pair<short,short>
#define pld pair<long double,long double >
#define ld long double
#define piii  pair<pii,int>
#define vii vector<pair<int,int> >
#define st first
#define nd second
#define pll pair<ll,ll>
#define speed ios::sync_with_stdio(false);cin.tie();cout.tie();
#define M_PI 3.14159265358979323846
//#define int long long
const int mod=1000000007;
//const int mod=1009;
//const int mod=998244353;
const int inf=1000000009;
const long long INF=1000000000000000009;
const long long big=1000000000000000;
const long double eps=0.000000000000000000001;
using namespace std;
int main()
{
    speed
    int h,n;
    cin>>h>>n;
    int suma=0;
    for(int i=1; i<=n; i++)
    {
        int a;
        cin>>a;
        suma+=a;
    }
    if(suma>=h)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from collections import Counter 
from itertools import combinations
def main():
    N = int(readline())
    S = readline().rstrip().decode()
    d = Counter(S)
    sg = d['R']*d['G']*d['B']
    cnt = 0
    for i, j in combinations([int(i) for i in range(N)], 2):
        if (i+j)%2 == 0:
            m = (i+j)//2
            if (S[i]!=S[j]) and (S[j]!=S[m]) and (S[m]!=S[i]):
                cnt += 1
    print(sg-cnt)
if __name__ == '__main__':
    main()


Measured memory_bytes: 68584
#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 922337203685477;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
#define maxN 200007
using namespace std;
int main() {
  fastio;
  ll n = 0, x = 0, t = 0;
  cin >> n >> x >> t;
  ll q = n / x;
  ll r = n % x;
  if (r)
    ++q;
  cout << q*t;
}

Measured memory_bytes: 3612
#include <cstdio>
#include <utility>
#include <complex>
#include <cmath>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

typedef complex<double> p;

p read_complex() {
	double r, i;
	if (scanf("%lf %lf", &r, &i) == EOF)
		exit(0);
	return p(r, i);
}

p read() {
	p a = read_complex();
	return read_complex() - a;
}

int main() {
	for (;;) {
		p a = read(), b = read();
		outl(fabs(a.real() * b.real() + a.imag() * b.imag()) < 1e-10 ? "YES" : "NO");
	}
}


Measured memory_bytes: 2616
def lcm(x, y):
    a,b = x,y
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    
    return int(x * y / b)

[a,b] = [int(x) for x in input().split()]

print(lcm(a,b))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
string a,b;
map<char,char> mp;
int main(){
	mp['q']='p';
	mp['p']='q';
	mp['b']='d';
	mp['d']='b';
	cin>>a;
	for(int i=0;i<a.length();i++){
		b=mp[a[i]]+b;
	}
	if(b==a){
		printf("Yes");
	}
	else printf("No");
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}
ll nCr(ll n, ll r)
{
	if(r>n)
	return 0;
    if (r == 0)
        return 1;
    return (n * nCr(n - 1, r - 1)) / r;
}
int32_t main()
{
	int n;
	cin >> n;
	int a[n];
	map<int,int> mp;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
		mp[a[i]]++;
	}
	int cnt=0;
	for(auto it=mp.begin();it!=mp.end();it++)
	{
		cnt+=nCr((*it).second,2);
	}
	for(int i=0;i<n;i++)
	{
		cout << cnt - (nCr(mp[a[i]],2)) + nCr(mp[a[i]]-1,2) << endl;
	}
}


Measured memory_bytes: 11008
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int n;

llong cal(vector<llong> v, int b){
  llong res = 0;
  REP(i,n){
    res += llabs(v[i] - b);    
  }
  return res;
}

int main(){

  scanf("%d", &n);

  vector<llong> v(n);
  REP(i,n){
    scanf("%lld", &v[i]);
    v[i] -= i + 1;
  }
  
  SORTV(v);
  llong mid = v[n / 2];

  llong ans = cal(v, mid);
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main(){

    int a,b;
    cin>>a>>b;

    char ch = a+'0';
    char bh = b+'0';

    string c="",d="";

    for(int i=0;i<a;i++){
        d+=bh;
    }
    for(int i=0;i<b;i++){
        c+=ch;
    }

    int m = min(d.length(),c.length());

    bool t = false;
    int i;

    for(i=0;i<m;i++){
        if(d[i]!=c[i]){
            break;
        }
    }

    if(i==m){
        if(c.length()==m)cout<<c<<endl;
        else cout<<d<<endl;
    }
    else{
        if(c[i]<d[i])cout<<c<<endl;
        else cout<<d<<endl;
    }


}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++)cin>>a[i][j];
    }
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        int b;
        cin>>b;
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(a[j][k]==b)a[j][k]=0;
            }
        }
    }
    /* for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cout<<a[i][j]<<' ';
        }cout<<endl;
    } */
    for(int i=0;i<3;i++){
        bool ok=true;
        for(int j=0;j<3;j++){
            if(a[i][j]!=0)ok=false;
        }
        if(ok){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    for(int j=0;j<3;j++){
        bool ok=true;
        for(int i=0;i<3;i++){
            if(a[i][j]!=0)ok=false;
        }
        if(ok){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    set<int> st;
    for(int i=0;i<3;i++)st.insert(a[i][i]);
    if(st.size()==1){
        cout<<"Yes"<<endl;
        return 0;
    }
    st.clear();
    for(int i=0;i<3;i++)st.insert(a[i][2-i]);
    if(st.size()==1){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
}

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

int main() {
  char c;
  cin >> c;
  
  if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel" << endl;
  }
  
  else {
    cout << "consonant" << endl;
  }
}
  


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

using namespace std;

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

    int n;
    cin >> n;
    ll cnt = 0;
    for (int i = 0; i < n; i++)
    {
        ll gomi, num;
        string s;
        cin >> gomi >> s >> num;
        if (s == "(")
            cnt += num;
        else
            cnt -= num;

        if (cnt)
            cout << "No" << endl;
        else
            cout << "Yes" << endl;
    }
    return 0;
}


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

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

template<class T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
///////////////////////////////////////////////
/* (๑•﹏•๑) 🍈( '-'  🍈*/
int main(){
	string s;
	cin >> s;
	int N = s.length();
	vector<char> t;
	REP(i,N){
	    if (s[i] == 'B' and s[i+1] == 'C' and (i != N)){
	    	t.PB('X');
	    	i++;
	    }else{
			t.PB(s[i]);
	    }
	}


	int len = t.size();

	ll nowp = 0;
	ll ans = 0;

	REPr(i,len){
		if (t[i] != 'X' and t[i] != 'A'){
			nowp = 0;
			continue;
		}

		if (t[i] == 'X'){
			nowp++;
		}else if (t[i] == 'A'){
			ans += nowp;
		}

	}

	cout << ans << endl;
}

Measured memory_bytes: 772
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));

 		
int main() {

int A,B,K;
cin>>A>>B>>K;
bool taka=true;
while(K-->0){
	if(taka){
	if(A%2==1){
		A--;
	}
	A/=2;
	B+=A;
	}else{
		if(B%2==1){
			B--;
		}
		B/=2;
		A+=B;
	}
	taka=!taka;
}

cout<<A<<' '<<B<<endl;

}

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

    a = []
    for i in range(n):
        a.append([int(num) for num in input().split()])

    for i in range(n):
        sum = 0
        for j in range(n):
            sum += a[i][j]
        a[i].append(sum)


    a.append([])
    for i in range(n + 1):
        sum = 0
        for j in range(n):
            sum += a[j][i]
        a[n].append(sum)

    for i in range(n + 1):
        for j in range(n + 1):
            print('{0:>5}'.format(a[i][j]), end="")
        print()

Measured memory_bytes: 7720
#include "bits/stdc++.h"
using namespace std;

#define F(i, a, n) for(int i=a;i<n;i++)
#define REP(i, n) F(i, 0, n)
#define REP1(i, n) for(int i=1;i<=n;i++)
#define MOD 1000000007

typedef long long ll;

const int MAX = 2e6 + 5;

string a,b;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>a>>b;
	if(a.size() > b.size())
		cout<<"GREATER";
	else if(a.size() < b.size())
		cout<<"LESS";
	else{
		int i = 0;
		bool f = true;
		while(i < a.size()){
			if(int(a[i]) != int(b[i])){
				f = false;
				break;
			}
			i++;
		}
		if(f)
			cout<<"EQUAL";
		else{
			if(a[i] > b[i])
				cout<<"GREATER";
			else
				cout<<"LESS";
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        "\n"
#define fast        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int         long long int
#define mod         1000000007
#define test        int t;cin>>t;while(t--)
#define REP(i,a,b)  for(int i=a,i<=b;i++)
#define MAXN        200001

int32_t main()
{
	
	int n,l;
	cin>>n>>l;
	int arr[n+1];
	int sum=0;
	for(int i=1;i<=n;i++){
		arr[i]=l+i-1;
		sum+=arr[i];
	}

	int mx=INT_MAX;
	for(int i=1;i<=n;i++){
		mx=min(mx,abs(sum-(sum-arr[i])));
	}

	vi v;
	for(int i=1;i<=n;i++){
		if(abs(sum-(sum-arr[i]))==mx){
			v.pb(arr[i]);
		}
	}
	
	int val=*max_element(all(v));
	if(val < 0)
		cout<<sum - val<<endl;
	else
		cout<<sum - val<<endl;

	return 0;
}

Measured memory_bytes: 3616
a = 3.times.map { gets.chomp.split(" ").map(&:to_i) }
n = gets.to_i
b = n.times.map { gets.to_i }
if n < 3
  puts "No"
  exit
end
3.times { |i| 3.times { |j| a[i][j] = 0 if b.include? a[i][j] } }
3.times do |i|
  if [0, 0, 0] == a[i]
    puts "Yes"
    exit
  elsif [0, 0, 0] == a.map { |arr| arr[i] }
    puts "Yes"
    exit
  end
end
if [0, 0, 0] == [a[0][0], a[1][1], a[2][2]]
  puts "Yes"
  exit
elsif [0, 0, 0] == [a[2][0], a[1][1], a[0][2]]
  puts "Yes"
  exit
end
puts "No"

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

using namespace std;

int main(){
	int t;
	cin>>t;
	string a[t];
	int wa=0,ac=0,tle=0,re=0;
	for(int i=0;i<t;i++){
		cin>>a[i];
		if(a[i]=="WA"){
			wa++;
		}
		if(a[i]=="AC"){
			ac++;
		}
		if(a[i]=="TLE"){
			tle++;
		}
		if(a[i]=="RE"){
			re++;
		}
	}
	cout<<"AC x "<<ac<<endl;
	cout<<"WA x "<<wa<<endl;
	cout<<"TLE x "<<tle<<endl;
	cout<<"RE x "<<re<<endl;
}



Measured memory_bytes: 6748
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>

using namespace std;
typedef long long ll;

const ll mod = 1000000007;

int main()
{
	ll N;
	ll A[300001];
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	
	static ll Sum[300001][60];
	for(int i = 0; i < 60; i++){
		Sum[N][i] = 0;
	}
	for(int i = N-1; i >= 0; i--){
		for(int j = 0; j < 60; j++){
			Sum[i][j] = Sum[i+1][j] + ((A[i] >> j) & 1);
		}
	}
	
	ll ans = 0;
	for(ll i = 0; i < N-1; i++){
		for(ll j = 0; j < 60; j++){
			if(((A[i] >> j) & 1)){
				ans += (N-1-i-Sum[i+1][j]) * ((1ll << j) % mod);
				ans %= mod;
			}else{
				ans += Sum[i+1][j] * ((1ll << j) % mod);
				ans %= mod;
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 143232
#include <bits/stdc++.h>
#include <unistd.h>
#include <random>
#include <numeric>

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end())
#define DOUBLECHANGE(count) cout << setprecision(count)
#define REV(vec) reverse(vec.begin(),vec.end())
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

long long int lcm(long long int A, long long int B){
    long long int X = A*B;
    if(A<B){
        swap(A,B);
    }
    long long int r = A % B;
      while(r!=0){
        A = B;
        B = r;
        r = A % B;
    }
    return X/B;
}

long long int target(long long int A, long long int B, long long int C){
    if((B-A+1)%C == 0){
        return (B-A+1)/C;
    }
    if((C-(A % C))%C + B % C >= (B-A+1)%C){
        return (B-A+1)/C;
    }
    else{
        return (B-A+1)/C+1;
    }
}

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
      cin.tie(0);
      ios::sync_with_stdio(false);
      long long int A, B, C, D;
      cin >> A >> B >> C >> D;
//      cout << target(A,B,C) << " " << target(A,B,D) << " " << target(A,B,lcm(C,D)) << "(" << lcm(C,D) << ")" << endl;
      cout << (B-A+1) - target(A,B,C) - target(A,B,D) + target(A,B,lcm(C,D)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define FI(i, a, b) for (int i = (a); i <= (b); ++i)
#define FD(i, b, a) for (int i = (b); i >= (a); --i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;

int main() {
  LL ans = 0;
  string s;
  cin >> s;
  int cnt = 0, state = 0;
  for (auto c : s) {
    if (c == 'A') {
      if (state == 0)
        state = 1, cnt = 1;
      else if (state == 1)
        cnt++;
      else
        state = 1, cnt = 1;
    } else if (c == 'B') {
      if (state == 0)
        state = 0;
      else if (state == 1)
        state = 2;
      else
        state = 0;
    } else if (c == 'C') {
      if (state == 2) {
        ans += cnt;
        state = 1;
      } else
        state = 0;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>

int main(void)
{
  long int i, n, k, min = 0, max = 0, sum = 0, result = 0;
  
  scanf("%ld %ld", &n, &k);
  
  for( i = 0; i <= n; i++ ){
      min += i;
      max += n-i;
      
      if( i >= k-1 ){
        sum += ( max - min + 1 );
      }
  }

  result = sum % 1000000007;
  printf("%ld\n", result);
  
  return 0;
}

Measured memory_bytes: 1732
N,L = map(int, input().split())
l = [0 for i in range(N)]
tmp = 150
memo = 150
for i in range(N):
    l[i] = L + i
    if abs(l[i]) < tmp:
        tmp = abs(l[i])
        memo = l[i]
print(sum(l) - memo)

Measured memory_bytes: 3060
import java.util.Scanner;


class Main {

	public static void main(String[] args) {
	
		Scanner sc = new Scanner(System.in);
		
		double r = sc.nextDouble();
		
		double s = r * r * Math.PI;
		double t = 2 * r * Math.PI;
		
		String S = String.format("%.6f",s);
		String T = String.format("%.6f",t);
		
		System.out.println(S + " " + T);
		
	}

}

Measured memory_bytes: 28280
#include <iostream>
using namespace std;
int main(){

	long long int n, x, y, p, b, i;
	y = 0;
	b = -1000001;
	p = 1000001;
	cin >> n;
	for (x = 0; x < n; x++){
	cin >> i;

	y = y + i;
	if (b < i){
		b = i;
	}

	if (p > i){
		p = i;

	}
}
     cout << p  << " "<< b  << " "<<  y << endl;

	return 0;
}

Measured memory_bytes: 3096
#include<iostream>
using namespace std;
int main() {
	int A, B, C, D, P, X, Y;
	cin >> A >> B >> C >> D >> P;
	X = A*P;
	Y = (P <= C) ? B : (P - C)*D+B;
	cout << ((X < Y) ? X : Y) << endl;
	return 0;
}

Measured memory_bytes: 3048
def main():
    n = int(input())
    money = [6 ** i for i in range(7)] + [9 ** i for i in range(1, 6)]
    dp = [0] * (n + 1)
    for i in range(1, n + 1):
        dp[i] = min(dp[i - j] + 1 for j in money if i - j >= 0)
    print(dp[n])

if __name__ == '__main__':
    main()

Measured memory_bytes: 3828
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      String S =sc.nextLine();

      char c;
      char[] data  = new char[S.length()];
      int count  = 0;

      for(int i = 0;i<S.length();i++){
        c = S.charAt(i);
        data[i] = c;
      }
      for(int i =0;i<4;i++){
        for(int j = i+1;j<4;j++){
          if(data[i]==data[j]){
            count++;
          }
        }
      }
      if(count==2){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }


  }
}

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

int main()
{
  int n;
  cin >> n;
  vector<string> vs1(n);
  int ans = 0;
  for (int i = 0; i < n; i++)
  {
    cin >> vs1.at(i);
  }
  int m;
  cin >> m;
  vector<string> vs2(m);
  for (int i = 0; i < m; i++)
  {
    cin >> vs2.at(i);
  }
  for (int i = 0; i < n; i++)
  {
    int counter = 0;
    for (int j = 0; j < n; j++)
    {
      if(vs1.at(i) == vs1.at(j)) counter++;
    }
    for (int k = 0; k < m; k++)
    {
      if(vs1.at(i) == vs2.at(k)) counter--;
    }
    ans = max(ans, counter);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
int n,top,low,temp;
long long int tot;
scanf("%d%d",&n,&low);
tot=top=low;
for(int i=1;i<n;i++){
scanf("%d",&temp);
if(temp>top)top=temp;
if(temp<low)low=temp;
tot+=temp;
}
printf("%d %d %lld\n",low,top,tot);
}

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

int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
}
ll mx=0;
rep(i,n){
  if(a[i]>mx+1){
    ans+=(a[i]-1)/(mx+1);
    if(mx==0)mx=1;
  }
  else if(a[i]>mx)mx=a[i];
}
cout << ans << endl;
return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int n, ans = 0;
vector<ll> v;

void dfs(ll N) {
    if (N > n) return;

    bool s = false, f = false, t = false;
    for (ll i = N; i > 0; i /= 10) {
        if (i % 10 == 7) s = true;
        if (i % 10 == 5) f = true;
        if (i % 10 == 3) t = true;

        if (s && f && t) {v.push_back(N); break;}
    }

    dfs(N * 10 + 3);
    dfs(N * 10 + 5);
    dfs(N * 10 + 7);
}

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    cin >> n;
    dfs(0);
    // for (auto it : v) cout << it << endl;
    cout << v.size() << endl;
    return 0;
}

Measured memory_bytes: 640
h, w = gets.split.map(&:to_i)
a = Array.new(h+2)
a[0] = a[-1] = ?. * (w+2)
(1..h).each{|y| a[y] = ?. + gets.chomp + ?.}
(1..h).each{|y|
  (1..w).each{|x|
    a[y][x] = (y-1..y+1).map{|yy| (x-1..x+1).count{|xx| a[yy][xx]==?#}}.reduce(:+).to_s if a[y][x]==?.
  }
}
(1..h).each{|y| puts a[y][1..w]}

Measured memory_bytes: 1788
N = int(input())
A = sorted(list(map(int,input().split())))
ans = A[0]
if ans == 0:
    print(ans)
    exit()
else:
    for i in range(1,N):
        ans = ans * A[i]
        if ans > 10**18:
            ans = -1
            break
    print(ans)

Measured memory_bytes: 21656
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<list>
#include<list>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<algorithm>
#include<functional>
#include<deque>
#include<string.h>
#include<ctype.h>
using namespace std;
#define INF 1000000

int main(){
  int n;
  cin >> n;
  char s[n+1];
  s[0] = 'A';
  for (int i = 1; i <= n; i++){
    cin >> s[i];
  }

  int w = 0, e = 0;
  int tmp = INF;
  for (int i = 2; i <= n; i++){
    if (s[i] == 'E') e++;
  }
  tmp = e;
  for (int i = 2; i <= n; i++){
    if (s[i-1] == 'W') w += 1;
    if (s[i] == 'E')   e -= 1;
    if (tmp > e+w) tmp = e+w;
  }

  cout << tmp << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#define fi first
#define se second
using namespace std;
short n,a[8];
typedef pair<int,int> td;
td b[8];
double ans;
double kc(td u,td v){
    int64_t x=u.fi-v.fi,y=u.se-v.se;
    x*=x,y*=y;
    return sqrt(x+y);
}
int main(){
    scanf("%hd",&n);
    for (short i=0;i<n;++i){
        scanf("%d%d",&b[i].fi,&b[i].se);
        a[i]=i;
    }
    do{
        for (short i=1;i<n;++i)
            ans+=kc(b[a[i-1]],b[a[i]]);
    }while(next_permutation(a,a+n));
    for (short i=2;i<=n;++i)
        ans/=i;
    printf("%.10f",ans);
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int N;
    string S;
    cin>>N>>S;
    for(int i=0;i<S.size();i++){
        S[i]+=N;
        if(S[i]>'Z')S[i]-=26;
    }
    cout<<S<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include<stdlib.h>
#include<cmath>
#include<list>
#define ll long long int
#define lll unsigned long long
using namespace std;
ll a[100005]={0};
void xx(ll n,ll m)
{
    if(n*2+1>=m)
    {
        return;
    }
    if(n*2+2>=m)
    {
        if(a[n*2+1]>a[n])
        {
            ll k;
            k=a[n*2+1];a[n*2+1]=a[n];a[n]=k;
        }
        return;
    }
    if(a[n]>=a[n*2+1]&&a[n]>=a[n*2+2])
    {
        return;
    }
    else
    {
        if(a[n*2+1]>a[n*2+2])
        {
            ll k;
            k=a[n*2+1];a[n*2+1]=a[n];a[n]=k;
            xx(n*2+1,m);
        }
        else
        {
            ll k;
            k=a[n*2+2];a[n*2+2]=a[n];a[n]=k;
            xx(n*2+2,m);
        }
    }
}
void qq(ll n)
{
    ll k=n/2-1;
    while(k>=0)
    {
        xx(k,n);
        k--;
    }
}
int main()
{ll z=0,m,n,k=0;
scanf("%lld%lld",&m,&n);
while(k<m)
{
    scanf("%lld",&a[k]);
    k++;
}
qq(m);
k=0;
while(k<n)
{
    a[0]/=2;
    xx(0,m);
    k++;
}
k=0;
while(k<m)
{
   z+=a[k];
   k++;
}
printf("%lld\n",z);
return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int n, q, li, ri;
    int cnt = 0;
    string inputString;
    scanf("%d %d\n", &n, &q);
    cin >> inputString;
    int cntAC[n];
    int flag = 0;
    for (int i = 0; i < n; i++)
    {
        if (inputString[i] == 'A')
        {
            flag = 1;
        }
        if (inputString[i] == 'C' && flag == 1)
        {
            cnt += 1;
        }
        if (inputString[i] != 'A')
        {
            flag = 0;
        }
        cntAC[i] = cnt;
    }

    for (int i = 0; i < q; i++)
    {
        scanf("%d %d", &li, &ri);
        printf("%d\n", cntAC[ri - 1] - cntAC[li - 1]);
    }
    return 0;
}

Measured memory_bytes: 1472
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
 
struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;
 
template<typename T1,typename T2>
ostream &operator<<(ostream &os,const pair<T1,T2>&p){
    os<<p.first<<" "<<p.second;
    return os;
}
 
template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" ");
    return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is,pair<T1,T2>&p){
    is>>p.first>>p.second;
    return is;
}

template<typename T>
istream &operator>>(istream &is,vector<T>&v){
    for(T &x:v)is>>x;
    return is;
}

void exp(){
    int n;cin>>n;
    vector<int> v(n);
    cin>>v;
    vector<int> s;
    for(int bit=1;bit<(1<<n);bit++){
        int res=0;
        rep(i,n)if((bit>>i)&1)res+=v[i];
        s.push_back(res);
    }
    sort(ALL(s));
    debug(s);
    cout<<s[(1<<(n-1))-1]<<endl;

    map<int,int> cnt;
    for(auto x:s)cnt[x]++;
    for(auto p:cnt)cout<<p.first<<" : "<<p.second<<endl;
}

const int M=4000010;

signed main(){
    int n;cin>>n;
    vector<int> a(n);
    cin>>a;
    int s=0;
    rep(i,n)s+=a[i];
    bitset<M> bs;
    bs[0]=1;
    rep(i,n)bs|=(bs<<a[i]);
    for(int i=(s+1)/2;i<M;i++)if(bs[i]){
        cout<<i<<endl;
        return 0;
    }
}

/*
4
1 1 3 6
Σa=11
空集合も許容すると
S={0,1,1,2,3,4,4,5,6,7,7,8,9,10,10,11}
0  1  1  2 3 4 4 5
11 10 10 9 8 7 7 6
答えは，Σa/2以上で存在する最も小さな値
DPをbitset高速化
*/

Measured memory_bytes: 5128
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}
template<typename T>vector<T> & cset(vector<T> &A,T e=T()){for(auto &I:A){I=e;} return A;}

const int MX=2000;

bitset<MX> A[MX];
bitset<MX> dp[MX];

int main(){
    int n;
    cin>>n;
    char c;
    for(int i=0;i<n;i++){
        dp[i][i]=true;
        for(int j=0;j<i;j++){
            scanf(" %c",&c);
            if(c=='1'){A[i][j]=true;}
            A[j][i]=!A[i][j];
        }
    }
    for(int i=1;i<n;i++){
        for(int j=0;i+j<n;j++){
            int R=i+j;
            int l=j+1;
            dp[R][j]=(A[j]&dp[l]&dp[R]).any();
        }
        for(int j=i;j<n;j++){
            int R=j-i;
            int l=j-1;
            dp[R][j]=(A[j]&dp[l]&dp[R]).any();
        }
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        if(dp[0][i] && dp[n-1][i]){ans++;}
    }
    cout<<ans<<endl;
    
    
    
    return 0;
}


Measured memory_bytes: 1280