akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

int main(){
    string s;
    cin >> s;
    int n = s.length();
    if (s[n-1] != '0' || s[0] != '1'){
        cout << -1 << endl;
        return 0;
    }
    bool flag = false;
    REP(i, n/2){
        if(s[i] != s[n-2-i]){
            flag = true;
        }
    }

    if(flag){
        cout << -1 << endl;
        return 0;
    }

    s[n-1] = '1';
    vector<pii> res;
    int prev = 1;
    for(int i=2;i<=n;i++){
        if(s[i-1]=='1'){
            for(;prev<i;++prev){
                res.push_back(pii(i, prev));
            }
        }
    }
    for(auto p : res){
        cout << p.first << " " << p.second << endl;
    }
    return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 25;
const int MOD = 1e9+7;
char m[50][50]; 
int dist[100][100];
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main() {
	int h,w;
	cin >> h >> w;
	int numOfW = 0;
	rep(i,h) rep(j,w) {
		cin >> m[i][j];
		if (m[i][j] == '.') numOfW++;
	}

	rep(i,h) rep(j,w) dist[i][j] = -1;
	queue<P> q;
	q.push({0,0});
	dist[0][0] = 1;

	while (!q.empty())
	{
		P p = q.front(); q.pop();
		int x = p.first, y = p.second;
		rep(i,4) {
			int nx = x+dx[i], ny = y+dy[i];
			if (nx<0||nx>=h||nx<0||ny>=w) continue;
			if (m[nx][ny]=='#'||dist[nx][ny]!=-1) continue;
			dist[nx][ny] = dist[x][y] + 1;
			q.push({nx,ny});
		}
	}
	
	if (dist[h-1][w-1] == -1) cout << -1 << endl;
	else cout << numOfW - dist[h-1][w-1] << endl;
	


	return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cmath>
int n;
double x[1005], y[1005], X, Y, d, e;
double dist(double a, double b) {
	return a*a + b*b;
}
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lf%lf", &x[i], &y[i]);
		X += x[i]; Y += y[i];
	}
	X /= n; Y /= n;
	double P = 0.01;
	for (int i = 0; i < 30000; i++) {
		int f = 0;
		d = dist(X - x[0], Y - y[0]);
		for (int j = 1; j < n; j++) {
			e = dist(X - x[j], Y - y[j]);
			if (d < e) { d = e; f = j; }
		}
		X += (x[f] - X)*P;
		Y += (y[f] - Y)*P;
		P *= 0.999;
	}
	printf("%lf", sqrt(d));
}

Measured memory_bytes: 128
#include<stdio.h>

int main(){
    int P,Q,R;
    scanf("%d %d %d",&P,&Q,&R);
    int min=P+Q;
    if(Q+R<min)min=Q+R;
    if(R+P<min)min=R+P;
    printf("%d\n",min);
    
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

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

        int cnt = 0;
        for (int i = 2; i <= K; i += 2) {
            for (int j = 1; j <= K; j += 2) {
                cnt++;
            }
        }

        sc.close();

        System.out.println(cnt);
    }
}

