akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;

int main()
{
    
    int a,sum = 0;
    cin >> a;
    for(int i = 0;i<4;i++)
    {
        if ((a%10) == 2)
        {
            sum++;
            
        }
        a/=10;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int P=sc.nextInt();
		int[]a=new int[N];
		long ki=0;
		long gu=0;
		for(int i=0;i<N;i++){
			a[i]=sc.nextInt();
			if(a[i]%2==0)gu++;
			else ki++;
		}
		long ans=1;
		if(P==0){
			long pa=0;
			for(int i=0;i<=ki;i+=2){
				pa+=comb(ki,i);
			}
			for(int i=0;i<gu;i++){
				ans*=2;
			}
			ans=ans*pa;
			System.out.println(ans);
		}else{
			for(int i=0;i<gu;i++){
				ans*=2;
			}
			long pa=0;
			for(int i=1;i<=ki;i+=2){
				pa+=comb(ki,i);
			}
			ans*=pa;
			System.out.println(ans);
		}
	}
	
	long kaijou(long n){
		long ans=1;
		for(int i=1;i<=n;i++){
			ans*=i;
		}
		return ans;
	}
	long comb(long n, long m){
		long c=1;
		m=(n-m<m ? n-m :m);
		for(long ns=n-m+1,ms=1;ms<=m;ns++,ms++){
			c*=ns;
			c/=ms;
		}
		return c;
		
	}
}

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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using u64 = uint_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;

void solve() {
    i64 n, w;
    cin >> n >> w;

    i64 m = n *  (i64) 1e3;
    vector<i64> dp(m + 1, INF);
    dp[0] = 0;

    for (i64 i = 0; i < n; i++) {
        i64 wi, vi;
        cin >> wi >> vi;

        for (i64 j = m; j >= vi; j--) {
            dp[j] = min(dp[j], dp[j - vi] + wi);
        }
    }

    for (i64 i = m; i >= 0; i--) {
        if (dp[i] <= w) {
            cout << i << endl;
            return;
        }
    }
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 3972
#include <bits/stdc++.h>
#define ll long long
#define eps 1e-7
#define all(x) ((x).begin()),((x).end())
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define int ll
const bool debug = 0;
using pii = pair<int, int>;
typedef long double D;

int32_t main()
{
    usecppio
    int n, m; cin >> n >> m;
    if (n%2==1)
    {
        for (int i = 1; i<=m; i++)
            cout << i << ' ' << n-i << '\n';
    }
    else
    {
        int odd = (m+1)/2;
        for (int i = 1; i<=odd; i++)
            cout << i << ' ' << n-i+1 << '\n';
        for (int i = odd+1; i<=m; i++)
            cout << i << ' ' << n-i << '\n';
    }
}


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

int main()
{
	int h,w;
	cin>>h>>w;
	char a[100][100];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++) cin>>a[i][j];
	}
	
	bool fh[100]={0},fw[100]={0};
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){ 
			if(a[i][j]=='#'){
				fh[i]=1;
				fw[j]=1;
			}
		}
	}
	
	for(int i=0;i<h;i++){
		if(fh[i]==0) continue;
		for(int j=0;j<w;j++){
			if(fw[j]==0) continue;
			cout<<a[i][j];
		}
		cout<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a < b){
            System.out.println("a < b");
        }else{
            if(a > b){
            System.out.println("a > b");
            }else{
                System.out.println("a == b");
            }
        }
    }
}


Measured memory_bytes: 26152
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin >> n >> m;
	int a,b,c,d;
	int G[n][n];
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n; j++)
			G[i][j] = 100000000;
	for(int i = 0; i < m; i++){
		scanf("%d,%d,%d,%d",&a,&b,&c,&d);
		G[a - 1][b - 1] = c;
		G[b - 1][a - 1] = d;
	}
	int s,g,v,p;
	scanf("%d,%d,%d,%d",&s,&g,&v,&p);
	s--; g--;
	vector <int> used(n,0);
	vector <int> dist(n,100000000);
	dist[s] = 0;
	while(1){
		int va = -1;
		for(int i = 0; i < n; i++)
			if(used[i] == 0 && (va == -1 || dist[va] > dist[i]))
				va = i;
		if(va == -1)
			break;
		used[va] = 1;
		for(int i = 0; i < n; i++)
			dist[i] = min(dist[i] , G[va][i] + dist[va]);
	}
	int iki = dist[g];
	used = vector <int> (n,0);
	dist = vector <int> (n,100000000);
	dist[g] = 0;
	while(1){
		int va = -1;
		for(int i = 0; i < n; i++)
			if(used[i] == 0 && (va == -1 || dist[va] > dist[i]))
				va = i;
		if(va == -1)
			break;
		used[va] = 1;
		for(int i = 0; i < n; i++)
			dist[i] = min(dist[i] , G[va][i] + dist[va]);
	}
	cout << v - p - dist[s] - iki << endl;
}

Measured memory_bytes: 3220
from collections import Counter

