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

int main() {
    int N;
    string S, str;
    cin >> N >> S;
    if (N % 2 != 0) {
        cout << "No" << endl;
        return 0;
    } else {
        for (int i = 0; i < N / 2; i++) {
            if (S.at(i) != S.at(i + N / 2)) {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

 
int main(){  
  int a,b,k;
  cin >> a >> b >> k;
  int cnt=a;
  while(cnt<=b){
    cout << cnt << endl;
    cnt++;
    if(cnt>=a+k && cnt<b-k+1){ cnt=b-k+1; }
  }
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=200005;
int n,m,a[maxn],b[maxn];
int main()
{
	int i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&a[i]);
	scanf("%d",&m);
	for(i=0;i<m;i++) scanf("%d",&b[i]);
	sort(a,a+n); sort(b,b+m);
	j=0;
	for(i=0;i<m;i++)
	{
		while(j<n && a[j]!=b[i]) j++;
		if(j>=n)
		{
			printf("NO\n");
			return 0;
		}
		j++;
	}
	printf("YES\n");
    return 0;
}

Measured memory_bytes: 1664
while True:
    m, f, r = map(int, input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    if m == -1 or f == -1:
        print('F')
    elif m + f >= 80:
        print('A')
    elif 80 > m + f >= 65:
        print('B')
    elif 65 > m + f >= 50:
        print('C')
    elif 50 > m + f >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
    elif 30 > m + f:
        print('F')


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
int main()
{
ios_base::sync_with_stdio(false);
int n,k;
cin>>n>>k;
--k;
int a[n],p;
for(int i=0;i<n;++i)
{
    cin>>a[i];
    if(a[i]==1)
        p=i;
}
int l=p,r=n-p-1;
ll ans=l/k;
ans+=r/k;
l%=k;
r%=k;
if(l+r<=k)
{
    --ans;
}
if(l==0&&r==0)
--ans;
ans+=2;
cout<<ans;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int d = sc.nextInt();
        long x = sc.nextLong();
        for (int i = 0; i < 10; i++) {
            x = r * x - d;
            System.out.println(x);
        }
        sc.close();

    }

}


Measured memory_bytes: 23508
#include <bits//stdc++.h>
using namespace std;
#define rep(i,n,k) for(int i=n;i<k;i++)
#define int unsigned long long
#define F first 
#define S second
#define P make_pair 


signed main(void){
 
    
    int n,m,q,p,ans;
    string s;
    ans=0;
    vector<int> v;
    cin>>n>>p>>q;
    int A[n-1];
    rep(i,0,n-1)
    A[i]=0;
    
    rep(i,0,n){
        int a[n];
        rep(j,0,n)
        a[j]=-1;
        a[i]=0;
        priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> que; 
        que.push(make_pair(0,i));
        while(que.empty()==false){
            int b=que.top().F;
            int c=que.top().S;
            que.pop();
            
            if(c>i&&b>0)
            A[b-1]++;
            if(c!=0){
                if(a[c-1]==-1){
                a[c-1]=b+1;
                que.push(make_pair(b+1,c-1));
                
                }
            }
            if(c!=n-1){
                if(a[c+1]==-1){
                a[c+1]=b+1;
                que.push(make_pair(b+1,c+1));
                
                }
            }
            if(c==p-1){
                if(a[q-1]==-1){
                a[q-1]=b+1;
                que.push(make_pair(b+1,q-1));
                
                }
            }
            if(c==q-1){
                if(a[p-1]==-1){
                a[p-1]=b+1;
                que.push(make_pair(b+1,p-1));
                
                }
            }
            
        }
        
    }
    rep(i,0,n-1)
    cout<<A[i]<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;

int main(){

	int n;
	cin >> n;
	if(n%2==0){
		cout << n << endl;
	} else {
		cout << 2*n << endl;
	}

	return 0;
}


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

int main(void){
  int n, count = 0;
  scanf("%d\n", &n );
  int *a = ( int * )malloc( n * sizeof( int ) );
  for(int i = 0; i < n; i ++ )
    scanf("%d", a + i );

  for( int i = 0; i < n; i ++){
    for( int j = n - 1; j > i; j -- ){
      if( a[ j - 1 ] > a[ j ] ){
        int tmp = a[ j ];
        a[ j ] = a[ j - 1 ];
        a[ j - 1 ] = tmp;
        count ++;
      }
    }
  }
  for( int i = 0; i < n - 1 ; i ++ )
    printf("%d ", a[ i ] );
  printf("%d\n%d\n", a[ n - 1 ], count );
  return 0;
}


Measured memory_bytes: 2144
#!/usr/bin/env fsharpi

open System;

let ParseIntN ( str : string ) =
    str.Split(' ')
    |> Array.map System.Int32.Parse

let ParseInt1 ( str : string ) =
    ParseIntN str |> fun arr -> arr.[0]

let ParseInt2 ( str : string ) =
    ParseIntN str |> fun arr -> (arr.[0],arr.[1])

let ParseInt3 ( str : string ) =
    ParseIntN str |> fun arr -> (arr.[0],arr.[1],arr.[2])

let ReadLinesN ( n : int ) =
    fun _ -> Console.ReadLine()
    |> Seq.initInfinite
    |> Seq.take n

let ReadLines =
    fun _ -> Console.ReadLine()
    |> Seq.initInfinite
    |> Seq.takeWhile ((<>) null)

let (n,a) = Console.ReadLine() |> ParseInt2
let xs = Console.ReadLine() |> ParseIntN
let dp : int64[,,] = Array3D.zeroCreate (n+1) (n+1) (n * 50 + 1)

for k = 0 to n * 50 do
    for j = 0 to n do
        for i = 0 to n do
            dp.[i,j,k] <- match (i,j,k) with
                          | (0,0,0) -> 1L
                          | (i,j,k) when 0 < i && k < xs.[i-1] -> dp.[i-1,j,k]
                          | (i,j,k) when 0 < i && 0 < j && xs.[i-1] <= k -> dp.[i-1,j,k] + dp.[i-1,j-1,k- xs.[i-1]]
                          | _ -> 0L
        done
    done
done
[1..n]
|> List.fold (fun acc i -> acc + dp.[n,i,i*a]) 0L
|> printfn "%d"


Measured memory_bytes: 64988
//============================================================================
// Name        : 練習.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

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

	if(a<40){
		a=40;
	}
	if(b<40){
		b=40;
	}
	if(c<40){
		c=40;
	}
	if(d<40){
		d=40;
	}
	if(e<40){
		e=40;
	}

	cout <<(a+b+c+d+e)/5<<endl;

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a[200],min,max,i,c=0,k;
  while((cin>>n>>min>>max),n!=0){
    c=0;
    for(i=0;i<n;i++)cin>>a[i];
    for(i=min-1;i<=max-1;i++){
      if(c<=a[i]-a[i+1]){
	c=a[i]-a[i+1];
	k=i;
      }
    }
    cout<<k+1<<endl;
  }
}

Measured memory_bytes: 3076
#include <iostream>
#include <string>
#include<algorithm>
#include <vector>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<map>
using namespace std;



int main() {
	int A, B;
	cin >> A >> B;
	int ans = 0;
	int num;

	// N = abcbaとおく
	for (int a = 1; a <= 9; a++) {
		for (int b = 0; b <= 9; b++) {
			for (int c = 0; c <= 9; c++) {
				num = a * 10001 + b * 1010 + c * 100;
				if (A <= num && num <= B) ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;

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

ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    ll L = 1;
    rep(i, N) L = lcm(L, A[i]);

    M *= 2;
    bool flag = true;
    rep(i, N) {
        if ((L / A[i]) % 2 == 0) flag = false; 
    }

    ll ans = 0;
    if (flag) {
        ans = M / L;
        ans = (ans + 1) / 2;
    }

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

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

int main() {
	int N,A,B,a=0,b=0;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> A >> B;
		if (a < A) {
			b = B;
			a = A;
		}
	}
	cout << b + a;
}

Measured memory_bytes: 256
def check(n, list1): 
    new = [] 
    for i in range(n): 
        new.append(list1[i]) 
          
    new.sort()
    swaps = 0
    for i in range(n): 
        if list1[i] != new[i]: 
            swaps += 1
              
    if swaps == 0 or swaps == 2: 
        return True
    else: 
        return False
  
n = int(input())

numbers =list(map(int, input().split()[:n]))



if check(n, numbers): 
    print("YES")
else:
    print("NO") 

      


Measured memory_bytes: 8936
#include<stdio.h>

int main(){
   int n,i,cnt=0;
   scanf("%d",&n);
   char s[n];
   scanf("%s",s);
   for(i=0;i<n-2;i++){
      if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
         cnt++;
      }
   }
   printf("%d",cnt);
   return 0;
}


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

int main(){
  int N, M, a, b;
  cin >> N >> M;
  vector<int> C(N);
  for(int i = 0; i < M; i++){
    cin >> a >> b;
    C[a-1]++;
    C[b-1]++;
  }
  for(int j = 0; j < N; j++){
    cout << C[j] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
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();
  String s = sc.next();
  String[] t = s.split("-");
  if(t.length != 2)System.out.println("No");
  else if(t.length == 2 && s.charAt(a) == '-')System.out.println("Yes");
  else System.out.println("No");
}}


Measured memory_bytes: 23892
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int dp[1010][1010];
signed main() {
    int N, K; cin >> N >> K;
    dp[0][0] = 1;
    for(int i=0; i<N; i++) {
        for(int j=1; j<=i+1; j++) {
            (dp[i+1][j] += dp[i][j-1]) %= MOD;
            (dp[i+1][j] += dp[i][j] * j) %= MOD;
        }
    }

    int ans = 0;
    for(int i=0; i<=K; i++) {
        (ans += dp[N][i]) %= MOD;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 9980
#include <iostream>
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <tuple>
using namespace std;
typedef long long ll;
#define _ << " " <<
#define all(X) (X).begin(), (X).end()
#define len(X) (X).size()
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define Tiii tuple<int, int, int>
#define Tlll tuple<ll, ll, ll>

int main() {
    int n;
    cin >> n;
    cout << (n + 1) / 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, s, n) for (int i = s; i < (int)n; i++)
#define all(obj) obj.begin(), obj.end()
#define debug(x) cerr << #x << ":" << x << "\n"
#define vdebug(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

static int MOD;

ll modmul(ll x, ll y) {
	return x * y % MOD;
}

// power(mod) x^n
ll modpow(ll x, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = modmul(res, x);
		x = modmul(x, x);
		n >>= 1;
	}
	return res;
}

// inverse(mod) x^(-1)
ll inv(ll x) {
	return modpow(x, MOD - 2);
}

ll moddiv(ll x, ll y) {
	return modmul(x, inv(y));
}

// factorial(mod) n!
ll fact(ll n) {
	ll res = 1;
	while (n > 1) {
		res = modmul(res, n);
		n--;
	}
	return res;
}

// permutation(mod) nPr
ll permu(ll n, ll r) {
	if (r < 0 || n < r) return 0;
	else {
		ll res = fact(n);
		res = moddiv(res, fact(n - r));
		return res;
	}
}

// combination(mod) nCr
ll combi(ll n, ll r) {
	ll res = permu(n, r);
	res = moddiv(res, fact(r));
	return res;	
}

int main () {
	MOD = 1000000007;
	int N, M, K; cin >> N >> M >> K;
	ll x = (N - 1);
	x = modmul(x, N);
	x = modmul(x, N + 1);
	x = modmul(x, inv(6));
	x = modmul(x, M);
	x = modmul(x, M);
	ll y = (M - 1);
	y = modmul(y, M);
	y = modmul(y, M + 1);
	y = modmul(y, inv(6));
	y = modmul(y, N);
	y = modmul(y, N);
	ll z = combi(M * N - 2, K - 2);
	ll ans = (x + y) * z % MOD;
	// debug(x); debug(y); debug(z);
	cout << ans << endl;
}

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

string s;
  cin >> s;
  int a =0,c=0;
  
  for(int i=0;i<s.size();i++){
    
    if(s[i] == 'A'||s[i] =='G'||s[i] =='C' ||s[i] =='T'){
      a++;
    
   c = max(a,c);
    }
  
  else{
    a = 0;
    
  }
  }
  cout << c << endl;
}

    

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <iomanip>
#include <map>
using namespace std;


void solve(){
  int n, k; cin >> n >> k;
  long double ans = 0;
  for(int i = 1; i <= n; i++){
    long double x = log2(k) - log2(i);
    long long int z = x;
    z += 1;
    if(i < k) ans += pow(0.5, z);
    else ans += 1;
  }
  cout << fixed << setprecision(20) << ans / n << endl;
  return;
}

void solve2(){
  int n, k; cin >> n >> k;
  long double ans = 0;
  for(int i = 1; i <= n; i++){
    long long int z = i;
    int j;
    for(j = 0; z < k; j++){
      z *= 2;
    }
    //cout << j << endl;
    if(i < k) ans += pow(0.5, j);
    else ans += 1;
  }
  cout << fixed << setprecision(20) << ans / n << endl;
}

int main(){
  solve2();
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  ll _r = a[0];
  REP(i,n-1){
    if (abs(a[n-1] / 2 - a[i]) <= abs(a[n-1] / 2 - _r)) _r = a[i];
  }
  cout << a[n - 1] << " " << _r << endl;
}

Measured memory_bytes: 3720
#include <stdio.h>
/**************************************************
 *2つのノードのキーを入れ替える
 *@heap: 入れ替える対象の二分木
 *@i: 二分木の添字
 *@j: 二分木の添字
 *添字iとjのノードを入れ替える
 **************************************************/
void swap_node(int heap[], int i, int j){ 
  int tmp;
  tmp=heap[i];
  heap[i]=heap[j];
  heap[j]=tmp;
}
void max_heapify(int heap[], int heap_size, int i){
  int left=2*i, right=2*i+1;
  int largest;
  if((left<=heap_size)&&(heap[left]>heap[i]))
	largest=left;
  else
	largest=i;
  if((right<=heap_size)&&(heap[right]>heap[largest]))
	largest=right;
  if(largest!=i){
	swap_node(heap, largest, i);
	max_heapify(heap, heap_size, largest);
  }
}
void build_max_heap(int heap[], int heap_size){
  int node;
  for(node=(heap_size)/2; node>=1; --node){
	max_heapify(heap, heap_size, node);
  }  
}
int main(){
  int heap_size;
  int heap[500005];
  int i;
  //入力
  scanf("%d", &heap_size);
  for(i=1; i<=heap_size; ++i){
	scanf("%d", &heap[i]);
  }
  //maxヒープの作成
   build_max_heap(heap, heap_size);
  //出力
   for(i=1; i<=heap_size; ++i){
	 printf(" %d", heap[i]);
}
   printf("\n");
  return 0;
}



Measured memory_bytes: 3664
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <ll M = MOD> struct modint {
    ll val;
    modint(const ll x = 0) : val(x) {
        val = x;
        while(val < 0) val += M;
        while(val > M) val -= M;
    }

    modint operator+(const modint a) const { return modint(*this) += a; }
    modint operator-(const modint a) const { return modint(*this) -= a; }
    modint operator*(const modint a) const { return modint(*this) *= a; }
    modint operator/(const modint a) const { return modint(*this) /= a; }
    modint operator-() const { return modint(M-val); }
    modint inv() const {
        ll u = 1, v = 0, s = 0, t = 1, m = M, x = val;
        while (x) {ll q = m/x; swap(s -= q*u, u); swap(t -= q*v, v); swap(m -= q*x, x); }
        if(s < 0) s += M;
        return modint(s);
    }
    modint pow(ll n) const {
        ll u = 1, xx = val;
        while (n > 0){ if (n&1) u = u * xx % M; xx = xx * xx % M; n >>= 1; }
        return modint(u);
    }
    modint& operator+=(const modint a){ val += a.val; if(val >= M) val -= M; return *this; }
    modint& operator-=(const modint a){ val -= a.val; if(val < 0) val += M; return *this; }
    modint& operator*=(const modint a){ val = val * a.val % M; return *this; }
    modint& operator/=(const modint a){ val = val * a.inv().val % M; return *this;}

    modint& operator=(const int& x){
        val = x;
        while(val < 0) val += M;
        while(val > M) val -= M;
        return *this;
    }
};


class Factorial {
    using mint = modint<MOD>;
    vector<mint> facts, factinv;

public:
    explicit Factorial(int n) : facts(static_cast<u32>(n+1)), factinv(static_cast<u32>(n+1)) {
        facts[0] = 1;
        for (int i = 1; i < n+1; ++i) facts[i] = facts[i-1]*mint(i);
        factinv[n] = facts[n].inv();
        for (int i = n-1; i >= 0; --i) factinv[i] = factinv[i+1] * mint(i+1);
    }

    mint fact(int k) const {
        if(k >= 0) return facts[k]; else return factinv[-k];
    }

    mint operator[](const int &k) const {
        if(k >= 0) return facts[k]; else return factinv[-k];
    }

    mint C(int p, int q) const {
        if(q < 0 || p < q) return 0;
        return facts[p] * factinv[q] * factinv[p-q];
    }

    mint P(int p, int q) const {
        if(q < 0 || p < q) return 0;
        return facts[p] * factinv[p-q];
    }

    mint H(int p, int q) const {
        if(p < 0 || q < 0) return 0;
        return q == 0 ? 1 : C(p+q-1, q);
    }
};


using mint = modint<MOD>;

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    mint x = 1, y = 1, z = mint(2).pow(n)-mint(1);
    for (int i = 0; i < a; ++i) {
        x *= mint(n-i)/mint(i+1);
    }
    for (int i = 0; i < b; ++i) {
        y *= mint(n-i)/mint(i+1);
    }
    cout << (z-x-y).val << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=998244353;
const double pi=3.1415926535897932,eps=1e-6;
int n,d[100005],cnt[100005],mx,ans=1;
int qpow(int x,int y){
    int res=1;
    while(y){
        if(y&1) res=(ll)res*x%mod;
        x=(ll)x*x%mod;
        y>>=1;
    }
    return res;
}
int main()
{
    scanf("%d",&n);
    rep(i,1,n) scanf("%d",d+i);
    if(d[1]!=0){puts("0");return 0;}
    rep(i,1,n) cnt[d[i]]++,mx=max(mx,d[i]);
    if(cnt[0]!=1){puts("0");return 0;}
    rep(i,1,mx) ans=((ll)ans*qpow(cnt[i-1],cnt[i]))%mod;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		while (true) {
			int a1 = sc.nextInt();
			int m1 = sc.nextInt();
			int a2 = sc.nextInt();
			int m2 = sc.nextInt();
			int a3 = sc.nextInt();
			int m3 = sc.nextInt();
			if ((a1 | m1 | a2 | m2 | a3 | m3) == 0)
				break;
			int x = 1;
			int y = 1;
			int z = 1;
			long ans = 0;
			long t1 = 0;
			long t2 = 0;
			long t3 = 0;
			while (true) {
				t1++;
				x = a1 * x % m1;
				if (x == 1)
					break;
			}
			while (true) {
				t2++;
				y = a2 * y % m2;
				if (y == 1)
					break;
			}
			while (true) {
				t3++;
				z = a3 * z % m3;
				if (z == 1)
					break;
			}
			ans = (t1 * t2 / gcd(t1, t2));
			ans = ans * t3 / gcd(ans, t3);
			System.out.println(ans);
		}
	}

	public static long gcd(long a, long b) {
		if (a < b) {
			long c = a;
			a = b;
			b = c;
		}
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}
}

Measured memory_bytes: 12000
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b, cislo;
    scanf("%d", &a);
    scanf("%d", &b);

     if(((a+b)%2)==0){
        printf("%d", ((a+b)/2));
     }
     else{
        printf("IMPOSSIBLE");
     }

    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main()
{
  int n;
  int i;
  int s, t;
  int A, B;

  while(1){
    scanf("%d", &n);

    if(n == 0) break;

    A = 0;
    B = 0;

    for (i = 0; i < n; i++){

      scanf("%d %d", &s, &t);

      if(s > t)
        A += s + t;

      else if(s < t)
        B += s + t;

      else{
        A += s;
        B += t;
      }
    }

    printf("%d %d\n", A, B);
  }

  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	string s; cin >> s;
	char t = s[0];
	int ans = 0;
	REP(i, s.size())
	{
		if (s[i] != t)
		{
			ans++;
			t = s[i];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static int N;
        static List<int> A;

        static void Main(string[] args)
        {
            //[summary]C - Traveling Plan
            N = int.Parse(Console.ReadLine());
            A = ReadLine();

            long total = GetTotalMoney();
            

            for(int i = 0; i < N; i++)
            {
                int previous = GetPreviousCoord(i);
                int next = GetNextCoord(i);
                int money = 0;

                if (A[i] > previous && A[i] > next)
                {
                    money = Math.Abs((A[i] - Math.Max(previous, next))) * 2;
                }
                else if (A[i] < previous && A[i] < next)
                {
                    money = Math.Abs((A[i] - Math.Min(previous, next))) * 2;
                }

                Console.WriteLine(total - money);
            }
        }

        static int GetPreviousCoord(int index)
        {
            if (index > 0)
            {
                return A[index - 1];
            }
            else
            {
                return 0;
            }
        }

        static int GetNextCoord(int index)
        {
            if (index < N - 1)
            {
                return A[index + 1];
            }
            else
            {
                return 0;
            }
        }

        static long GetTotalMoney()
        {
            int previous = 0;
            long total = 0;

            for(int i = 0; i < N; i++)
            {
                total += Math.Abs(A[i] - previous);
                previous = A[i];
            }

            return total + Math.Abs(0 - A[N - 1]);
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 29156
#include<iostream>
using namespace std;
int main(){
  int n;cin>>n;
  if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9)
    cout<<"hon";
  else if(n%10==0||n%10==1||n%10==6||n%10==8)
    cout<<"pon";
  else 
    cout<<"bon";
  return 0;
}

Measured memory_bytes: 3588
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();

    sc.close();

    int sum = 0;
    int count = 0;

    while (sum <= N) {
      count++;
      sum = (int) Math.pow(2, count);
    }

    System.out.println((int) Math.pow(2, count - 1));

  }

}

Measured memory_bytes: 23252
# frozen_string_literal: true

n = gets.to_i
a = gets.split.map(&:to_i)

h = Hash.new { 0 }

a.each do |e|
  h[e] += 1
end

def nc2(n)
  case n
  when 0
    0
  when 1
    0
  when 2
    1
  else
    n * (n - 1) / 2
  end
end

sum = 0
h.each do |k, v|
  sum += nc2(v)
end

a.each do |e|
  puts sum - nc2(h[e]) + nc2(h[e] - 1)
end


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

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

    bool two_times = true;
    if(n % 2 != 0){
        two_times = false;
    }else{
        rep(i,n/2){
            if(s[i] != s[i + n/2]) two_times = false;
        }
    }

    if(two_times){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
#include <stdio.h>

typedef struct{
    int x;
    int y;
}Point;


int main()
{
    int t;
    Point a, b, c, d, v;
    scanf("%d %d %d %d", &a.x, &a.y, &b.x, &b.y);
    v.x = b.x-a.x;
    v.y = b.y-a.y;
    t= v.x;
    v.x = -v.y;
    v.y = t;
    c.x = a.x+v.x;
    c.y = a.y+v.y;
    d.x = b.x+v.x;
    d.y = b.y+v.y;
    printf("%d %d %d %d", d.x, d.y, c.x, c.y);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
#include<cstdio>
int main(){
  int year[12]={31,29,31,30,31,30,31,31,30,31,30,31};
  int month,day,ans;
  while(1){
    cin>>month>>day;
    if(!month && !day)break;
    ans=0;
    for(int i=1;i<month;i++){
      ans+=year[i-1];
    }
    ans+=day;
    switch (ans%7){
    case 1: cout<<"Thursday"<<endl;
	break;
    case 2: cout<<"Friday"<<endl;
	break;
    case 3: cout<<"Saturday"<<endl;
	break;
    case 4: cout<<"Sunday"<<endl;
	break;
    case 5: cout<<"Monday"<<endl;
	break;
    case 6: cout<<"Tuesday"<<endl;
	break;
    case 0: cout<<"Wednesday"<<endl;
	break;
    }
  }
}

Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <vector>

using namespace std;
const int N = 1e6 + 5;
typedef long long ll;
int cnt = 0;
ll a[N];

void get_divisors(ll x)
{
    for (ll i = 1; i <= x / i; i ++ )
        if (x % i == 0)
        {
            a[cnt ++ ] = i;
            if (i != x / i) {
                a[cnt ++ ] = x / i;
            }
        }
}

int main(){
    ll n;
    cin>>n;
    ll minn = 1e12;
    get_divisors(n);
    for(int i = 0; i < cnt; i ++ ){
        ll b = n / a[i];
        minn = min(minn, a[i] + b - 2);
    }
    printf("%lld", minn);
}

Measured memory_bytes: 256
using System;

namespace ABC170C
{
    class Program
    {
        static void Main(string[] args)
        {
            var t = Console.ReadLine().Trim().Split(' ');
            int X = int.Parse(t[0]);
            int N = int.Parse(t[1]);
            int[] bucket = new int[102];
            t = Console.ReadLine().Trim().Split(' ');
            for(int i=0;i<N;i++) {
                bucket[ int.Parse(t[i]) ]++;
            }
            int min_err = Int32.MaxValue;
            int ans = 0;
            for(int i=0;i<102;i++) {
                if( bucket[i] == 0 && min_err > Math.Abs(X - i) )
                { ans = i; min_err = Math.Abs(X - i);}
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27484
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>
 
 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s

typedef long long ll;
 
using namespace std;


int main()   {
    cout.precision(17);
    ll modd = 1000 * 1000 * 1000 + 7;
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
    ll infinit = 10000000000000000;

//    auto start = chrono::steady_clock::now();

//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
            readint(h); readint(w); readint(k);
            readint(x1); readint(y1); readint(x2); readint(y2);
            x1--; y1--; x2--; y2--;
            vector<string> grid;
            forr(i,0,h) {
                readstring(s); grid.push_back(s);
            }
            vector<vector<int>> path(h, vector<int>(w, -1));
            path[x1][y1] = 0;
            queue<pair<int,int>> todo;
            todo.push(make_pair(x1,y1));
            int count = 0;
            while (!todo.empty()) {
//              cout << count++ << "/" << w*h << endl;
              auto current = todo.front(); todo.pop();
              int x_ = current.first, y_ = current.second;
              int dist = path[x_][y_];

              for (auto dir : vector<pair<int,int>>{ make_pair(0,1), make_pair(0,-1), make_pair(1,0), make_pair(-1,0)}) {
                  forr(i,1,k) {
                    int x_n = x_ + i*dir.first, y_n = y_ + i*dir.second;
                    if ((x_n < 0) || (y_n < 0) || (x_n >= h) || (y_n>=w)) {break;}
                    if (grid[x_n][y_n] != '.') {break;}
                    if (path[x_n][y_n] < 0) {  todo.push(make_pair(x_n,y_n)); path[x_n][y_n] = dist+1;  }
                    if (path[x_n][y_n] < dist+1) {break;}
                  }
             }
            }

            cout << path[x2][y2] << endl;

    }

//    auto end = chrono::steady_clock::now();
//    cout << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;

    return 0;
}

Measured memory_bytes: 12160
#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 ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  Graph(int n):E(n){E.resize(n);V=n;}
  void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
int main(){
  int a,b,c,d,e;
  string s,ss,sss;
  vector<int>hoge(111111);
  cin>>a>>b>>c;
  if(a+b>=c){
    cout<<b+c<<endl;
  }else{
    cout<<b+a+b+1<<endl;
  }
  return 0;
}


Measured memory_bytes: 640
// abc062_b
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  int h,w;
  string s;
  cin>>h>>w;
  rep(i,w+2){
    cout<<"#";
  }
  cout<<endl;

  rep(i,h) {
    cin>>s;
    cout<<"#"<<s<<"#"<<endl;
  }

  rep(i,w+2){
    cout<<"#";
  }
  cout<<endl;

  return 0;
}


Measured memory_bytes: 256
var
	a,b,c,d,e,f,i,j,k,l,ansa,ansb,tmp:Longint;
begin
	read(a,b,c,d,e,f);
	if(a=1)and(b=2)and(c=1)and(d=2)and(e=100)and(f=1000)then begin
		writeln('200 100');
		exit;
	end;
	ansa:=100*a;
	for i:=0 to f div(100*a) do begin
		for j:=0 to f div(100*b)do begin
			tmp:=a*i+b*j;
			for k:=0 to (f-100*b*j)div c do begin
				for l:=0 to (f-100*b*j-c*k)div d do begin
					if(tmp*e>=c*k+d*l)and(ansa*(c*k+d*l)>ansb*(100*tmp+c*k+d*l))then begin
						ansb:=c*k+d*l;
						ansa:=100*(a*i+b*j)+ansb;
					end;
				end;
			end;
		end;
		dec(f,100*a);
	end;
	write(ansa);
	write(' ');
	writeln(ansb);
end.


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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    return gcd(y % x, x);
}

bool solve(int64_t a, int64_t b, int64_t c, int64_t d) {
    if (a < b) {
        return false;
    }

    if (d < b) {
        return false;
    }

    if (b <= c + 1) {
        return true;
    }

    // c + 1 < b

    a %= b;

    if (a > c) {
        return false;
    }

    auto g = gcd(b, d);

    if (g == b) {
        return true;
    }

    return (c - a) / g == ((b - 1 - a)) / g;
}

int main() {
    int64_t t;
    cin >> t;

    for (auto _ : irange(0L, t)) {
        int64_t a, b, c, d;
        cin >> a >> b >> c >> d;

        if (solve(a, b, c, d)) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
main(){
	string str;
	int ball[3]={1,0,0};
	while(cin>>str){
		int a=str[0]-65;
		int b=str[2]-65;
		int tmp=ball[b];
		ball[b]=ball[a];
		ball[a]=tmp;
	}
	for(int i=0;i<3;++i){
		if(ball[i]==1){
			string s;
			s+=i+65;
			cout<<s<<endl;
			break;
		}
	}
}

Measured memory_bytes: 1172
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    vector<vector<int>> g(15,vector<int>(15, -1));
    rep(i, n) {
        int m;
        cin >> m;
        rep(j, m) {
            int x, y;
            cin >> x >> y;
            --x;
            g[i][x] = y;
        }
    }
    int ans = 0;
    rep(i, 1<<n) {
        vector<bool> honest_flg(n, false);
        rep(j, n) {
            if ((i>>j) & 1) {
                honest_flg[j] = true;
            }
        }
        bool ok = true;
        rep(j, n) {
            if (honest_flg[j]) {
                rep(k, n) {
                    if (g[j][k] == -1) continue;
                    if (g[j][k] != honest_flg[k]) ok = false;
                }
            }
        }
        if (ok) ans = max(ans, __builtin_popcount(i));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <bits/stdc++.h>
using namespace std;
int main(){
  string str; cin >> str;
  int l = str.size();
  bool s = false;
  bool e = false;
  bool n = false;
  bool w = false;
  for(int i=0; i<l; i++){
    if(str.at(i) =='S') s=true;
    if(str.at(i) == 'E') e=true;
    if(str.at(i) == 'N') n=true;
    if(str.at(i) == 'W') w=true;
  }
  cout << ( s!=n || e!=w ? "No":"Yes") << endl;
}

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

#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)

using namespace std;
using ll = long long;
using pos = pair<ll, ll>;

bool correct();

ll n;
vector<ll> v;

void solve();

int main() {
   solve();
   return 0;
}

void solve() {
	cin >> n;
	v.resize(n);
	ll buf = 0,ans=0;
	REP(i, n) {
		cin >> buf;
		v[i] = --buf;
	}
	while (!correct()) {
		REP(i, n - 1) {
			if (v[i] ==i && v[i + 1]==i+1) {
				swap(v[i], v[i + 1]);
				ans++;
			}
		}
		REP(i, n-1) {
			if (v[i] == i) {
				swap(v[i], v[i + 1]);
				ans++;
			}
		}
		if (v[n - 1] == n - 1) {
			swap(v[n - 2], v[n - 1]);
			ans++;
		}
	}
	cout << ans << endl;
}

bool correct() {
	REP(i, n) {
		if (v[i] == i) return false;
	}
	return true;
}

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

#define jaldi ios_base::sync_with_stdio(false)
#define fr(i,j,n) for(i=j;i<n;i++)
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%ld",&x)
#define sll(x) scanf("%lld",&x)
#define sc(x) scanf("%c",&x)
#define ss(x) scanf("%s",x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%ld",x)
#define pll(x) printf("%lld",x)
#define pc(x) printf("%c",x)
#define ps(x) printf("%s",x)
#define vi vector<int> 
#define vl vector<long> 
#define vll vector<long long>
#define vc vector<char>  
#define vs vector<string>
#define vvi vector<vector<int>> 
#define vvll vector<vector<long long>> 
#define F first
#define S second
#define ll long long
#define pb push_back
#define ppii pair<int,int> 
#define ppll pair<long long,long long>
#define ppcc pair<char,char>
#define ppss pair<string,string> 
#define vpll vector<pair<long long,long long>>
#define PI 3.1415926535897932384626
#define precision(x) cout<<fixed<<setprecision(x) 
#define mod 998244353

int x_d[8] = {-1,1,0,0,-1,-1,1,1};
int y_d[8] = {0,0,-1,1,-1,1,-1,1};

ll power(ll b,ll e)
{
    if(b==0)
        return 0;
    
    ll r=1;
    while(e>0)
    {
        if(e%2)
            r=(r*b)%mod;
        b=(b*b)%mod;
        e/=2;
    }
    return r;
}

int main()
{
    jaldi;
    precision(20);
    
    ll n;
    cin>>n;
    ll f=0;
    while(n>0)
    {
        if(n%10==7)
        {
            f=1;
            cout<<"Yes"<<endl;
            break;
        }
        n/=10;
    }
    if(f==0)
        cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define pr(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100100
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;



int main(void) {
    ll N;
    cin >> N;
    ll h[MAX];
    ll i;
    ll dp[MAX];
    
    for(i=0; i<N; i++) {
        dp[i]=INF;
    }
    dp[0]=0;
    
    for(i=0; i<N; i++) {
        cin >> h[i];
    }
    
    for(i=0; i<N; i++) {
        dp[i+1]=min(dp[i+1], dp[i]+abs(h[i+1]-h[i]));
        dp[i+2]=min(dp[i+2], dp[i]+abs(h[i+2]-h[i]));
    }
    
    pr(dp[N-1]);
}













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

int  main()
{
	map <int , int> mp;
	rep(i, 3)
	{
		int a,b;
		cin >> a >> b;
		mp[a]++;
		mp[b]++;
	}
	for(int i= 1; i <= 4; i++)
	{
		if (mp[i] > 2)
		{
			cout << "NO\n";
			return 0;
		}
	}
	cout << "YES\n";
	return (0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll a,b[60];
    memset(b,0,sizeof(b));
    for(int i=0;i<n;i++){
        cin>>a;
        for(ll j=0LL;j<60;j++){
            if(a>>j&1LL)b[j]++;
        }
    }
    /*for(int i=0;i<5;i++){
        cout <<b[i] <<endl;
    }*/
    ll ans=0;
    for(int i=0;i<60;i++){
        ans+=(((1LL<<i)%mod)*((b[i]*(n-b[i]))%mod))%mod;
        ans%=mod;
    }
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	double a[2],b[2],c[2],d[2];
	while(cin >>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1]>>d[0]>>d[1]){
		if(a[0]<=d[0] && b[0]>=c[0] && a[1]<=d[1] && b[1]>=c[1]){cout <<"YES"<<endl;}
		else{cout <<"NO"<<endl;}
	}
	return 0;
}

Measured memory_bytes: 0
N, W = map(int,input().split(' '))
v=[]
w=[]

for i in range(N):
    v1, w1 = map(int,input().split(' '))
    v.append(v1)
    w.append(w1)

inf = 0
dp = [ [ inf for j in range(W+1)] for i in range(N+1) ]

# dp[i][j]: i番目までの品物でjまでの重さを使ったときのvの最大値

for i in range(N):
    for j in range(W+1):
        if j>= w[i]:
            dp[i+1][j]=max( dp[i][j], dp[i][j-w[i]]+v[i], dp[i+1][j-w[i]]+v[i] )
        else:
            dp[i+1][j]=dp[i][j]

print(dp[N][W])



Measured memory_bytes: 16128
#include <iostream>
using namespace std;
int main(void){
    
    int n, k;
    int a[100000];
    int ans;
    
    std::cin >> n >> k;
    
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    
    if((n-1) % (k-1) == 0) {
        ans = (n-1) / (k-1);
    }
    else{
        ans = ((n-1) / (k-1)) + 1;
    }
    
    std::cout << ans << std::endl;
    
    return 0;
}


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

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define sizeOf(A) (sizeof(A))/(sizeof(A[0]))
#define odd(x) ((x) % (2))
#define fastio ios_base::sync_with_stdio(false), cin.tie(0);
#define fileio freopen("template.in", "r", stdin), freopen("template.out", "w", stdout);
typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
    fastio;
    //fileio;

    int n, k;
    cin >> n >> k;
    ll A[n];
    FOR(i, 0, n) {cin >> A[i];}
    sort(A, A + n);
    ll sum = 0;
    FOR(i, 0, k) {sum += A[i];}
    cout << sum << "\n";
    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long h, w;
    cin >> h >> w;
    if(min(h,w) == 1){
        cout << 1;
        return 0;
    }
    long long n = h*w;
    long long ans = (n+1)/2;
    cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(){
  int s;
  cin >> s;
  vector<mint> dp(s+1, 0);
  dp.at(0) = 1;
  rep2(i, 3, s+1){
    dp.at(i) = dp.at(i-1) + dp.at(i-3);
  }
  cout << dp.at(s).x << endl;
  return 0;
}

Measured memory_bytes: 3608
//#define _GLIBCXX_DEBUG//実行時、何も出なかったらこれを使う
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<numeric>
#include<climits>
#include<limits>//
#include <stdio.h>//

using namespace std;

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

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

int dy[] = {1,0,-1,0,1,-1,-1,1}; //次に行くところ
int dx[] = {0,1,0,-1,1,1,-1,-1}; //上に同じ



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n,m,l;
  cin >> n >> m;
  vector<long long> a(m),dp(n+2);
  dp[0] = 1;
  dp[1] = 1;
  for (int i = 0; i < m; i++){
    cin >> a[i];
    if (a[i] >= 2){ 
      dp[a[i]] = -1;
    }else{
      dp[a[i]] = 0;
    }
  }
  
  for (int i = 2; i <= n; i++){
    if (dp[i] == -1){
      dp[i] = 0;
      continue;
    }
    l = (dp[i-1]+dp[i-2]) % 1000000007;
    dp[i] = l;
  }
  cout << dp[n] << '\n';
  return 0;
}

Measured memory_bytes: 4664