Measured memory_bytes: 22740
#include <cstdio>
#define MAXN 105
char a[MAXN][MAXN];
int main() {
	int h, w;
	scanf("%d%d", &h, &w);
	for(int i = 1; i <= h; i++)
		scanf("%s", a[i]+1);
	h++, w++;
	for(int i = 0; i <= h; i++) {
		for(int j = 0; j <= w; j++) {
			if(i == 0 || j == 0 || i == h || j == w)
				printf("#");
			else 
				printf("%c", a[i][j]);
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=1e5;
const int inf=1e9;
int main(){
	int H,N;cin>>H>>N;
	int a; int sum=0;
	rep(i,0,N){
		cin>>a;
		sum+=a;
	}
	if(sum>=H) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);;

    public static void main(String[] args) {
        int X = sc.nextInt();
        int ans = X / 500 * 1000 + X % 500 / 5 * 5;
        System.out.println(ans);
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007

using namespace std;
typedef pair<llint, llint> P;

llint n, k;
vector<llint> G[100005];

const int FACT_MAX = 200005;
llint fact[FACT_MAX], fact_inv[FACT_MAX];

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

void make_fact()
{
	llint val = 1;
	fact[0] = 1;
	for(int i = 1; i < FACT_MAX; i++){
		val *= i;
		val %= mod;
		fact[i] = val;
	}
	fact_inv[FACT_MAX-1] = modpow(fact[FACT_MAX-1], mod-2);
	for(int i = FACT_MAX-2; i >= 0; i--){
		fact_inv[i] = fact_inv[i+1] * (i+1) % mod;
	}
}

llint comb(llint n, llint k)
{
	llint ret = 1;
	ret *= fact[n];
	ret *= fact_inv[k], ret %= mod;
	ret *= fact_inv[n-k], ret %= mod;
	return ret;
}

llint ans = 1;
void dfs(int v, int p)
{
	llint cnt = 0;
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == p) continue;
		cnt++;
		dfs(G[v][i], v);
	}
	llint rem = k-1;
	if(v != 1) rem--;
	if(cnt > rem) ans = 0;
	else{
		ans *= comb(rem, cnt) * fact[cnt] % mod, ans %= mod;
	}
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	make_fact();
	
	cin >> n >> k;
	llint u, v;
	for(int i = 1; i <= n-1; i++){
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	
	ans = k;
	dfs(1, -1);
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 13568
use std::io;

fn main(){
  let mut s = String::new();
  io::stdin().read_line(&mut s);
  let mut f = false;
  for c in s.chars() {
    if c == '7' {
      f = true;
    }
  }
  if f {
    println!("Yes");
  } else {
    println!("No")
  }
}

Measured memory_bytes: 2136
#include<bits/stdc++.h>
const int mo=1e9+7,N=6e5+5;
int n,m,L,R,fac[N],vf[N],inv[N],i;
inline int C(int x,int y){
	return 1ll*vf[y]*vf[x-y]%mo*fac[x]%mo;
}
inline int calc(int s){
	int i,j,ans=C(s+n,n),ss=0,x;
	for(i=0;i<=s;++i){
		int z=0;
		for(j=0;1ll*(i+1)*(j+n-m)<=s && j<=m;++j){
			x=1ll*C(s-(j+n-m)*(i+1)+n,n)*C(m,j)%mo;
			if(j&1)z=(z+mo-x)%mo;else z=(z+x)%mo;
		}
		for(j=0;1ll*(i+1)*(n-m)+i*j<=s && j<=m;++j){
			x=1ll*C(s-j*i-(n-m)*(i+1)+n,n)*C(m,j)%mo;
			if(j&1)z=(z+x)%mo;else z=(z+mo-x)%mo;
		}
		ss=(ss+z)%mo;
	}
	ans=(ans+mo-1ll*ss*C(n,m)%mo)%mo;
	return ans;
}
int main(){
	for(i=*fac=*vf=1;i<N;++i)
		fac[i]=1ll*fac[i-1]*i%mo,
		inv[i]=i==1?1:1ll*(mo-mo/i)*inv[mo%i]%mo,
		vf[i]=1ll*vf[i-1]*inv[i]%mo;
	scanf("%d%d%d%d",&n,&m,&L,&R);m=n-m;
	printf("%d\n",(calc(R)+mo-calc(L-1))%mo);
	return 0;
}

Measured memory_bytes: 7424
import java.util.*;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int count = 0;

    if (a == b || a < b) {
      count = a;
      System.out.println(count);
    } else {
      count = a-1;
      System.out.println(count);
    }
  }
}


Measured memory_bytes: 21844
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

    int N = s.size();

    int ans = 0;
    for(int i = 0; i < (N + 1) / 2; i++){
        if(s[i] != s[N - 1 - i]) ans++;
    }

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
int main()
{
    int AB, BC, CA;
    std::cin >> AB >> BC >> CA;

    int a = AB + BC;
    int b = BC + CA;
    int c = CA + AB;

    int ans = std::min({a, b, c});

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<(n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=201010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});}
};
vi A;
ll n,k;
ll ans=llINF;
void dfs(ll depth,ll bit){
  if(depth==n-1){
    ll now=A[0];
    if(BITCNT(bit) == k-1){
      ll sum=0;
      for(ll i=0;i<n-1;i++){
	now=max(A[i],now);
	if(bit & BITLE(i)){
	  if(now<A[i+1]){
	    now=A[i+1];
	  }else{
	    sum+=now+1-A[i+1];
	    now++;
	  }	 
	}
      }
      ans=min(ans,sum);
    }
    return;
  }
  dfs(depth+1,bit | BITLE(depth));
  dfs(depth+1,bit);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>k;
  A.resize(n);
  for(auto &a:A)cin>>a;
  dfs(0,0);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int n, a[112345], b[112345];
    cin >> n;
    REP(i, n + 1)
    cin >> a[i];
    REP(i, n)
    cin >> b[i];

    ll res = 0;
    REP(i, n)
    {
        int num = min(a[i], b[i]);
        a[i] -= num;
        b[i] -= num;
        num += min(a[i + 1], b[i]);
        a[i + 1] -= min(a[i + 1], b[i]);
        res += num;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define D(x) cout << #x << "=" << x <<endl; 
#define De(...)
using namespace std; 

int _; 

int k;

int main()
{
	scanf("%d",&k);
	int ans=k*360/__gcd(k,360);
	printf("%d\n",ans/k);
	return 0;
}

Measured memory_bytes: 3824
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int num = scanner.nextInt();
		int pointSum = 0;
		scanner.useDelimiter("[\r\n]+");
        scanner = new Scanner(new StringReader(scanner.next()));
        List<Integer> users = new ArrayList<>();
        while(scanner.hasNextInt()) {
        	int user = scanner.nextInt();
        	users.add(user);
        	pointSum += user;
        }
        int middle = pointSum / num;
        if((pointSum % num) > ((double)num / 2) ) {
        	middle++;
        }
        long sum = 0;
        for(Integer u : users) {
        	sum += Math.pow(u - middle, 2);
        }
		System.out.println(sum);
	}

}

