akhauriyash/Code-Regression huggingface dataset:
using System;

namespace aizu
{
    class OnlineJudge
    {
        static readonly int Money = 1000;
        static readonly int[] Coin = { 500, 100, 50, 10, 5, 1 };
        static void Main()
        {
            int input;
            while((input = int.Parse(Console.ReadLine())) != 0) {
                int change = Money - input;
                int count = 0;
                for(int i=0; i < Coin.Length; ++i) {
                    while(change >= Coin[i]) {
                        change -= Coin[i];
                        ++count;
                    }
                }
                Console.WriteLine(count);
            }
        }
    }
}

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

using namespace std;

int main() {
    string str;
    cin >> str;
    str += "R";
    int count = 0;
    int arr[str.size()] = {0};
    for (int i = 0; i < str.size(); i++) {
        if (str[i] == 'L') {
            count = 0;
            for (int j = i; j < str.size(); j++) {
                if (str[j] == 'R') {
                    arr[i] = count;
                    i = j - 1;
                    break;
                }
                count++;
            }
        } else {
            count = 0;
            for (int j = i; j < str.size(); j++) {
                if (str[j] == 'L') {
                    i = j - 1;
                    arr[i] = count;
                    break;
                }
                count++;
            }
        }
    }
    for (int i = 0; i < str.size() - 2; i++) {
        if (arr[i] != 0 && arr[i + 1] != 0) {
            if (arr[i] % 2 == arr[i + 1] % 2) {
                arr[i] = (arr[i] + arr[i + 1]) / 2;
                arr[i + 1] = arr[i];
            } else if (arr[i] % 2 != 0 && arr[i + 1] % 2 == 0) {
                arr[i + 1] = (arr[i] + arr[i + 1]) / 2;
                arr[i] = arr[i + 1] + 1;
            } else if (arr[i] % 2 == 0 && arr[i + 1] % 2 != 0) {
                arr[i] = (arr[i] + arr[i + 1]) / 2;
                arr[i + 1] = arr[i] + 1;
            }
            i++;
        }
    }
    for (int i = 0; i < str.size() - 1; i++) cout << arr[i] << " ";
    return 0;
}

Measured memory_bytes: 1024
/*
	 
	                              Jai Shree Krishna !!
	                                 Radhe Radhe !!
	                                 
	             उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।।
	             
	*/
	   
	   
	#include <bits/stdc++.h>
	using namespace std;
	 
	#define int long long
	typedef long long ll;
	#define loop(i,n)  for(int i=0;i<n;i++)
	#define read(a) int a; cin >>a;
	#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
	#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> a[i][j];
	#define pb push_back
	#define ff first
	#define ss second
	#define vi vector<int>
	#define pi pair<int,int>
	#define vvi vector<vector<int>>
	#define sti set<int>
	#define vpi vector<pair<int,int>>
	#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
	#define printmat(a,n,m) for(int i=0;i<n;i++) {for(int j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
	#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
	#define endl "\n"
	#define mp make_pair
	#define ins insert
	#define rep(i,s,e)   for(int i=s;i<=e;i++)
	#define repd(i,s,e)  for(int i=e;i>=s;i--)
	#define vb vector<bool>
	#define read2(n,m) int n,m; cin >> n >> m;
	#define range(v) v.begin(),v.end()
	#define sortd(v) sort(v.begin(),v.end(),greater<int>())
	#define sorti(v) sort(v.begin(),v.end())
	 
	const ll inf = 1e18;
	const ll mod = 1e9 + 7;



	signed main()
	{
	 
	    fast;
		read(n);
		
		map<string,int> m ;
	    rep(i,0,n-1){
	    	string s ; 
	    	cin >> s;
	    	m[s]++;
	    }
	    
	    cout<<"AC x "<<m["AC"]<<endl;
	    cout<<"WA x "<<m["WA"]<<endl;
	    cout<<"TLE x "<<m["TLE"]<<endl;
	    cout<<"RE x "<<m["RE"]<<endl;
	    return 0;
	}
	 
	/* Pooja Yadav */

Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;



int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(b/a>c) out(c);
    else out(b/a);
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

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