n = int(input())
s = [input() for i in range(n)]
c = Counter(s)
c.most_common()
ans = []
m = -1
for i, item in enumerate(c.most_common()):
    if i == 0:
        m = item[1]
        ans.append(item[0])
    elif item[1] == m:
        ans.append(item[0])
    else:
        break
ans.sort()
print(*ans, sep='\n')


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

	int a ,b;
  	int p;
  	cin >> a >> b;
  if(a + b == 3) p =3;
  if(a + b == 4) p =2;
  if(a + b == 5) p =1;
  
  cout << p << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main(){
  ll N;
  cin >> N;
  ll result = N - 1;
  ll x = 1;
  while(x <= sqrt(N)){
    if(N % x == 0 && N/x + x - 2 < result) result = N/x + x - 2;
    x++;
  }
  cout << result << endl;
}

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


int main(void){
    ll n, k;
    cin>>n>>k;
    ll ans=0;
    for(ll i=n-1;i>=k;i--){
        /*余りがiとする*/
        int now=(n-i)/(i+1)+1;
        int div=(n-i)%(i+1);
        ans+=(i-k+1)*now;
        ans+=max(div-k, 0LL);
        //cout<<now<<" "<<div<<endl;
    }
    if(k==0) ans-=n;
    cout<<ans<<endl;
    return 0;

}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long ll;
#define print(x) cout<<(x)<<endl


#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007


// DONT USE "int", USE "ll" !!!!!!!!!!!!
int main() {
	string s; cin >> s;

	int os = 0;

	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'o')os += 1;
	}

	if (8 - os <= 15 - s.size())print("YES");
	else print("NO");
	








	return 0;
}

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

int main(void)
{
  int a,d,n,i,j,sum,ans,no;

  for(;;){
    scanf("%d %d %d", &a, &d, &n);
    if(!(a|d|n)) break;

    sum=0; no=0;
    if(a==1&&d==1){
      sum++; ans=2; a=3;
    } else if(a==1){
      a+=d;
    } else if(a==2){
      sum++; ans=2; a+=d;
    }
    for(i=a;sum<n;i+=d){
      if(i%2==0) continue;
      for(j=3;j<sqrt(i)+1;j+=2){
	if(i%j==0){
	  no=1; break;
	}
      }
      if(no==0){
	ans=i; sum++;
      }
      no=0;
    }
    printf("%d\n", ans);
  }

  return 0;
}


Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    for(;;){
        int d,w;
        cin>>d>>w;
        if(!d) return 0;
        int f[10][10];
        rep(i,0,d){
            rep(j,0,w) cin>>f[i][j];
        }
        int ans=0;
        rep(s,0,d){
            rep(t,s+3,d+1){
                rep(u,0,w){
                    rep(v,u+3,w+1){
                        int m=100;
                        rep(i,s,t){
                            rep(j,u,v){
                                if(i==s||i==t-1||j==u||j==v-1) m=min(m,f[i][j]);
                            }
                        }
                        int res=0;
                        rep(i,s,t){
                            rep(j,u,v){
                                if(!(i==s||i==t-1||j==u||j==v-1)){
                                    if(f[i][j]>=m) res=-100000000;
                                    else res+=m-f[i][j];
                                }
                            }
                        }
                        ans=max(ans,res);
                    }
                }
            }
        }
        cout <<ans<<"\n";
    }
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	REP(n,9){
		string S=in<string>();
		ll A=in(),B=in();
		out(S,A+B,200LL*A+300LL*B);
	}
	return 0;
}



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

int main(void) {
  int n; cin >> n;
  int ans = 0;
  for (int i=0; i<n; i++) {
    int l, r; cin >> l >> r;
    ans += r - l + 1;
  }
  
  cout << ans << endl;
  return 0;
}

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

int main() {
  long long N, K;
  cin >> N >> K;
  
  if(max(N,K) - min(N, K)) {
      N = N % K;
  }
  while(N > max(N,K) - min(N, K)) {
    if(N - K < 0) {
      N = (N - K) * (-1);
    }
    else N = N - K;
  }
  
  cout << N << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1000005,mod=998244353;
int n,m,ans,sum,fac[N],inv[N];
int pw(int a,int b){int r=1;for(;b;b>>=1,a=1ll*a*a%mod)if(b&1)r=1ll*r*a%mod;return r;}
int C(int n,int m){return n<m||n<0||m<0?0:1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;}
int main()
{
	for(int i=fac[0]=1;i<N;i++)fac[i]=1ll*fac[i-1]*i%mod;
	inv[N-1]=pw(fac[N-1],mod-2);
	for(int i=N-2;i>=0;i--)inv[i]=1ll*inv[i+1]*(i+1)%mod;
	scanf("%d%d",&n,&m);
	if(n<m)swap(n,m);
	for(int i=1;i<=m;i++)sum=(sum+1ll*C(i*2,i)*C(n+m-i*2,n-i)%mod)%mod;
	printf("%d\n",(1ll*sum*inv[2]%mod*pw(C(n+m,n),mod-2)%mod+n)%mod);
	return 0;
}

Measured memory_bytes: 8064
#include <cstdio>
#include <numeric>

double dp[3000];

int main()
{
  int n;
  scanf("%d", &n);
  double p[2999];
  for (int i = 0; i < n; ++i)
  {
    scanf("%lf", p + i);
  }
  dp[0] = 1.;
  for (int i = 0; i < n; ++i)
  {
    for (int j = i + 1; j >= 0; --j)
    {
      dp[j] = dp[j] * (1 - p[i]) + (j > 0 ? dp[j - 1] * p[i] : 0);
    }
  }
  printf("%.16f\n", std::accumulate(dp + n / 2 + 1, dp + n + 1, 0.));
  return 0;
}

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

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i64,
    }
    println!("{}",
        n * 800 - n / 15 * 200);
}