Measured memory_bytes: 23636
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<vector>
#include<queue>
#include<stdio.h>
using namespace std;
 
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1<<25
 
int main()
{
	int n;
	cin >> n;
	int a[n + 1];
	rep(i, n) cin >> a[i];
	a[n] = 10001;
	int ans = 0;
	REP(i, 1, n) {
		if (a[i] == a[i - 1]) {
			a[i] = a[i] + a[i + 1];
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
cnt = 0
s = input()
S = [i for i in range(len(s))]
for i in range(len(s)):
  S[i] = int(s[i])
for i in range(0,len(S)-1,1):
  if S[i]==S[i+1]:
    cnt+=1
    if S[i+1]==0:
      S[i+1]=1
    else:
      S[i+1]=0
print(cnt)

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


int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    int max_v = 0;
    int max_i;
    rep(i,N){
        cin >> A[i];
        if(max_v<A[i]){
            max_v = A[i];
            max_i = i;
        }
    }
    sort(A.begin(),A.end());
    rep(i,N){
        if(i==max_i){
            cout << A[N-2] << endl;
        }else{
            cout << A[N-1] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 2432
package main

import (
	"fmt"
)

func main(){
	var a , b int
	kuku := false
	fmt.Scanf("%d", &a)
	for i:=1; i < 10; i++{
		if a % i == 0 {
			b = a / i
			if b < 10 && b > 0{
				kuku = true
				break
			}
		}
	}
	if kuku {
		fmt.Print("Yes")
	} else {
		fmt.Print("No")
	}
}

Measured memory_bytes: 512
def dfs(v, n, visited, g):
    if False not in visited:
        return 1

    result = 0

    for i in range(n):
        if not g[v][i]:
            continue
        if visited[i]:
            continue
        visited[i] = True
        result += dfs(i, n, visited, g)
        visited[i] = False

    return result


n, m = [int(i) for i in input().split()]
g = [[False] * n for i in range(n)]
for i in range(m):
    a, b = [int(i) for i in input().split()]
    g[a-1][b-1] = True
    g[b-1][a-1] = True

visited = [False] * n
visited[0] = True
print(dfs(0, n, visited, g))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fr(i,a,n) for(i=a;i<n;i++)
#define frn(i,a,n) for(i=a;i<=n;i++)
#define vll vector<ll>
#define pll pair<ll,ll>
#define vp vector<pll>
#define ub upper_bound
#define lb lower_bound
//#define map map<ll,ll>
#define mem(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(),v.end()
#define bs binary_search
#define qll queue<ll>
#define sll set<ll>
#define ma 500000
/*ll power(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return power(x*x,n/2);
    else                             //n is odd
        return x*power(x*x,(n-1)/2);
}*/

/*void decToBinary(ll n)
{
    string s;
int binaryNum[32];
int i = 0;
while (n > 0) {
binaryNum[i] = n % 2;
n = n / 2;
i++;
}
for (int j = i - 1; j >= 0; j--) {
 char c = binaryNum[j] +'0';
 s=s+c;
}
 
 //cout<<s<<endl;
 
 
 
 // for (int j = i - 1; j >= 0; j--)
 // cout<<s[j];
 
sort(s.begin(), s.end());
do {
cout << s << endl;
} while (next_permutation(s.begin(), s.end())); */
int highestPowerof2(int n)
{
   int p = (int)log2(n);
   return (int)pow(2, p);  
}
ll mindig(ll n){
ll x;
ll ans=mod;
 while(n>0)
        {
            x=n%10;
            ans=min(ans,x);
            n=n/10;
        }
        return ans;
}
ll maxdig(ll n)
{
    ll x;
    ll ans1=-1;
         while(n>0)
        {
            x=n%10;
            ans1=max(ans1,x);
            n=n/10;
        }
        return ans1;
}
 ll power(ll x, ll y, ll p)  
{  
    ll res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
 
int main()
{
    fastio;
    ld a,b;
    cin>>a>>b;
    ll ans=a*b;
    ll ans1= (long long)ans;
    cout<<ans<<endl;
}


Measured memory_bytes: 3764
yen_500 = int(input())
yen_100 = int(input())
yen_50 = int(input())
yen_x = int(input())
done_cnt = 0
for i in range(yen_500 + 1):
    for j in range(yen_100 + 1):
        for k in range(yen_50 + 1):
            if yen_x == 500 * (i) + 100 * (j) + 50 * (k):
                done_cnt += 1 
print(done_cnt)

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

using namespace std;

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

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

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

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

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

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int h, n;
  cin>>h>>n;
  REP(i, n){
    int a;
    cin>>a;
    h-=a;
  }
  cout<<(h<=0 ? "Yes" : "No")<<'\n';
  return 0;
}


Measured memory_bytes: 256
class Point:
    def __init__(self, x , y):
        self.x = x
        self.y = y
    def __sub__(self, p):
        x_sub = self.x - p.x
        y_sub = self.y - p.y
        return Point(x_sub, y_sub)

class Vector:
    def __init__(self, p):
        self.x = p.x
        self.y = p.y
        self.norm = (p.x ** 2 + p.y ** 2) ** 0.5

def cross(v1, v2):
    return v1.x * v2.y - v1.y * v2.x

def dot(v1, v2):
    return v1.x * v2.x + v1.y * v2.y

def ccw(p0, p1, p2):
    a = Vector(p1 - p0)
    b = Vector(p2 - p0)
    cross_ab = cross(a, b)
    if cross_ab > 0:
        return 1
    elif cross_ab < 0:
        return -1
    elif dot(a, b) < 0:
        return 1
    elif a.norm < b.norm:
        return -1
    else:
        return 0

def intersect(p1, p2, p3, p4):
    if (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0) and \
       (ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0):
        return True
    else:
        return False

def getDistanceSP(sp1, sp2, p):
    a = Vector(sp2 - sp1)
    b = Vector(p - sp1)
    if dot(a, b) < 0:
        return b.norm
    c = Vector(sp1 - sp2)
    d = Vector(p - sp2)
    if dot(c, d) < 0:
        return d.norm
    return abs(cross(a, b) / a.norm)

def getDistance(p1, p2, p3, p4):
    if intersect(p1, p2, p3, p4):
        print("0.00000000")
    else:
        d = min(getDistanceSP(p1, p2, p3), getDistanceSP(p1, p2, p4),
                getDistanceSP(p3, p4, p1), getDistanceSP(p3, p4, p2))
        print("{0:.10f}".format(d))


import sys

file_input = sys.stdin

sq = file_input.readline()

for line in file_input:
    x_p0, y_p0, x_p1, y_p1, x_p2, y_p2, x_p3, y_p3 = map(int, line.split())
    p0 = Point(x_p0, y_p0)
    p1 = Point(x_p1, y_p1)
    p2 = Point(x_p2, y_p2)
    p3 = Point(x_p3, y_p3)
    getDistance(p0, p1, p2, p3)

Measured memory_bytes: 8068
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    #n = int(stdin.readline().rstrip())
    n,x,t = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    a = math.ceil(n/x)
    print(a*t)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 9188
//import java.util.Random;
//import java.util.Scanner;public class Main {public static void main(String[]a){Random r=new Random();Scanner s=new Scanner(System.in);while(true){int p=Math.abs(r.nextInt())%100;int q=Math.abs(r.nextInt())%100;System.out.println(p+" * "+q+" = ");int o=0;while(o!=p*q)o=s.nextInt();}}}

import java.util.Scanner;
public class Main{
	public static void main(String[]args){
    	Scanner sc=new Scanner(System.in);
      int n=sc.nextInt();
      int[]h=new int[n];
      for(int i=0;i<n;i++)h[i]=sc.nextInt();
      int dp[]=new int[n+3];
      dp[1]=Math.abs(h[1]-h[0]);
      for(int i=0;i<n-2;i++){
    	  dp[i+2]=Math.min(dp[i+1]+Math.abs(h[i+2]-h[i+1]),dp[i]+Math.abs(h[i+2]-h[i]));		  
      }
     // for(int i=0;i<n;i++)System.out.println(dp[i]);
      //System.out.println();
      System.out.println(dp[n-1]);
      
      sc.close();
    }
  public static int min(int a,int b){return Math.min(a,b);}
}

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

    int i;
    int add = 0;
    for(i=0; i<3; i++)
    {
        if(S.at(i) == 'o')
        {
            add++;
        }
    }

    cout << 700 + (100 * add);

    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    string s;
    cin >> s;
    int n = s.size();
    int cnt = 0;
    for (int i = 0; i < n; i++)
    {
        if (i % 2 == 0 && s[i] == '0')
            cnt++;
        if (i % 2 && s[i] == '1')
            cnt++;
    }
    int ret = cnt;
    cnt = 0;
    for (int i = 0; i < n; i++)
    {
        if (i % 2 == 0 && s[i] == '1')
            cnt++;
        if (i % 2 && s[i] == '0')
            cnt++;
    }
    ret = min(ret, cnt);
    cout << ret << endl;
}


Measured memory_bytes: 512
import java.util.*;

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

    String n=sc.next();
    String a[]=n.split("");
    int count=0;

    for(int i=0;i<3;i++){
      if(a[i].equals(a[i+1])){
        count++;
      }else{
        if(count<=1){
          count=0;
        }
      }
    }

    if(count>=2){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }

	}
}


Measured memory_bytes: 21844
import java.util.*;
import java.math.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		long m=sc.nextLong();
		double[] a=new double[n];
		long[] sum=new long[n+1];
		for(int i=0; i<n; i++){
			a[i]=sc.nextDouble();
		}
		Arrays.sort(a);
		sum[n-1]=(long)a[n-1];
		for(int i=n-2; i>=0; i--){
			sum[i]=sum[i+1]+(long)a[i];
		}
		long left=0;
		long right=200001;
		while(right-left>1){
			long mid=(left+right)/2;
			long count=0;
			for(int i=0; i<n; i++){
				int index=-Arrays.binarySearch(a,mid-a[i]-0.5)-1;
				count+=n-index;
			}
			if(count>=m){
				left=mid;
			}else{
				right=mid;
			}
		}
		long ans=0;
		for(int i=0; i<n; i++){
			int index=-Arrays.binarySearch(a,left-a[i]+0.5)-1;
			m-=n-index;
			ans+=a[i]*(n-index)+sum[index];
		}
		System.out.println(ans+m*left);
	}
}


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