func init() {
	sc.Split(bufio.ScanWords)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func lcs(a, b string) int {
	lenA := len(a)
	lenB := len(b)
	dp := make([][]int, lenA+1)
	for i := range dp {
		dp[i] = make([]int, lenB+1)
	}

	for i := 1; i <= lenA; i++ {
		for j := 1; j <= lenB; j++ {
			if a[i-1] == b[j-1] {
				dp[i][j] = dp[i-1][j-1] + 1
			} else {
				dp[i][j] = max(dp[i][j-1], dp[i-1][j])
			}
		}
	}
	return dp[lenA][lenB]
}

func main() {
	n := scanInt()
	w := bufio.NewWriter(os.Stdout)
	for i := 0; i < n; i++ {
		a := scanString()
		b := scanString()
		fmt.Fprintln(w, lcs(a, b))
	}
	w.Flush()
}



Measured memory_bytes: 18940
#include<iostream>
#include<vector>
#include<map>
#include<string>
using namespace std;

int main() {
	int data_sets_num = 0;		//??\???????????????????????????????????°
	std::vector<string> result;
	
	cin >> data_sets_num;
	for (int i = 0; i < data_sets_num; i++) {
		int first, second, third;

		cin >> first >> second >> third;
		if (
			(first * first == second * second + third * third) ||
			(second * second == first * first + third * third) ||
			(third * third == second * second + first * first)
			) {
			result.push_back("YES");
		}
		else {
			result.push_back("NO");
		}
	}

	for (unsigned int j = 0; j < result.size(); j++) {
		cout << result[j] << endl;
	}

	return 0;
}

Measured memory_bytes: 3212
# -*- coding: utf-8 -*-
import sys
import numpy as np
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,X,Y=map(int,input().split())
    X-=1
    Y-=1
    ans=[0]*N
    for i in range(N-1):
        for j in range(i+1,N):
            ans[min(j-i,abs(X-i)+1+abs(Y-j),abs(X-j)+1+abs(Y-i))]+=1
    for row in ans[1:]:
        print(row)

if __name__ == '__main__':
    main()


Measured memory_bytes: 12720
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	    int N = sc.nextInt();
	    int M = sc.nextInt();
	    
	    int [] A = new int [N];
	    int [] B = new int [N];
	    
	    for (int i=0; i<N; i++){
	    	A[i]=sc.nextInt();
	    	B[i]=sc.nextInt();
	    }
	    
	    int [] C = new int [M];
	    int [] D = new int [M];
	    
	    for (int i=0; i<M; i++){
	    	C[i]=sc.nextInt();
	    	D[i]=sc.nextInt();
	    }
	    
	    for (int i=0; i<N; i++){
	    	int a = A[i];
	    	int b = B[i];
	    	int c = C[0];
	    	int d = D[0];
	    	
	    	int min = Math.abs(a-c)+Math.abs(b-d);
	    	int index = 1;
	    	
	    	for (int j=1; j<M; j++){
	    		c = C[j];
	    		d = D[j];
	    		int temp = Math.abs(a-c)+Math.abs(b-d);
	    		
	    		if (temp<min){
	    			index=j+1;
	    			min=temp;
	    		}
	    			
	    	}
	    	System.out.println(index);
	    }
	    sc.close();
	    
	    

	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>PP;
const ll MOD = 1000000007;
ll T[100005]={0};//階層
ll oya[100005]={0};//親
ll mai[100005]={0};//下の葉の数
ll used[100005]={0};//
priority_queue<ll,vector<ll>,greater<ll>>wgt;
vector<ll> V[200005];//隣接リスト
priority_queue<PP>Q;
priority_queue<PP>Q2;
ll ans[100005]={0};
void ki(int x){
  for(int j=0;j<V[x].size();j++){
    int now=V[x][j];
    if(used[now]==0){
      oya[now]=x;
      T[now]=T[x]+1;
      used[now]++;
      ki(now);
    }
  }
}
int main(){
  int n;
  cin>>n;
  for(int i=1;i<n;i++){
    int a,b;
    cin>>a>>b;
    V[a].push_back(b);
    V[b].push_back(a);
  }
  for(int i=1;i<=n;i++){
    ll c;cin>>c;wgt.push(c);
  }
  used[1]=1;
  ki(1);
  for(int i=2;i<=n;i++){
    Q.push(make_pair(T[i],i));
  }
  for(int i=2;i<=n;i++){//その頂点より下の頂点の数
    mai[oya[Q.top().second]]+=(mai[Q.top().second]+1);
    Q.pop();
  }
  for(int i=1;i<=n;i++){
    if(mai[i]==0)Q2.push(make_pair(174417441744,i));
    else Q2.push(make_pair(T[i],i));
  }
  ll sum=0;
  for(int i=1;i<=n-1;i++){
    ll r=wgt.top();wgt.pop();sum+=r;
    ans[Q2.top().second]=r;
    Q2.pop();
  }
  ll f=wgt.top();wgt.pop();
  ans[Q2.top().second]=f;
  Q2.pop();
  cout<<sum<<endl;
  for(int i=1;i<=n;i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
}


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

string a;
int main()
{
	cin >> a;
	if (a[0] == 'Y' && a[1] == 'A' && a[2] == 'K' && a[3] == 'I') cout << "Yes";
	else cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
	cout << fixed << setprecision(10);
	ll a,b,n;
	cin >> a >> b >> n;
	cout << ( a*( min(n,b-1)%b ) - a*( min(n,b-1)%b )%b ) / b << endl;
	return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define N 100005
using namespace std;
vector<int> G[N];
int n,a[N];
void dfs(int t,int fa)
{
	int i,j,u=0,v=0;
	for(i=0;i<G[t].size();i++)
		if(G[t][i]!=fa){
			dfs(G[t][i],t);
			v|=u&a[G[t][i]];
			u|=a[G[t][i]];
		  }
	v=(v<<1)|1;
	for(i=30;i>=0;i--)
		if((v>>i)&1)
			for(j=i;j<=30;j++)
				if((~u>>j)&1){
					a[t]=(u^(u&((1<<j)-1)))|(1<<j);
					return ;
				  }
}
int main()
{
	int i,x,y;
	scanf("%d",&n);
	for(i=1;i<n;i++){
		scanf("%d %d",&x,&y);
		G[x].push_back(y);
		G[y].push_back(x);
	  }
	dfs(1,0);
	for(i=30;i>=0;i--)
		if((a[1]>>i)&1){
			printf("%d",i);
			return 0;
		  }
	return 0;
}


Measured memory_bytes: 11776
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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() {
    ll n,k;
    cin >> n >> k;
    map<ll,ll> m;
    vector<ll> counter(n+1,0);
    rep(i,n){
        ll in;
        cin >> in;
        counter[in]++;
        m[in]++;
    }
    if(m.size() <= k){
        cout << 0 << endl;
        return 0;
    }
    sort(counter.begin(),counter.end(),greater<int>());
    ll ans = 0;
    for(int i = k;i<n;i++)ans += counter[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 14336
#include<vector>
#include<algorithm>
#include<math.h>
//#define DEBUG

using namespace std;
#define foreach(i, c) for(__typeof(c.begin()) i = c.begin(); i != c.end(); i++)

int n; int hx, hy; int dx, dy;
typedef struct{
	double limit;
	int x;
	int y;
}Cs;
Cs cs[20];

double dist(int i, int a, int b){
	return sqrt((cs[i].x - a)*(cs[i].x - a) + (cs[i].y - b)*(cs[i].y - b));
}

bool solve(int cx, int cy, double t, vector<bool> f){
	bool r = false;
	bool tmp = true;
	for(int i = 0; i < n; i++){
		tmp = tmp && f[i];
	}
	if(tmp)return 1;
	vector<bool> fnext;
	for(int i = 0; i < n; i++){
		double d = dist(i, cx, cy);
		if(!f[i] && cs[i].limit <= t + d)return 0;
	}
	tmp = false;
	for(int i = 0; i < n; i++){
		//Ü¾ÆÁÄÈ¢©ÂÔàÉÆêéàÌª éÈçæé
		if(!f[i]){
			fnext = f;
			fnext[i] = true;
			r = r || solve(cs[i].x, cs[i].y, t+dist(i, cx, cy), fnext);
			// Á½Óç®
			tmp = true;
		}
	}
	//È¢ÈçTõI¹
	if(!tmp)return 0;
	return r;
}

int main(){
	while(cin>>n>>hx>>hy>>dx>>dy, n||hx||hy||dx||dy){
		vector<bool> flag(n);
		//flag.clear();
		for(int i = 0; i < n; i++)flag.push_back(false);
		bool failure = false;
		for(int i = 0; i < n; i++){
			int cx, cy;
			cin>>cx>>cy;
			cs[i].x = cx, cs[i].y = cy;
			int l, d;
			l = (cx - dx)*(cx - dx) + (cy - dy)*(cy - dy);
			d = (cx - hx)*(cx - hx) + (cy - hy)*(cy - hy);
			if(l <= d){
				failure = true;
			}
			cs[i].limit = sqrt(l);
		}
		if(failure){
			cout<<"NO"<<endl;
			continue;
		}
		#ifdef DEBUG
		for(int i = 0; i < n; i++)cout<<cs[i].limit<<endl;
		#endif
		
		//STõ
		failure = solve(hx, hy, 0, flag);
		cout<<(failure?"YES":"NO")<<endl;
		
		#ifdef DEBUG
		cout<<"."<<endl;
		#endif
	}
	return 0;
}

Measured memory_bytes: 912
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;

typedef long long ll;

int main() {
  int N,M; cin >> N >> M;
  int P[100000],Y[100000];
  vector<int> yd[100001];

  for ( int i = 0; i < M; i++ ) {
    cin >> P[i] >> Y[i];
    yd[P[i]].push_back(Y[i]);
  }
  for ( int i = 1; i <= N; i++ ) {
    for ( int j = 0; j < yd[i].size(); j++ ) {
      // cout << yd[i][j] << " ";
    }
    // cout << endl;
  }
  for ( int i = 1; i <= N; i++ ) sort(yd[i].begin(),yd[i].end());
  // cout << "After sort " << endl;
  for ( int i = 1; i <= N; i++ ) {
    for ( int j = 0; j < yd[i].size(); j++ ) {
      // cout <<"i " << i << " " <<  yd[i][j] << endl;
    }
  }

  for ( int i = 0; i < M; i++ ) {
    printf("%06d%06d\n",P[i],lower_bound(yd[P[i]].begin(),
				yd[P[i]].end(),Y[i])-yd[P[i]].begin()+1);
  }
  return 0;
}


Measured memory_bytes: 7808
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
    int d;
    cin>>d;
    cout<<"Christmas";
    for(int i=d;i<25;i++){
        cout<<" Eve";
    }
    cout<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
int main(){
  int n,d,num;
  std::cin>>n;
  int flag,B[100][100]={0};
  for(int i=0;i<n;i++){
    std::cin>>num>>d;
    for(int j=0;j<d;j++){
      std::cin>>flag;
      B[num-1][flag-1]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(j!=n-1){
	std::cout<<B[i][j]<<" ";
      }else{
	std::cout<<B[i][j]<<"\n";
      }
    }
  }
}
	


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

using namespace std;

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

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c, k;
	cin>>a>>b>>c>>k;
	int x=max(a, b);
	x=max(x, c);
	int y=x<<k;
	cout<<y+a+b+c-x<<'\n';
	return 0;
}


Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d %d %d %d", $in_a, $in_b, $in_h, $in_m);
$ans = 0.0;

$hx = $in_a * sin(deg2rad(($in_h + ($in_m / 60.0)) / 12.0) * 360);
$hy = $in_a * cos(deg2rad(($in_h + ($in_m / 60.0)) / 12.0) * 360);
$mx = $in_b * sin(deg2rad($in_m / 60.0) * 360);
$my = $in_b * cos(deg2rad($in_m / 60.0) * 360);

//var_dump($hx);
//var_dump($hy);
//var_dump($mx);
//var_dump($my);

$ans = sqrt(pow($hx - $mx , 2) + pow($hy - $my , 2));
//var_dump(pow($hx - $mx , 2));
//var_dump(pow($mx - $my , 2));

echo "$ans\n";


Measured memory_bytes: 16684
import collections
n,q = map(int,input().split())
item = []
for i in range(n):
    p,val = input().split()
    item.append([p,int(val)])
Queue = collections.deque([])
for i in range(n):
    Queue.append([item[i][0],item[i][1]])
time = 0
while Queue:
    name,val = Queue.popleft()
    if val>q:
        val -= q
        Queue.append([name,val])
        time += q
    else:
        time += val
        print(name,time)



Measured memory_bytes: 17796
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

int n;
vi h;

int ans;
int l,r;
signed main(){

    in(n);
    resz(n,h);
    in(h);

    while(true){
        l=-1;r=-1;
        bool f=true;
        for(auto e:h){
            if(e>0){
                f=false;
                break;
            }
        }
        if(f) break;

        rep(i,n){
            if(h[i]>0){
                l=i;
                break;
            }
        }
        REP(i,l,n){
            if(h[i]==0){
                r=i;
                break;
            }
        }
        if(r==-1) r=n;
        REP(i,l,r){
            h[i]--;
        }
        // show(ans,h);
        ans++;
    }

    out(ans);

    return 0;
}


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

#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;


int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0);
   int N;
   cin>>N;
   int A[100];
   for(int i=0;i<N;i++)cin>>A[i];
   int MAX = -1;
   int MIN = 1000000001;
   for(int i=0;i<N;i++){
      if(MAX < A[i])MAX = A[i];
      if(MIN > A[i])MIN = A[i];
   }
   cout<<MAX-MIN<<endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll, ll>;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18;
ll f(ll a, ll c, ll d) {
	ll p = a / c, q = a / d, r = a / (c / __gcd(c, d) * d);
	return a - (p + q - r);
}
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << f(b, c, d) - f(a - 1, c, d) << endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <string>

using namespace std;

vector<int> pn;

bool palid(int n) {
    ostringstream os;
    os << n;
    string s = os.str();
    string t = s;
    reverse(t.begin(), t.end());
    return s == t;
}

void init() {
    for (int i = 0; i <= 10000 *2; i++) {
        if (palid(i)) pn.push_back(i);
    }
}

int main() {
    init();
    int n;
    while (cin >> n) {
        vector<int>::iterator it = lower_bound(pn.begin(), pn.end(), n);
        int a = *(it-1), b = *it;
        if (abs(n - a) > abs(n - b)) {
            cout << b << endl;
        } else if (abs(n - a) < abs(n - b)) {
            cout << a << endl;
        } else {
            cout << min(a, b) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1248
#include <iostream>
#include <cstring>

using namespace std;

int main()
{
	char* A = new char[11];
	char* B = new char[11];;
	char* C = new char[11];;

	cin >> A;
	cin >> B;
	cin >> C;

	if (A[strlen(A) - 1] == B[0] &&
		B[strlen(B) - 1] == C[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

    return 0;
}



Measured memory_bytes: 256
import numpy as np
import sys

H, W = list(map(int, sys.stdin.readline().split()))
S = np.array([list(sys.stdin.readline().rstrip()) for _ in range(H)]) == '.'
ups = np.zeros((H, W), dtype=int)
downs = np.zeros((H, W), dtype=int)
rights = np.zeros((H, W), dtype=int)
lefts = np.zeros((H, W), dtype=int)

for h in range(1, H):
    ups[h] = (ups[h - 1] + 1) * S[h - 1]
    downs[H - h - 1] = (downs[H - h] + 1) * S[H - h]
for w in range(1, W):
    lefts[:, w] = (lefts[:, w - 1] + 1) * S[:, w - 1]
    rights[:, W - w - 1] = (rights[:, W - w] + 1) * S[:, W - w]
print(((ups + downs + lefts + rights) * S).max() + 1)


Measured memory_bytes: 219816
//AtCoder Beginner Contest 134 - C
#include<bits/stdc++.h>
#define ll long long
using namespace std;


int main(){
	int n;
	scanf("%d",&n);
	int a[n];
	int max1=0,max2=0;
	int m1;
	for (int i=0;i<n;i++){
		scanf("%d",&a[i]);
		if (a[i]>=max2){
			if (a[i]>max1){
			max1=a[i];
			m1=i;
			}else{
			max2=a[i];
		}
		}
		
		
	}
	for (int i=0;i<n;i++){
		if (i==m1){
			printf("%d\n",max2);
		}else{
			printf("%d\n",max1);
		}
	}
} 

Measured memory_bytes: 2432
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using p = pair<int, int>;
typedef vector<int> vi;
using Graph = vector<vector<int>>;

int main() {
  long long n, d;
  cin >> n >> d;

  int ans = 0;

  long long x[n][2];
  rep (i, n) {
    cin >> x[i][0] >> x[i][1];
    double dir = sqrt(x[i][0]*x[i][0] + x[i][1]*x[i][1]);
    if (d >= dir) ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6724
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int d,n;
    cin>>d>>n;
    if(d==0)
    {
            if(n<100) cout<<n<<endl;
            else if(n==100)cout<<101<<endl;

    }
    else
    {
        if(d==1)
        {
            if(n!=100)cout<<(n*100)<<endl;
             else if(n==100)cout<<10100<<endl;
        }
        else
        {
           if(n!=100)cout<<(n*10000)<<endl;
            else if(n==100)cout<<1010000<<endl;
        }
    }
    return 0;
}


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

using namespace std;

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

#define int ll

#define REP(i, n) for(int i = 0; i < (n); i++)
typedef int llint;
namespace FFT {
	const int MAX = 1 << 19;

	typedef llint value;
	typedef complex<double> comp;

	int N;
	comp omega[MAX];
	comp a1[MAX], a2[MAX];
	comp z1[MAX], z2[MAX];

	void fft(comp *a, comp *z, int m = N) {
		if (m == 1) {
			z[0] = a[0];
		} else {
			int s = N/m;
			m /= 2;

			fft(a, z, m);
			fft(a+s, z+m, m);

			REP(i, m) {
				comp c = omega[s*i] * z[m+i];
				z[m+i] = z[i] - c;
				z[i] += c;
			}
		}
	}

	void mult(value *a, value *b, value *c, int len) {
		N = 2*len;
		while (N & (N-1)) ++N;
		assert(N <= MAX);

		REP(i, N) a1[i] = 0;
		REP(i, N) a2[i] = 0;
		REP(i, len) a1[i] = a[i];
		REP(i, len) a2[i] = b[i];

		REP(i, N) omega[i] = polar(1.0, 2*M_PI/N*i);
		fft(a1, z1, N);
		fft(a2, z2, N);

		REP(i, N) omega[i] = comp(1, 0) / omega[i];
		REP(i, N) a1[i] = z1[i] * z2[i] / comp(N, 0);
		fft(a1, z1, N);

		REP(i, 2*len) c[i] = round(z1[i].real());
	}

	void mult_mod(int *a, int *b, int *c, int len, int mod) {
		static llint a0[MAX], a1[MAX];
		static llint b0[MAX], b1[MAX];
		static llint c0[MAX], c1[MAX], c2[MAX];

		REP(i, len) a0[i] = a[i] & 0xFFFF;
		REP(i, len) a1[i] = a[i] >> 16;

		REP(i, len) b0[i] = b[i] & 0xFFFF;
		REP(i, len) b1[i] = b[i] >> 16;

		FFT::mult(a0, b0, c0, len);
		FFT::mult(a1, b1, c2, len);

		REP(i, len) a0[i] += a1[i];
		REP(i, len) b0[i] += b1[i];
		FFT::mult(a0, b0, c1, len);
		REP(i, 2*len) c1[i] -= c0[i] + c2[i];

		REP(i, 2*len) c1[i] %= mod;
		REP(i, 2*len) c2[i] %= mod;
		REP(i, 2*len) c[i] = (c0[i] + ((long long) c1[i] << 16) + ((long long) c2[i] << 32)) % mod;
	}
}
#undef REP


const int MOD = 2e5+3, G = 2;

int inv_pw[MOD], pw[MOD], c[MOD], mul[2*MOD];

signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	int it=1, p=0, ans=0;
	do{
		inv_pw[it] = p ++;
		it = it * G % MOD;
	}while(it != 1);
	pw[0] = 1;
	for(int i=1 ; i<MOD ; i++)
		pw[i] = pw[i-1] * G % MOD;
	int n;cin >> n;
	for(int i=0 ; i<n ; i++){
		int d;cin >> d;
		ans -= d * d % MOD;
		if(d == 0)
			continue;
		c[ inv_pw[d] ] ++;
	}
	FFT::mult(c, c, mul, MOD);
	for(int i=0 ; i<2*MOD ; i++){
		int cur = i % (MOD-1);
		ans += mul[i] * pw[cur];
	}
	cout << ans/2 << "\n";
    return 0;
}

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

int main(){
    int a, b, c;

    cin >> a >> b >> c;

    if(a < b && a < c){
        if(b < c){
            cout << a << " " << b << " " << c << endl;
        }else{
            cout << a << " " << c << " " << b << endl;
        }
    }else if(b < a && b < c){
        if(a < c){
            cout << b << " " << a << " " << c << endl;
        }else{
            cout << b << " " << c << " " << a << endl;
        }
    }else{
        if(a < b){
            cout << c << " " << a << " " << b << endl;
        }else{
            cout << c << " " << b << " " << a << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3072
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <iterator>
#include <stack>
#include <list>
using namespace std;
const int INF=1000000000;
typedef long long int lli;
typedef pair<int,int> P;

P shop[3000];
int dp[3001][3001];

int main(){
	int n,t,s;
	cin >> n >> t >> s;
	for(int i=1; i<=n; ++i){
		int a,b;
		cin >> a >> b;
		shop[i].first=a;
		shop[i].second=b;
	}
	memset(dp,0,sizeof(dp));
	/*
	for(int i=0; i<=t; ++i){
		if(!(i-shop[1].second<s&&s<i)) dp[1][i]=shop[1].first;
	}
	*/
	int ans=0;
	for(int i=1; i<=n; ++i){
		for(int j=1; j<=t; ++j){
			dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			if(!(j-shop[i].second<s&&s<j)&&j-shop[i].second>=0) dp[i][j]=max(dp[i][j],dp[i-1][j-shop[i].second]+shop[i].first);
			ans=max(ans,dp[i][j]);
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 36380
#include<iostream>
#include<math.h>
using namespace std;

int main(){
  int q;
  int n;
  int count;
  int max;
  cin >> q;
  for(int i=0;i<q;i++){
    cin >> n;
    count=0;
    while(n/10>=1){
      count+=1;
      max=0;
      for(int j=1;j<6;j++){
	int t=pow(10,j);
	int tmp=(n/t)*(n%t);
	if(max<tmp) max=tmp;
      }
      n=max;
    }
    cout<<count<<endl;
  }
  return 0;
}
      

Measured memory_bytes: 3244
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<int,int>
#define maxn 100005
#define inf 3000005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;
int n,m,full;
int a[2005] , ma[10000];
int memo[2005][5000];
int dp(int item ,int mask)
{
	if(item==m)
	{
		if(mask == full) return 0;
		return inf;
	}
	if(memo[item][mask]!=-1) return memo[item][mask];
	int a1 = dp(item+1,mask);
	int a2 = dp(item+1,mask | ma[item]) + a[item];
	return memo[item][mask] = min(a1,a2);
}
signed main()
{
    fast;
    
    int i,j;
    cin>>n>>m;
    full = (1<<n) - 1;
    for(i=0;i<m;i++)
    {
    	int b;
    	cin>>a[i]>>b;
    	for(j=0;j<b;j++)
    	{
    		int x;
    		cin>>x;
    		x--;
    		ma[i] |= (1<<x);
    	}
    }
    memset(memo,-1,sizeof memo);
    int ans = dp(0,0);
    ans==inf ? cout<<"-1":cout<<ans; 
 
}

Measured memory_bytes: 39552
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int n, m;
vector<int> graph[100000];
vector<int> memo(100000, 0);
bool visited[100000];

int dfs( int target ){
	if( visited[target] ) return memo[target];
	visited[target] = true;
	if( graph[target].empty() ){
		return memo[target] = 0;
	}
	int len = -1;
	for( auto node : graph[target] ) len = max( len, dfs(node)+1 );
	return memo[target] = len;
}

int main(){
	cin >> n >> m;
	for( int i = 0; i < m; ++i ){
		int x, y; cin >> x >> y;
		--x; --y;
		graph[x].push_back(y);
	}
	int ans = -1;
	for( int i = 0; i < n; ++i ){
		ans = max( ans, dfs(i) );
	}
	cout << ans << endl;
	return 0;
}

// 10:41

Measured memory_bytes: 8192
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
    return result % M;
}

signed main()
{
    tezz

    int n,k;
    cin>>n>>k;
    vi v(n);
    for(int &x:v) cin>>x;
        sort(all(v));

    bool dp[k+1] = {false};

    for(int i=v[0];i<=k;i++){
        for(int x:v){
            if(x<=i){
                if(!dp[i-x]) dp[i] = true;
                else dp[i] = max(dp[i], false);
            }
        }
    }

    /*for(int i=0;i<=k;i++) cout<<dp[i]<<' ';
        cout<<endl;*/

    if(dp[k]) cout<<"First";
    else cout<<"Second";
}

Measured memory_bytes: 384
import java.util.Scanner;
class Main
{ 
   public static void main(String[] args)
      {

        
   Scanner sc = new Scanner(System.in);
    int n, m, l,i,j,k;
    n = sc.nextInt();
    m = sc.nextInt();
    l = sc.nextInt();
    int[][] a = new int[n][m];
    int[][] b = new int[m][l];
    long c ;

    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
        a[i][j]=sc.nextInt();
      }
    }
    for(j=0;j<m;j++){
      for(k=0;k<l;k++){
        b[j][k]=sc.nextInt();
      }
    }

    for(i=0;i<n;i++){
        for(j=0;j<l;j++){
            c=0;
            for(k=0;k<m;k++){
                c+=a[i][k]*b[k][j];
            }
        System.out.print(c);
        if(j==l-1)  System.out.println();
        else   System.out.print(" ");
        }
    }
    
}}




Measured memory_bytes: 53764
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
int cal(vector<int> arr, int k, int neg) {
    if (k > arr.size()+neg*2) {
        int acc = 0;
        for(int val: arr)
            if (val >= 0)
                acc += val;
        return acc;
    } else {
        vector<int> dp(arr.size()+1, 0);
        int acc = 0;
        for(int i = 0; i < arr.size(); i++)
            dp[i+1] = dp[i] + arr[i];
        multiset<int> s;
        for(int i = 0; i < min(k, int(arr.size())); i++) {
            if (arr[i] < 0) {
                s.insert(arr[i]);
            }
            int can_rmv = max(0, k - (i+1));
            int neg_acc = 0;
            for(auto val: s) {
                if (can_rmv > 0) {
                    neg_acc += val;
                    can_rmv --;
                } else {
                    break;
                }
            }
            acc = max(acc, dp[i+1]-neg_acc);
            // cout << "go here" << endl;
        }
        return acc;

    }
}
int main() {
    int n, k;
    cin >> n >> k;
    deque<int> dq(n, 0);
    for(int& val: dq)
        cin >> val;
    int ans = INT_MIN;
    for(int i = 0; i <= n; i++) { // O(N)
        vector<int> st1;
        vector<int> st2;
        int neg1 = 0, neg2 = 0;
        for(int j = 0; j < i; j++) {
            st1.push_back(dq[j]);
            neg1 += 1;
        }
        for(int j = n-1; j >= i; j--) {
            st2.push_back(dq[j]);
            neg2 += 1;
        }
        // O(K)
        for(int j = 0; j <= k; j++) {
            int tmp = cal(st1, j, neg1) + cal(st2, k-j, neg2);
            // printf("i = %d, k = (%d, %d), res = %d\n", i, j, k-j, tmp);
            ans = max(ans, tmp);

        }
    }
    cout << ans << endl;
    return 0;
}




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

ll H, N;
const int MAX_N = 1100;
ll A[MAX_N], B[MAX_N];
const int INF = 1.0e9;

int main() {
    cin >> H >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }

    ll dp[H+1];

    for (int i = 0; i <= H; i++) {
        dp[i] = INF;
    }
    dp[0] = 0;

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < H; j++) {
            int Hj = min(j + A[i], H);
            dp[Hj] = min(dp[Hj], dp[j] + B[i]);
        }
    }

    cout << dp[H] << endl;

    return 0;
}

Measured memory_bytes: 384
N = int(input())

can_list = [[0 for _ in range(10)] for _ in range(10)]

str_list = list(map(str, range(1, N+1)))

for n in range(N):
    idx = str(n + 1)[0] + str(n + 1)[-1]
    can_list[int(idx[0])][int(idx[1])] += 1

res = 0
for i in range(10):
    for j in range(10):
        res += can_list[i][j] * can_list[j][i]


print(res)


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

int main()
{
    int n, x, count = 0;
    int i, j;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%d", &x);
        if (x == 2) count++;
        else if (x % 2){
            for (j = 3; j < sqrt((double)x); j += 2){
                if (x % j == 0) break;
            }
            if (j > sqrt((double)x)) count++;
        }
    }
    printf("%d\n", count);
    
    return 0;
}

Measured memory_bytes: 2584
#include <iostream>
#include <cstring>

using namespace std;

const int N = 1e5;
int h[N], dp[N];

int main(int argc, char** argv)
{
#ifdef LOCAL
  freopen(strcat(argv[0], ".in"), "ab+", stdin);
#endif
  
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> h[i];
  
  fill(dp, dp + n, INT32_MAX);
  
  dp[0] = 0;
  dp[1] = abs(h[0] - h[1]);

  for (int i = 2; i < n; i++) {
    for (int j = 1; j <= min(i, k); j++) {
      dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
    }
  }

  cout << dp[n - 1] << endl;

  return 0;
}


Measured memory_bytes: 1024
n = int(input())
res = 0
ztfs = ["0", "3", "5", "7"]

for i1 in ztfs:
    for i2 in ztfs:
        for i3 in ztfs:
            for i4 in ztfs:
                for i5 in ztfs:
                    for i6 in ztfs:
                        for i7 in ztfs:
                            for i8 in ztfs:
                                for i9 in ztfs:
                                    num = i1+i2+i3+i4+i5+i6+i7+i8+i9
                                    if int(num) > n:
                                        print(res)
                                        exit()
                                    if "3" in num and "5" in num and "7" in num and (not "0" in str(int(num))):
                                        res += 1
print(res)

Measured memory_bytes: 3064
import java.util.*;
import java.util.function.*;
import java.lang.*;
import java.io.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt()-1;
        int B = sc.nextInt()-1;
        int[] ans = new int[N];
        for(int I=0; I<N; I++) for(int J=I+1; J<N; J++){
            int d = J-I;
            d = Math.min(d, Math.abs(I-A) + 1 + Math.abs(J-B));
            d = Math.min(d, Math.abs(I-B) + 1 + Math.abs(J-A));
            ans[d]++;
        }
        for(int d=1; d<N; d++) System.out.println(ans[d]);
    }
}


Measured memory_bytes: 37064
import numpy as np
import math
a,b,x=map(float,input().split())
if x==a*a*b:
    print(0)
    exit()
if x<=a*a*b/2:
    ans=x/a
else :
    ans=(a*a*b-x)/a
    b=ans*2.0/a
ans*=2.0
m=ans/b
ans=np.arctan2(b,m)
ans=ans/math.pi*180.0
print(ans)



Measured memory_bytes: 12508
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int P,Q,R;
  cin >> P >> Q >> R;
  int ans=P+Q;
  if(ans>(Q+R))
    ans=(Q+R);
  if(ans>(P+R))
    ans=(P+R);
  cout << ans << endl;
}


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

int main(){
    string s;
    cin >> s;
    int a = s[0] - '0';
    int b = s[1] - '0';
    int c = s[2] - '0';
    int d = s[3] - '0';
    if (a+b+c+d == 7) printf("%d+%d+%d+%d=7\n",a,b,c,d);
    else if (a+b+c-d == 7) printf("%d+%d+%d-%d=7\n",a,b,c,d);
    else if (a+b-c-d == 7) printf("%d+%d-%d-%d=7\n",a,b,c,d);
    else if (a-b-c-d == 7) printf("%d-%d-%d-%d=7\n",a,b,c,d);
    else if (a-b+c+d == 7) printf("%d-%d+%d+%d=7\n",a,b,c,d);
    else if (a-b-c+d == 7) printf("%d-%d-%d+%d=7\n",a,b,c,d);
    else if (a-b+c-d == 7) printf("%d-%d+%d-%d=7\n",a,b,c,d);
    else if (a+b-c+d == 7) printf("%d+%d-%d+%d=7\n",a,b,c,d);
    return 0;
}

Measured memory_bytes: 256
/*
  第4回ユニリタプログラミングコンテスト～練習サイト～
  C言語用
  ファイル名 qA.c
  作成者 228 金子幸裕 2017/06/14 9:30
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

int main( void )
{

    char sroot[1000];
    int ntmp;

    scanf( "%s" , sroot );
    
    if ( ( strchr(sroot, 'E') != NULL && strchr(sroot, 'W') == NULL ) ||
         ( strchr(sroot, 'W') != NULL && strchr(sroot, 'E') == NULL ) ||
         ( strchr(sroot, 'N') != NULL && strchr(sroot, 'S') == NULL ) ||
         ( strchr(sroot, 'S') != NULL && strchr(sroot, 'N') == NULL ) )
    {
        printf("No");
    }
    else
    {
        printf("Yes");
    }

    printf("\n");

    return ( 0 );

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  
  int a,b;//範囲
  cin >> a >> b;
  
  int m = 1,num=0;
  while(num <= b){
    if(num >= a && num <= b){
      cout << "OK" << endl;
      break;
    }    
    m++;
    num += n;
    
  }
  
  if(num > b){
      cout << "NG" << endl;
  }
  

}


Measured memory_bytes: 3636
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
typedef vector<int> vi;
// #define ll long long 
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=1e5+2;
int add(int a,int b)
{
      a+=b;
      if(a>=MOD) a-=MOD;
      return a;
}
int sub(int a,int b)
{
      a-=b;
      if(a<0) a+=MOD;
      return a;
}
int mul(int a,int b)
{     
      return ((long long)a*b)%MOD;
}
int rev(int a)
{
	return mpow(a,MOD-2);
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin>>n;
	int ans=1;
	int gcd=0;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	ans=1;
	map<int,int> ma;
	for(int i=0;i<n;i++)
	{
		int x=a[i];
		for(int j=2;j*j<=x;j++)
		{
			if(x%j) continue;
			int cnt=0;
			while(x%j==0) 
			{
				cnt++;
				x/=j;
			}
			int o=max(ma[j],cnt);
			ma[j]=o;
		}
		if(x>1)
		{
			int o=max(ma[x],1LL);
			ma[x]=o;	
		}
	}
	for(auto x:ma)
	{
		for(int j=0;j<x.se;j++)
		{
			ans=mul(ans,x.fi);
		}
	}
	// cout<<gcd;
	// cout<<ans<<" ";
	// cout<<ans;
	int an=0;
	for(int i=0;i<n;i++)
	{
		// cout<<mul(ans,rev(a[i]))<<" ";
		an=add(an,mul(ans,rev(a[i])));
	}
	cout<<an;
}
// I never lose. I either win or I learn

Measured memory_bytes: 1024
N = int(input())
A = [int(i) for i in input().split()]

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

a = A[0]
for i in range(1, N):
  a = gcd(a, A[i])
print(a)


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

#define ucin ios::sync_with_stdio(0), cin.tie(0)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
typedef pair<int, int> pii;
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;

const int N = 1e5 + 10;
const int mod = 1e9 + 7;

int qpow(int a, int b) {
	int ans = 1;
	for(; b >= 1; b >>= 1, a = (ll) a * a % mod)
		if(b & 1) ans = (ll) ans * a % mod;
	return ans;
}
int n, m, lim, sum[12][1010];
char s[12][1010];
int qry(int xl, int xr, int yl, int yr) {
	return sum[xr][yr] - sum[xl - 1][yr] - sum[xr][yl - 1] + sum[xl - 1][yl - 1];
}
int main() {
	scanf("%d%d%d", &n, &m, &lim);
	for(int i = 1; i <= n; i ++) {
		scanf("%s", s[i] + 1);
		for(int j = 1; j <= m; j ++)
			sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + (s[i][j] == '1');
	}
	int ans = n * m;
	for(int i = 0; i < (1 << (n - 1)); i ++) {
		int cur = __builtin_popcount(i), la = 0;
		bool fail = 0;
		for(int j = 1; j <= m; j ++) { //[j - 1, j]
			bool tag = 0; int p = 0;
			for(int k = 1; k <= n - 1; k ++) if(i >> (k - 1) & 1) {
				//[k, k + 1]
				if(qry(p + 1, k, la + 1, j) > lim) {
					if(la + 1 == j) { fail = 1; break ; }
					tag = 1;
				}
				p = k;
			}
			if(qry(p + 1, n, la + 1, j) > lim) {
				if(la + 1 == j) { fail = 1; break ; }
				tag = 1;
			}
			if(fail) break ;
			
			if(tag) { cur ++; la = j - 1; }
		}
		if(fail) continue ;
//		if(cur == 1) printf("!%d\n", i);
		ans = min(ans, cur);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
using ll = long long;
using namespace std;

const long long MOD = 1000000007;
const ll LINF = 1LL << 50;

int main() {

  int N, M;
  cin >> N >> M;
  vector<ll> dist(N,LINF);
  dist[0] = 0;

  vector<ll> a(M);
  vector<ll> b(M);
  vector<ll> c(M);

  REP(m,M){
    ll atmp, btmp, ctmp;
    vector<ll> vtmp(2);
    cin >> atmp >> btmp >> ctmp;
    atmp-=1, btmp-=1;
    ctmp = - ctmp;
    a[m] = atmp;
    b[m] = btmp;
    c[m] = ctmp;
  }


  REP(n,N){
    REP(m,M){
      ll atmp, btmp, ctmp;
      atmp = a[m];
      btmp = b[m];
      ctmp = c[m];
      if(dist[atmp] == LINF) continue;
      if (dist[btmp] > dist[atmp] + ctmp) dist[btmp] = dist[atmp] + ctmp;
    }
    
  }


  ll ans = dist[N-1];
  vector<bool> negative(N,false);

REP(n,N){
  REP(m,M){
    ll atmp, btmp, ctmp;
    atmp = a[m];
    btmp = b[m];
    ctmp = c[m];
    if (dist[atmp] == LINF) continue;

    if (dist[btmp] > dist[atmp] + ctmp){
      dist[btmp] = dist[atmp] + ctmp;
      negative[btmp] = true;
    }

    if (negative[atmp] == true) negative[btmp] = true;
  }
}

  if (negative[N-1]){
    cout << "inf" << endl;
  }else{
    cout << -ans << endl;
  }
}


Measured memory_bytes: 256
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	s := readString()
	re := regexp.MustCompile(`^A[a-z][a-z]*C[a-z]+$`)
	if re.MatchString(s) {
		println("AC")
	} else {
		println("WA")
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <string>

using std::string;

int main() {
    int n;
    string s;
    std::cin >> n >> s;
    int x = 0, y = 0;
    for (char c : s) {
        if ('A' <= c && c <= 'M') {
            ++x;
        } else if ('N' <= c && c <= 'Z') {
            --x;
        } else if ('a' <= c && c <= 'm') {
            ++y;
        } else {
            --y;
        }
    }

    std::cout << std::abs(x) + std::abs(y) << std::endl;
    while (x > 0) {
        std::cout << 'A';
        --x;
    }
    while (x < 0) {
        std::cout << 'N';
        ++x;
    }
    while (y > 0) {
        std::cout << 'a';
        --y;
    }
    while (y < 0) {
        std::cout << 'n';
        ++y;
    }
    std::cout << std::endl;
    return 0;
}



Measured memory_bytes: 3312