Measured memory_bytes: 4352
package main

import (
	"fmt"
	"strings"
)

type container struct {
	data []string
}

func (c *container) queue(s string) {
	c.data = append(c.data, s)
}
func (c *container) dequeue() string {
	if len(c.data) > 0 {
		r := c.data[0]
		c.data = c.data[1:len(c.data)]
		return r
	}
	return ""
}

func main() {
	var N int
	fmt.Scan(&N)
	var aq, bq, baq, oq container
	for i := 0; i < N; i++ {
		var s string
		fmt.Scan(&s)
		if s[0] == 'B' && s[len(s)-1] == 'A' {
			baq.queue(s)
		} else if s[0] == 'B' {
			bq.queue(s)
		} else if s[len(s)-1] == 'A' {
			aq.queue(s)
		} else {
			oq.queue(s)
		}
	}
	//fmt.Println("N", N, "AQ", aq, "BQ", bq, "BAQ", baq, "OQ", oq)
	ans := ""
	ans += aq.dequeue()
	for len(baq.data) > 0 {
		ans += baq.dequeue()
	}
	//fmt.Println("step1 done: ans", ans)
	for len(bq.data) > 0 {
		ans += bq.dequeue()
		if len(aq.data) > 0 {
			ans += aq.dequeue()
		} else {
			break
		}
	}
	// fmt.Println("step2 done: ans", ans)
	for len(bq.data) > 0 {
		ans += bq.dequeue()
	}
	// fmt.Println("step3 done: ans", ans)
	for len(aq.data) > 0 {
		ans += aq.dequeue()
	}
	// fmt.Println("step4 done: ans", ans)
	for len(oq.data) > 0 {
		ans += oq.dequeue()
	}
	// fmt.Println("ans", ans)
	fmt.Println(strings.Count(ans, "AB"))
}


Measured memory_bytes: 27264
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 static List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
		 static int a_dist[];
		 public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);
	        int N = sc.nextInt();	
	        int K = sc.nextInt();	
	        long[] p = new long[N];
	        for (int i=0 ; i<N; i++) {
	            p[i] = Long.parseLong(sc.next())-1;
//	        	p[i]=(i+5)%N;
	        }
	        long[] c = new long[N];
	        long sum =0;
	        for (int i=0 ; i<N; i++) {
	            c[i] = Long.parseLong(sc.next());
//	        	c[i] = (long)Math.random()*1000000;
	        }
	        
	        boolean[] visited = new boolean[N];
	        
	        long ans = Long.MIN_VALUE;
	        for(int s=0;s<N;s++) {
	        	if(visited[s]==true)continue;
	        	else {
	        		long[] b = new long[N];
	        		b[0]=c[s];
		            sum = b[0];
	        		long next = p[s];
	        		visited[(int)next]=true;
	        		int cnt=1;
	        		while(next!=s) {
	        			b[cnt]=c[(int)next];
	        			sum = sum+b[cnt];
	        			next=p[(int)next];
	        			cnt++;
	        			visited[(int)next]=true;
	        		}
	    	        long[][] dp = new long[cnt][cnt];
	    	        for(int i=0;i<cnt;i++) {
	       	        	for(int j=0;j<cnt;j++) {
	    	        		if(j==0) {
	    	        			dp[i][j]=b[i];
	    	        		} else {
	    	        			dp[i][j]=dp[i][j-1] + b[(j+i)%cnt];
	    	        		}
	    	        	}	    	        	
	    	        }
 	    	        long at = Long.MIN_VALUE;
	    	        for(int i=0;i<cnt;i++) {
	    	        	for(int j=0;j<Math.min(cnt, K);j++) {
	    	        		at=dp[i][j];
	    	    	        if(sum>0) {
	    	    	        	at=at+sum*(K/cnt);
	    	    	        }
	    	    	        if(j>=K%cnt&&sum>0) {
	    	    	        	at=at-sum;
	    	    	        }
	    		        	ans = Math.max(ans, at);
	    	        	}
	    	        }
	        	}
	        }
	        
	        
	        
	        System.out.println(ans);
		 }
		 
	}