using namespace std;
using ll = long long;

const long long INF = 1LL << 60;


int main() {
    int n, k; cin >> n >> k;
    vector<ll> h(n);
    vector<ll> dp(n);

    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }

    fill(dp.begin(), dp.end(), INF);

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

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

Measured memory_bytes: 1792
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-9;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

char in1[1050];
char in2[1050];
bool chk[1050];
int main() {
	while (1) {
		scanf("%s", in1);
		if (in1[0] == '.') break;
		scanf("%s", in2);

		if (strcmp(in1, in2) == 0) {
			printf("IDENTICAL\n");
			continue;
		}

		int L1 = strlen(in1), L2 = strlen(in2);
		int c1 = 0, c2 = 0, i, prv = -1;
		for (i = 0; i < L1 && i < L2; i++) {
			if (in1[i] != in2[i]) break;
			if (in1[i] == '"') prv = i;
		}
		c1 = prv+1;
		if (i >= L1 || i >= L2) {
			printf("DIFFERENT\n");
			continue;
		}

		int c = 0;
		for (i = 0; i < c1; i++) if (in1[i] == '"') c++;
		if (c % 2 == 0) {
			printf("DIFFERENT\n");
			continue;
		}

		int p1 = 0, p2 = 0;
		for (p1 = c1; p1 < L1; p1++) if (in1[p1] == '"') break;
		for (p2 = c1; p2 < L2; p2++) if (in2[p2] == '"') break;

		if (p1 == L1 || p2 == L2 || L1-p1 != L2-p2) {
			printf("DIFFERENT\n");
			continue;
		}
		for (i = 1; i < L1 - p1; i++) if (in1[i + p1] != in2[i + p2]) break;
		if (i >= L1 - p1) printf("CLOSE\n");
		else printf("DIFFERENT\n");
	}
	return 0;
}

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

        signed main() {
        string s;
        cin>>s;
        while(s[s.size()-1]!='Z')s.pop_back();
        int i=0;while(s[i]!='A')i++;
        cout<<s.size()-i;
        }


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  int N;
  cin >> N;  
  vector<double> A(N);
  double bunbo=0;
  double kotae;

  for(int k=0;k<N;k++){
    cin >> A.at(k);
  }
  
  for(int k=0;k<N;k++){
    bunbo += 1/A.at(k);
  }
  
  kotae=1/bunbo;
  
  cout << kotae << endl;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define repll(i,n) for(ll i = 0; i < n; i++)