Measured memory_bytes: 264860
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define maxn 1005
#define INF ((ll)(1e18)+1)
typedef long long ll;
int T[maxn], A[maxn];
int main(void)
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d %d", &T[i], &A[i]);
	ll t = T[0], a = A[0];
	for (int i = 1; i < n; i++)
	{
		if (T[i] >= t && A[i] >= a) {
			t = T[i], a = A[i];
			continue;
		}
		ll k = max(t / T[i], a / A[i]);
		if (k < 1)k = 1;
		while (T[i] * k < t || A[i] * k < a)
			k++;
		t = T[i] * k, a = A[i] * k;
	}
	printf("%lld\n", t + a);
	return 0;
}

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

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

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

#include <array>
template<size_t N>
class INDEX {
    array<size_t, N> arr;

public:
    template<typename... T>
    INDEX(T... _arr)
        : arr({{static_cast<size_t>(_arr)...}}) {}
    template<typename... T>
    size_t operator()(T... _arr) {
        size_t position[] = {static_cast<size_t>(_arr)...};
        static_assert(N == size(position));
        size_t res = 0, width = 1;
        for (int i = N - 1; i >= 0; i--) {
            res += width * position[i];
            width *= arr[i];
        }
        return res;
    }
};
template<typename... T>
auto Index(T... args) {
    unsigned int arr[] = {static_cast<unsigned int>(args)...};
    constexpr size_t N = size(arr);
    return INDEX<N>(args...);
}
template<typename T, typename... Args>
auto make_v_flat(T init, Args... args) {
    return vector<T>((1 * ... * args), init);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k;
    cin, n, k;
    vector<ll> h(n + 1, 0);
    REP(i, 0, n) {
        cin, h[i + 1];
    }

    const ll inf = 1LL << 60;
    auto dp = make_v_flat(inf, n + 1, k + 1);
    auto index = Index(n + 1, k + 1);
    dp[index(0, 0)] = 0;

    REP(i, 1, n + 1) {
        REP(j, 0, k + 1) {
            for (int t = i - 1; t >= 0 && j - (i - t - 1) >= 0; t--) {
                chmin(dp[index(i, j)], dp[index(t, j - (i - t - 1))] + max(0LL, h[i] - h[t]));
            }
        }
    }

    ll ans = inf;
    REP(i, 0, n + 1) {
        if (n - i <= k) {
            REP(j, 0, k - (n - i) + 1) {
                chmin(ans, dp[index(i, j)]);
            }
        }
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 3972
s=input()
t=input()
u=len(t)
for i in range(len(s)-u,-1,-1):
  for j in range(u):
    if s[i+j] != '?' and s[i+j] != t[j]:
      break
  else:
    print('{}{}{}'.format(s[:i],t,s[i+u:]).replace('?','a'))
    break
else:
  print('UNRESTORABLE')

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program {
    static void Main(string[] args) {
        //入力
        string s = Console.ReadLine();
        int A = int.Parse(s.Split(' ')[0]);
        int B = int.Parse(s.Split(' ')[1]);
        int T = int.Parse(s.Split(' ')[2]);

        //計算
        Console.WriteLine(B * (T / A));


        //出力




    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
  int num[10],cp1[10],cp2[10],th[4],t,i,j,k,h,cn,f,e;
  char c[14];
  while(gets(c)!=NULL) {
   for (i=0;i<10;i++) num[i]=0;
   for (i=0;i<13;i++) num[c[i]-'0']++;
   e=0;
    for (i=1;i<10;i++) {
	   f=0;
	   if (num[i]==4) continue;
	   for (j=1;j<10;j++) {
		   for (k=1;k<10;k++) cp1[k]=num[k];
		   cp1[i]++;
		   if (cp1[j]<2) continue;
		   cp1[j]-=2; t=0;
		   for (k=1;k<10;k++) if (cp1[k]>2) { th[t]=k; t++;}
		   if (t==4)  f=1;
		   for (k=0;k<(1 << t);k++) {
			   cn=0;
			   for (h=1;h<10;h++) cp2[h]=cp1[h];
			   for (h=0;h<t;h++) if ((k & (1 << h))!=0) { cp2[th[h]]-=3; cn++;}
			   for (h=2;h<9;h++) while(cp2[h]!=0 && cp2[h-1]!=0 && cp2[h+1]!=0) { cp2[h]--;cp2[h-1]--;cp2[h+1]--; cn++;}
		       if (cn==4) f=1;
		   }
	   }
	   if (f==1) if (e==1) cout <<  ' ' << i ; else { e=1; cout << i;}
	}
	if (e==0) cout << 0;
   cout << endl;
   }
  return 0;
}

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

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  int num = r * 100 + g * 10 + b;
  if (num % 4 == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


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

int main() {
    int N, M; cin >> N >> M;

    priority_queue<long long> que;
    for (int i = 0; i < N; ++i) {
        long long A; cin >> A; que.push(A);
    }
    for (int i = 0; i < M; ++i) {
        long long t = que.top(); que.pop();
        que.push(t/2);
    }
    long long res = 0;
    while (!que.empty()) {
      res += que.top(); que.pop();
    }
    cout << res << endl;
}

Measured memory_bytes: 1400
N, M = list(map(int, input().split()))
ans = [0] * N
invalid = 0
keta_history = {}
for i in range(M):
    keta, atai = list(map(int, input().split()))
    ans[keta - 1] = atai
    if keta in keta_history:
        if keta_history[keta] != atai:
            invalid += 1
    else:
        keta_history[keta] = atai
if 1 not in keta_history and N > 1:
    ans[0] = 1
ans = int(''.join(map(str, ans)))
dummy1 = [1] + [0] * (N - 1)
dummy2 = [0] * N
dummy = dummy1 if N != 1 else dummy2
if ans < int(''.join(map(str, dummy))):
    invalid += 1

if invalid > 0:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 3064
data = [
    [[0 for r in range(10)] for f in range(3)] for b in range(4)
]

count = int(input())
for c in range(count):
    b, f, r, v = [int(i) for i in input().split()]
    data[b-1][f-1][r-1] += v


for bi, b in enumerate(data):
    for f in b:
        for r in f:
            print(' {0}'.format(r), end='')

        print()

    if bi < 3:
        print('#' * 20)

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

inline int read() {
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - 48; ch = getchar(); }
	return x * f;
}

const int N = 720;
int n, m, col[N], cnt[2];
bitset<N> dp;
int G[N][N];

void dfs(int u, int c) {
	col[u] = c;
	cnt[c == 1]++;
	for (int v = 1; v <= n; v++) {
		if (G[u][v] || u == v) continue;
		if (!col[v]) dfs(v, -c);
		else if (col[u] == col[v]) {
			puts("-1");
			exit(0);
		}
	}
}

int C(int x) { return x * (x - 1) / 2; }

int main() {
	n = read(), m = read();
	while (m--) {
		int u = read(), v = read();
		G[u][v] = G[v][u] = 1;
	}
	dp[0] = 1;
	for (int i = 1; i <= n; i++) {
		if (!col[i]) {
			cnt[0] = cnt[1] = 0;
			dfs(i , 1);
			dp = (dp << cnt[0]) | (dp << cnt[1]);
		}
	}
	int ans = 1e9;
	for (int i = 0; i <= n; i++) if (dp[i]) ans = min(ans, C(i) + C(n - i));
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 2176
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str1 = Console.ReadLine().Split(' ');
            int n = int.Parse(str1[0]);
            int d = int.Parse(str1[1]);
            double[] a = new double[n];
            int count = 0;
            for(int i =0; i < n; i++)
            {
                string[] str = Console.ReadLine().Split(' ');
                int b = int.Parse(str[0]);
                int c = int.Parse(str[1]);
                a[i] = Math.Sqrt(Math.Pow(b,2)+Math.Pow(c,2));
                if(a[i]<=d)
                {
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }
    
}

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

int main(void) {
    string s;
    cin >> s;
    
    for(int i=(s.size()-1)/2;i>=1;i--) {
        if(strncmp(&s[0],&s[i],i) == 0) {
            cout << i*2 << "\n";
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int xcomp(vector<int>& a, vector<int>& b) {
	return a[0] < b[0];
}

int ycomp(vector<int>& a, vector<int>& b) {
	return a[1] < b[1];
}

int zcomp(vector<int>& a, vector<int>& b) {
	return a[2] < b[2];
}
#define XSORT(c) sort((c).begin(),(c).end(),xcomp)
#define YSORT(c) sort((c).begin(),(c).end(),ycomp)
#define ZSORT(c) sort((c).begin(),(c).end(),zcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

int main() {

	LL aI, aO, aT, aJ, aL, aS, aZ;
	cin >> aI >> aO >> aT >> aJ >> aL >> aS >> aZ;
	if (aI >= 1 && aJ >= 1 && aL >= 1) {
		cout << max(aI / 2*2 + aJ / 2 * 2 + aL / 2 * 2, 3 + (aI - 1) / 2 * 2 + (aJ - 1) / 2 * 2 + (aL - 1) / 2 * 2) + aO << endl;
	}
	else {
		cout << aI / 2 * 2 + aJ / 2 * 2 + aL / 2 * 2 + aO << endl;
	}

}


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

#define PI 4*atan(1)
#define INF 1e8

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

int main(){
  int n;
  int days[1001][11][21] = {0};
  int s = 1;
  for(int i = 1; i <= 1000; i++){
    for(int j = 1; j <= 10; j++){
      for(int k = 1; k <= 20; k++){
        if(i % 3 != 0 && j % 2 == 0 && k == 20)continue;
        else {
          days[i][j][k] = s;
          s++;
        }
      }
    }
  }
  cin >> n;
  vector<int> Y(n), M(n), D(n);
  for(int i = 0; i < n; i++){
    cin >> Y[i] >> M[i] >> D[i];
    cout << days[1000][1][1] - days[Y[i]][M[i]][D[i]] << endl;;
  }
}

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-12;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=50000;
    rep(y,1,P){
        ll x=mod(y*k);
        
        if(abs(x)<=P||x+P>=i_7){
            if(x+P>=i_7){
                x-=i_7;
            }
            cout<<x<<"/"<<y<<endl;
            //cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
typedef vector<ll> vl;
//////////////////////////


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


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

int main() {
  int N;
  cin >> N;
  char next;
  set<string> SE;
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    if (SE.count(S)>0){
      cout << "No" << "\n";
      return 0;
    }
    if (i>0 && S.front() != next){
      cout << "No" << "\n";
      return 0;
    }
    
    SE.insert(S);
    next = S.back();
  }
  cout << "Yes" << "\n";
}

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

int main()
{
	int n,m;
	cin>>n>>m;
	int cnt=0;
	int k=m+n-1;
	for(int i=m;i<=k;i++)cnt+=i;
	if(m+n-1>=0&&m<=0){
		cout<<cnt<<endl;
		return 0;
	}
	else if(m+n-1<0){
		cout<<cnt-(m+n-1)<<endl;
		return 0;
	}
	else if(m+n-1>=0&&m>0){
		cout<<cnt-m<<endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] strings = new String[110];
        strings = s.split("");
        int jadge = 0;
        for (int i=0; i<s.length(); i ++) {
           if(i%2==0 && strings[i].equals("L")) {
             jadge = 1;
             break;
           }
           if(i%2!=0 && strings[i].equals("R")) {
             jadge = 1;
             break;
           }
        }
        if(jadge==0) System.out.println("Yes");
        else System.out.println("No");
    }
}



Measured memory_bytes: 25172
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int k, a, b;
	cin >> k >> a >> b;
	for(int i = a; i <= b; i++){
		if(i%k == 0){
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
	return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int INF=1e9;
const ll MOD=1e9+7;

ll gcd(ll x,ll y){
    if(y==0) return 0;
    return gcd(y,x%y);
}

int dis2(int x1,int y1,int x2,int y2){
    return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}

int main(){
    string t;cin>>t;
    for(int i=0;i<(int)t.size();i++){
        if(t[i]=='?') cout<<'D';
        else cout<<t[i];
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3480
# p周辺の4つは消えることが前提
def erase(array, i, N):
    if array[i - 1] == array[i]:
        up = i - 1
        down = i
    elif array[i] == array[i + 1]:
        up = i
        down = i + 1
    else:
        return N - 2

    while True:
        if array[up] == -1 or array[down] == -1 or not array[up] == array[down]:
            return up + N - down - 1
        save_up = up
        save_down = down
        c = array[up]
        while array[up] == c:
            up -= 1
        while array[down] == c:
            down += 1

        if save_up - up + down - save_down < 4:
            return save_up + N - save_down - 1



def main():
    while True:
        N = int(input())
        if N == 0:
            return
        a = [-1]
        for i in range(N):
            a.append(int(input()))
        a.append(-1)

        min_erased = N
        for i in range(1, N + 1):
            save = a[i]
            a[i] = save % 3 + 1
            min_erased = min(min_erased, erase(a, i, N + 2))
            a[i] = (save + 1) % 3 + 1
            min_erased = min(min_erased, erase(a, i, N + 2))
            a[i] = save

        print(min_erased)


if __name__ == '__main__':
    main()





Measured memory_bytes: 5716
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
bool solve(vector<string> C, int rs, int cs, int k) {
  int blk = 0;
  for (unsigned i = 0; i < C.size(); i++) {
    for (unsigned j = 0; j < C[0].size(); j++) {
      int im = 1 << i;
      int jm = 1 << j;
      if ((im & rs) == 0 && (jm & cs) == 0) {
        if (C[i][j] == '#')
          blk++;
      }
    }
  }
  return blk == k;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> C(h);
  for (auto &s : C)
    cin >> s;
  int rm = 1 << h;
  int cm = 1 << w;
  int ans = 0;
  for (int rs = 0; rs < rm; rs++) {
    for (int cs = 0; cs < cm; cs++) {
      ans += (solve(C, rs, cs, k));
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  
  uint64_t n = 1LL;
  int i = 1;
  while (i<N) {
    n = n * (K - 1);
    i++;
  }
  
  printf("%lld\n", K * n);
  
}

Measured memory_bytes: 256
#include <iostream>

int main(void)
{
    int x, y;
    while( std::cin >> x >> y ) {
        if (x == 0 && y == 0) {
            break;
        } else {
            if (x < y) {
                std::cout << x << " " << y << std::endl;
            } else {
                std::cout << y << " " << x << std::endl;
            }
        }
    }

    return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int h, w;
    int m;
    map<int, int> yCount;
    map<int, int> xCount;
    cin >> h >> w >> m;
    set<pair<int, int>> locs;
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> y >> x;
        x--;
        y--;
        auto item = yCount.find(y);
        if (item == yCount.end()) {
            yCount[y] = 1;
        } else {
            item->second++;
        }
        item = xCount.find(x);
        if (item == xCount.end()) {
            xCount[x] = 1;
        } else {
            item->second++;
        }
        locs.insert(make_pair(x, y));
    }
    int maxX = 0;
    int maxY = 0;
    for (int i = 0; i < h; i++) {
        maxY = max(maxY, yCount[i]);
    }
    for (int i = 0; i < w; i++) {
        maxX = max(maxX, xCount[i]);
    }
    vector<int> bestXs;
    vector<int> bestYs;
    for (int i = 0; i < h; i++) {
        if (maxY == yCount[i]) {
            bestYs.push_back(i);
        }
    }
    for (int i = 0; i < w; i++) {
        if (maxX == xCount[i]) {
            bestXs.push_back(i);
        }
    }
    for (auto x : bestXs) {
        for (auto y : bestYs) {
            if (locs.find(make_pair(x, y)) == locs.end()) {
                cout << maxX + maxY << "\n";
                return 0;
            }
        }
    }
    cout << maxX + maxY - 1 << "\n";
    return 0;
}


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

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

const long long INF = 1LL << 60;

int main() {
  int n, k;
  cin >> n >> k;
  long long h[101000];

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

  long long dp[101000];
  for (int i = 0; i < 101000; i++) dp[i] = INF;
  dp[0] = 0;

  for (int i = 0; i < n; i++)
    for (int j = 1; j <= k; j++) {
      chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
  }
  cout << dp[n-1] << endl;
}

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

int main() {
  int n;
  cin >> n;
  
  long long x;
  long long a[n] = {0};
  long long b[n] = {0};
  
  for(int i = 0; i < n; ++i){
    cin >> x;
    a[x - 1] += 1;
    b[i] = x - 1;
  }
  
  long long sum = 0;
  for(int i = 0; i < n; ++i){
    x = a[i];
    sum += (x * (x - 1)) / 2;
  }
  
  for(int i = 0; i < n; ++i){
      cout << sum - a[b[i]] + 1 << endl;
  }

}

Measured memory_bytes: 5760
int main()
{
   long int d,e,a,b;
   double f;
   scanf ("%ld %ld",&a,&b);
    d = a/b;
    e = a%b;
    f = (double)a/(double)b;
    printf ("%ld %ld %lf\n",d,e,f);
    
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<double> A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  double out = 0;
  for(int i = 0; i < N; i++){
    out += 1/A.at(i);
  }
  out = 1/out;
  cout <<setprecision(15)<< out;
}

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

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	
	if(a>b){a=a+b;b=a-b;a=a-b;}
	if(a>c){a=a+c;c=a-c;a=a-c;}
	if(b>c){b=b+c;c=b-c;b=b-c;}
	
	cout<<a<<' '<<b<<' '<<c<<endl;
	return 0;
}

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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    char a, b, c;
    cin >> a >> b >> c;

    if (a == '7' || b == '7' || c == '7') {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


}


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

using namespace std;
typedef long long ll;

const int N = int(1e8) + 7;

void init(){

}

void solve(){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    printf("%d\n", (c/a)*b);
}

const bool mtc = false;

int main(){
    int t;
    if(mtc){
        scanf("%d", &t);
        while(t--) solve();
    }
    else solve();
}


Measured memory_bytes: 256
from collections import Counter
from math import sqrt, ceil
MOD = 10**9+7
n = int(input())
p_list = []

for i in range(2, n+1):
    target = i
    for j in range(2, ceil(sqrt(i))+1):
        while target % j == 0:
          p_list.append(j)
          target //= j
    if target != 1:
        p_list.append(target)

res = 1
for v in Counter(p_list).values():
    res *= (v+1)
    res %= MOD
print(res)


Measured memory_bytes: 3316
from itertools import *
def f(s):
 for a,b,c,d in permutations(s):
  for x,y,z in product('+-*',repeat=3):
   for t in[f"({a} {x} {b}) {y} ({c} {z} {d})",f"(({a} {x} {b}) {y} {c}) {z} {d}",f"({a} {x} ({b} {y} {c})) {z} {d}"]:
    if eval(t)==10:return'('+t+')'
 else:return 0
for e in iter(input,'0 0 0 0'):print(f(list(map(int,e.split()))))


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

typedef long long ll;

const int kN = 2e3 + 5;

ll a[kN], c[kN];

int main() {
	int n; ll ans = 0, x;
	scanf("%d%lld", &n, &x);
	for(int i = 1; i <= n; ++i) scanf("%lld", a + i), c[i] = a[i], ans += a[i];
	for(int i = 1; i <= n; ++i) {
		ll cur_cost = x * i;
		for(int j = 1; j <= n; ++j) {
			c[j] = std::min(c[j], a[(j + i - 1) % n + 1]);
			cur_cost += c[j];
		}
		ans = std::min(cur_cost, ans);
	}
	printf("%lld", ans);
	return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;

  if (A >= 13)
    cout << B << endl;
  else if (A <= 12 && A >= 6)
    cout << B / 2 << endl;
  else
    cout << 0 << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define _ << " " <<
#define all(v) v.begin(), v.end()
#define sp(n) fixed << setprecision(n)

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

const int mod = 1e9 + 7;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n, a, b;
	cin >> n >> a >> b;
	cout << min(n*a, b) << endl;
	return 0;
}

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

int main() {
  int a[100000], t, n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> t;
    a[t - 1] = i + 1;
  }
  for (int i = 0; i < n; ++i) cout << a[i] << ' ';
  cout << '\n';
  return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>
#include<string.h>
int main(){
  int n,m,ans=0,count=0,If=1,Of=0,i;
  while(1){
    scanf("%d",&n);
    if(n == 0) break;
    scanf("%d",&m);
    char s1[m];
    scanf("%s",s1);
    for(i=0;i<m;i++){      
      if(If == 1){
	if(s1[i] == 'I'){
	  If=0;
	  Of=1;
	  count++;
	  if(count >= 2*n+1){
	    ans++;
	  }
	} else{
	  count=0;
	}
      } else if(Of == 1){
	If=1;
	Of=0;
	if(s1[i] == 'O'){
	  count++;
	} else if(s1[i] == 'I'){
	  If=0;
	  Of=1;
	  count=1;
	} else{
	  count=0;
	}
      }
    }
    printf("%d\n",ans);
    count=0;
    ans=0;
    If=1;
    Of=0;
  }
  return 0;
}

Measured memory_bytes: 3552
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    string O,E;
    cin >> O >> E;
    int sizeo=O.size();
    int sizee=E.size();
    for(int i=0;i<(sizeo+sizee);i++){
        if(i%2==0){
            cout << O[i/2];
        }
        else{
            cout << E[(i/2)];
        }
    }
}

Measured memory_bytes: 3560
#include <functional>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <climits>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <deque>
#include <list>
#include <map>
#include <set>
using namespace std;

/*** typedef ***/
typedef long long LL;
typedef unsigned int ui;
typedef unsigned long long ULL;
typedef pair < int , int > ii;
typedef pair < LL  , LL  > ll;
typedef vector <int>  vint;
typedef vector <bool> vbool;
typedef vector <long> vlong;

/*** define ***/
#define sz(x)			((int)x.size())
#define tin(x)			scanf("%d",&x)
#define all(x)			x.begin(),x.end()
#define Set(b,a)		memset(b,a,sizeof b)
#define print1(x)		printf("Case %d:",x++)
#define tin2(x,y)		scanf("%d%d",&x,&y)
#define tin3(x,y,z)		scanf("%d%d%d",&x,&y,&z)
#define loop(i,i0,in)	for(int i=i0 ; i<in ; i++)
#define rep(i,n)		for(int i=0 ; i<(n) ; i++)
#define _rep(i,n)		for(int i=n-1 ; i>=0 ; i--)
#define _loop(i,in,i0)	for(int i=in-1 ; i>=i0 ; i--)
#define Fore(it, x)		for(typeof (x.begin()) it = x.begin(); it != x.end (); it++)

const int       maxn = 10+4;
const long double PI = 3.1415926535897932384626433832795;

map <char,int> mp;
map <int,char> pm;
bool vis[4][maxn];

void solve()
{
	mp['S']=0;pm[0]='S';
	mp['H']=1;pm[1]='H';
	mp['C']=2;pm[2]='C';
	mp['D']=3;pm[3]='D';
}
     
int main()  
{  
#ifdef Online_Judge
	freopen("a.in","r",stdin);
#endif
	int n;
	int num;
	char ch;
	cin >> n;
	solve();
	Set(vis,0);
	rep(i,n)
	{
		cin >> ch >> num;
		vis[mp[ch]][num]=true;
	}
	rep(i,4)
	{
		loop(j,1,14)
			if(!vis[i][j])
				cout << pm[i] << ' ' << j << endl;
	}
	return 0;
}

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

using namespace std;
#define int long long

signed main() {
    //ios::sync_with_stdio(0);
    //cin.tie(0);
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<pair<int, int>> ap;
    ap.reserve(a+b+c+10);
    pair<int, int> el;
    for(int i = 0; i < a; ++i){
        cin >> el.first;
        el.second = 0;
        ap.push_back(el);
    }
    for(int i = 0; i < b; ++i){
        cin >> el.first;
        el.second = 1;
        ap.push_back(el);
    }
    for(int i = 0; i < c; ++i){
        cin >> el.first;
        el.second = 2;
        ap.push_back(el);
    }
    sort(begin(ap), end(ap));
    int n = x+y;
    int ca = count_if(end(ap)-n, end(ap), [](const pair<int, int>& p){ return p.second == 0;});
    int cb = count_if(end(ap)-n, end(ap), [](const pair<int, int>& p){ return p.second == 1;});
    int res = 0;
    int ka = 0, kb = 0, kc = 0;
    int i = a+b+c-1;
    while((x-ka)+(y-kb) != kc){
        if(ap[i].second == 2){
            res += ap[i].first;
            ++kc;
        }else if(ap[i].second == 1 and kb < y){
            res += ap[i].first;
            ++kb;
        }else if(ap[i].second == 0 and ka < x){
            res += ap[i].first;
            ++ka;
        }
        --i;
    }
    cout << res << endl;
}

Measured memory_bytes: 4992