#define REPll(i,n) for(ll i = 1; i < n; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n") 
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, m, k;
  cin >> n >> m >> k;
  bool ans = false;
  rep(i,n+1){
    rep(j,m+1){
      int cnt = i*m + j*n - i*j*2;
      if(cnt == k) ans = true;
    }
  }
  YesorNo(ans);
}

Measured memory_bytes: 256
#include <stdio.h>

  int main(){

    int a,b;
    char op;
    int ans;

      while(1){
        scanf("%d %c %d",&a,&op,&b);

        if(op == '+'){
          ans = a+b;
        }
        else if(op == '-')ans = a - b;
        else if(op == '*')ans = a*b;
        else if(op == '/')ans = a/b;
        else break;

        printf("%d\n",ans);
    }
  }



Measured memory_bytes: 2096
n,m = map(int, input().split())

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

for i in range(1,n):
  if nums[i] == -1: nums[i] = 0

ans = ""
for i in nums:
  ans += str(i)
ans = int(ans)

if len(str(ans)) == n: print(ans)
else: print(-1)

Measured memory_bytes: 9244
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int gcd(int a,int b){
    int r;
    if(a<b) swap(a,b);
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int atcoder(){
    //入力
    int a,b,c;
    cin >> a >> b >> c;
    //処理
    //出力
    if(c%gcd(a,b) == 0) cout << "YES" << ENT;
    else cout << "NO" << ENT;
    return 0;
}

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


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n = int(input())
pl = list(map(int, input().split()))

m = []
mm = 10**8
for i in range(n):
    mm = min(mm,pl[i])
    m.append(mm)

res = 0
for i in range(n):
    if pl[i]==m[i]:
        res += 1

print(res)

Measured memory_bytes: 85456
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

typedef map<int, int> mii;

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

    int n, m;
    cin >> n >> m;
    int a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] /= 2;
    }

    int lp2;
    for (int i = 0; i < n; i++) {
        int p2 = 0;
        while (a[i] % 2 == 0) {
            a[i] /= 2;
            p2++;
        }

        if (i > 0 && p2 != lp2) {
            cout << 0 << endl;
            return 0;
        }

        lp2 = p2;
    }

    for (int i = 0; i < lp2; i++) {
        m /= 2;
    }

    mii cnt;
    for (int i = 0; i < n; i++) {
        for (auto j : cnt) {
            int p = 0;
            while (a[i] % j.first == 0) {
                a[i] /= j.first;
                p++;
            }
            if (p > j.second) {
                cnt[j.first] = p;
            }
        }

        for (int j = 2; j * j <= a[i]; j++) {
            if (a[i] % j == 0) {
                int p = 0;
                while (a[i] % j == 0) {
                    a[i] /= j;
                    p++;
                }
                cnt[j] = p;
            }
        }

        if (a[i] > 1) {
            cnt[a[i]] = 1;
        }

        if (cnt.size() > 10) {
            cout << 0 << endl;
            return 0;
        }
    }

    long long lcm = 1;
    for (auto p : cnt) {
        for (int j = 0; j < p.second; j++) {
            lcm *= p.first;
            if (lcm > m) {
                cout << 0 << endl;
                return 0;
            }
        }
    }

    cout << (m + lcm) / (2 * lcm) << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+5;
int A[N], NXT[N], PRV[N], n, t;
char s[N];
int main(){
    scanf("%s", s);
    n = strlen(s);
    for(int i=0;i<n;i++) A[i+1] = (s[i]=='T');
    A[0] = 1;
    n++;
    iota(NXT, NXT+n-1, 1);
    iota(PRV+1, PRV+n, 0);
    for(int i=0;;){
        if(!NXT[i]) break;
        if(!A[i] && A[NXT[i]]){
            int indp = PRV[i];
            int indn = NXT[NXT[i]];
            NXT[indp] = indn;
            PRV[indn] = indp;
            i = indp;
            continue;
        }
        i = NXT[i];
    }
    for(int i=0;;){
        t++;
        if(!NXT[i]) break;
        i = NXT[i];
    }
    printf("%d", t-1);
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
const ull MOD = 1000000007;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
int main(){
    ll x;
    cin>>x;
    
    ll t=0;
    for(ll i=1;true;++i){
        t+=i;
        if(t>=x){
            cout<<i;
            return 0;
        }
    }
    
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3636
object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  val s = sc.nextInt()
  val d = Array.fill(s)(sc.nextInt(), sc.nextInt())
  val ret = d.sliding(3).exists{
    l => l(0)._1 == l(0)._2 && l(1)._1 == l(1)._2 && l(2)._1 == l(2)._2
  }    
  println(if(ret) "Yes" else "No")
}


Measured memory_bytes: 58076
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>> A;

int main(){
    int n;cin >> n;
    A.assign(n,vector<int>(n));
    for(auto &i:A)for(auto &j:i) cin >> j;
    vector<int> imat(n);//今行き終わった頂点
    bool flag = true;
    imat[0] = 1;
    int ans = 0;
    while(flag){
        pair<int,int> pa(2001,-1);
        for(int now=0;now<n;now++){
            if(!imat[now]) continue;
            for(int to=0;to<n;to++){
                if(imat[to]) continue;
                if(A[now][to]==-1) continue;
                if(pa.first>A[now][to]){
                    pa.first = A[now][to];
                    pa.second = to;
                }
            }
        }
        imat[pa.second] = 1;
        ans+=pa.first;
        bool e = true;
        for(int i=0;i<n;i++){
            if(imat[i]==0){
                e = false;
                break;
            }
        }
        if(e) flag = false;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3168
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		    Scanner sc = new Scanner(System.in);
		    int n = sc.nextInt();
		    int ans = 0;
		    int[] a = new int[n];
		    for(int i=0;i<n;i++) {
		    	a[i] = sc.nextInt();
		    }
		    for(int i=0;i<n;i++) {
		    	ans += sc.nextInt();
		    }
		    int[] c = new int[n-1];
		    for(int i=0;i<n-1;i++) {
		    	c[i] = sc.nextInt();
		    }
		    for(int i=1;i<n;i++) {
		    	if(a[i]-a[i-1] == 1) {
		    		ans += c[a[i-1]-1];
		    	}
		    }
		    System.out.println(ans);

		    sc.close();
	}
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair<int, int> pii;  // pair<int, int> に pii という別名を付ける
typedef long long ll;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  if (N == M)  {
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  vector<pair<int,int>>sc(M);
  for(int i=0;i<M;i++)cin>>sc[i].first>>sc[i].second;
  for(int i=0;i<1000;i++){
    string s=to_string(i);
    bool f=s.size()==N;
    if(!f)continue;
    for(int j=0;j<M;j++){
      if(s[sc[j].first-1]-'0'!=sc[j].second){
        f=false;
        break;
      }
    }
    if(f){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
  return 0;
}


Measured memory_bytes: 256
n, l = map(int,input().split())
s = []
for i in range(n):
    s.append(input())
for i in range(len(s)-1):
    for j in range(len(s)-1):
        if s[j] > s[j+1]:
            s[j], s[j+1] = s[j+1], s[j]
for i in s:
    print(i, end = "")
        


Measured memory_bytes: 3060
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx,avx2")
#pragma GCC optimize ("trapv")

#include <bits/stdc++.h>
using namespace std;

#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (x).size()
#define what_is(x) cerr << #x << " is " << x << endl;
#define wis cout<<endl<<"I already speak english, bitch"<<endl<<endl;
 
typedef long long int lli;
typedef vector<lli> vi;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef pair<ii,lli> iii;
typedef long double C; 

#define trace(args...) { string  _s =#args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
void err(istream_iterator<string> it){}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args){
    cerr <<  *it  << " : " << a << endl;
    err(++it, args...);
}


int main(){
	fastio;
	vi v;
	rep(i,0,3){
		int num; cin>>num;
		v.pb(num);
	}
	sort(all(v));
	if(v[0]==5 and v[1]==5 and v[2]==7) cout<<"YES"<<endl;
	else cout<<"NO"<<endl; 
	return 0;
}

/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do smth instead of nothing and stay organized
*/


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    
    int a,b,result;
    
    cin >> a >> b;
    
    if(((a >= 1) && (a <= 9)) && ((b >= 1) && (b <= 9))){
        result = a*b;
    }
    else{
        result = -1;
    }
    
    cout << result << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N, H, W;
  cin >> N >> H >> W;
  pair<int, int> p[N];
  for(int i = 0; i < N; i++) cin >> p[i].first >> p[i].second;

  int ans = 0;
  for(int i = 0; i < N; i++){
    if(p[i].first >= H && p[i].second >= W) ans++;
  }

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


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout.setf(ios::fixed); cout.precision(19);

  int a, b;
  cin >> a >> b;
  cout << max(a + b, max(a - b, a * b));

  return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
count = [0]*n
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in range(len(a)):
        count[a[j]-1] += 1

ans = 0
for i in range(n):
    if count[i] == 0:
        ans += 1
print(ans)

Measured memory_bytes: 9092
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int N = fs.nextInt();
        String s = fs.next();

        int cnt = 0;
        for (int i = 0; i <= N-3; ++i) {
            if (s.charAt(i) == 'A' && s.charAt(i+1) == 'B' && s.charAt(i+2) == 'C')
                ++cnt;
        }

        System.out.println(cnt);
    }
}

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

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

    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}

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

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

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

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




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

#define CIN1(a) long long a;cin >> a;
#define CIN2(a,b) long long a,b;cin >> a >> b;
#define CIN3(a,b,c) long long a,b,c;cin >> a >> b >> c;
#define rep(i,n) for(int i=0,i##_len=(n); i<i##_len; ++i)

int main(){
    CIN1(n)
    vector<int> cx(n),cy(n),ch(n);
    rep(i,n){
        CIN3(x,y,h)
        cx[i]=x;cy[i]=y;ch[i]=h;
    }
    int tmp_x,tmp_y,tmp_h;
    rep(i,n){
        if(ch[i]!=0){
            tmp_x = cx[i];tmp_y = cy[i];tmp_h = ch[i];
            cx.erase(cx.begin()+i);cy.erase(cy.begin()+i);ch.erase(ch.begin()+i);
        }
        break;
    }
    cx.insert(cx.begin(),tmp_x);cy.insert(cy.begin(),tmp_y);ch.insert(ch.begin(),tmp_h);

    rep(x,101){rep(y,101){
        int H = -1;
        bool check = false;
        rep(i,n){
            if(!ch[i]) continue;
            else{
                int tmp =  abs(cx[i]-x) + abs(cy[i]-y) + ch[i];
                if(H==-1) H = tmp;
                else if(H!=tmp) check = true;
            }
        }

        rep(i,n){
            if( (!ch[i])&&(H-abs(cx[i]-x)-abs(cy[i]-y)>0) ) check = true;
        }

        if(check) continue;
        else{
            printf("%d %d %d\n",x,y,H);
            return 0;
        }
    }}
}

Measured memory_bytes: 256
import sys
A, B, C, X, Y = map(int, input().split())
if 2*C >= A+B:
  print(A * X + B * Y)
  
else:
  if Y > X:
    X, Y = Y, X
    A, B = B, A
  print(2*C * Y + (X-Y)*min(2*C, A))
  

Measured memory_bytes: 61764
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
const int maxn=1000010;
int n;
void read(int& x){
	x=0;
	char c=getchar();
	while(c<'0' || c>'9') c=getchar();
	while(c>='0' && c<='9'){
		x=x*10+c-'0';
		c=getchar();
	}
}
vector<int>g[maxn],w[maxn];
char s[maxn];
int a[maxn];
int ans;
int c[maxn];
int dp[maxn];
int Next[maxn],pre[maxn];
void add(int x,int y,int z){
	//printf("%d %d %d\n",y,x,z);
	g[x].push_back(y);w[x].push_back(z);
}
int l[maxn],r[maxn];
int main(){
	read(n);
	scanf("%s",s+1);
	for(int i=1;i<=n;++i) if(s[i]=='1') l[i]=(i>1 && s[i-1]=='1')?l[i-1]:i;
	for(int i=n;i>=1;--i) if(s[i]=='1') r[i]=(i<n && s[i+1]=='1')?r[i+1]:i;
	//for(int i=1;i<=n;i++) printf("%d %d\n",l[i],r[i]);
	for(int i=1;i<=n;i++)if(s[i]=='0'){
		if(s[i-1]=='1' && s[i+1]=='1'){
			add(i+1,l[i-1],i-l[i-1]);
			add(i+1,l[i-1]+1,i-l[i-1]-1);
			add(r[i+1],i-1,r[i+1]-i);
			add(r[i+1]-1,i-1,r[i+1]-i-1);
		}
	}
	for(int i=1;i<=n+1;i++){
		dp[i]=dp[i-1];
		for(int j=0;j<g[i].size();j++){
			dp[i]=max(dp[i],dp[g[i][j]-1]+w[i][j]);
		}
		//printf("%d\n",dp[i]);
		ans=max(ans,dp[i]);
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 72448
n=int(input())
p=list(map(int,input().split()))
P=[0 for i in range(n)]
for i in range(n):
  P[p[i]-1]=i+1
a=[]
b=[]
for i in range(1,n+1):
  a.append(str(30000*i))
  b.append(str(30000*(n-i)+P[i-1]))
print(' '.join(a))
print(' '.join(b))

Measured memory_bytes: 8644
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <map>
#include <vector>
#include <stack>
#include <set>
#include <queue>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;

const int Pt = 1e9 + 7;
int n, m;

int main()
{
	scanf("%d%d", &n, &m);
	LL ans;
	if(n == m) {
		ans = 2;
		for(int i = 1; i <= n; i++) ans = (ans * i) % Pt;
		for(int i = 1; i <= m; i++) ans = (ans * i) % Pt;
	}
	else {
		if(abs(n - m) > 1) ans = 0;
		else {
			ans = 1;
			for(int i = 1; i <= n; i++) ans = (ans * i) % Pt;
			for(int i = 1; i <= m; i++) ans = (ans * i) % Pt;
		}
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;
const int num = 10000;
vector<int> ne[num];
int pre[num], c[num], n;
queue<int> ans, q;
inline void bfs(int a) {
	q.push(a);
	c[a] = 1;
	while (!q.empty()) {
		int x = q.front();
		ans.push(x);
		q.pop();
		for (int j = 0; j < ne[x].size(); j++) {
			int k = ne[x][j];
			pre[k]--;
			if (pre[k] == 0) {
				q.push(k); c[k] = 1;
			}
		}
	}
}
inline void tp() {
	for (int i = 0; i < n; i++)
		if (c[i] == 0 && pre[i] == 0) bfs(i);
}
int main() {
	int p, s, t;
	cin >> n >> p;
	for (int i = 0; i < n; i++) pre[i] = 0;
	for (int i = 0; i < p; i++) {
		scanf("%d%d", &s, &t);
		ne[s].push_back(t);
	}
	for (int i = 0; i < n; i++) 
		for (int j = 0; j < ne[i].size(); j++) pre[ne[i][j]]++;
	for (int i = 0; i < n; i++) c[i] = 0;
	tp();
	for (int i = 0; i < n; i++) {
		printf("%d\n", ans.front());
		ans.pop();
	}
	return 0;
}

Measured memory_bytes: 3960