akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std::chrono;
using namespace std;
#define ordered_set tree<pr, null_type,less<pr>, rb_tree_tag,tree_order_statistics_node_update>
// declaration: ordered_set os;  methods->  1. *os.find_by_order(x)   2. os.order_of_key(k) ->return int

#define fr(x,i,n) for(int x = i; x < n; ++x)
#define fb(x,i,n) for(int x = i; x >= n; --x)
#define pr pair<ll,int>
#define ll unsigned long long int
#define ld long double
const ll mod=998244353;


//const ll mod=1e9+7;
ll f(ll x,ll n){
    ll r=1;
    while(n){
        if(n%2==1)
        r=(r*x)%mod;
        x=(x*x)%mod;
        n/=2;
    }
    return r;

}
int nod(ll x){
    int c=0;
    while(x){
        x/=10LL;
        c++;
    }
    return c;
}
void solve(){
    int n;
    cin>>n;
    ll a[n];
    fr(i,0,n)
    cin>>a[i];
    ll ans=1;
    fr(i,0,n){
        if(a[i]==0){
            cout<<0;
            return;
        }
    }
    fr(i,0,n){
        if(a[i]<=(ll)(1e18)/ans)
        ans*=a[i];
        else{
            cout<<-1;
            return;
        }
    }
    cout<<ans;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
//    build();
    int t=1;
//    cin>>t;
    while(t--)
    solve();

}


Measured memory_bytes: 4416
#!/usr/bin/env python
# coding: utf-8

# In[4]:


from collections import Counter


# In[8]:


N = int(input())
A = list(map(int, input().split()))


# In[9]:


s = [0]
for i in range(N):
    s += [s[-1]+A[i]]
c = Counter(s)
ans = 0
for v in c.values():
    ans += v*(v-1)//2
print(ans)


# In[ ]:






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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long X, long long Y){
    LL ans = 0;
    LL now = X;
    while(now <= Y) {
        ans++;
        now *= 2LL;
    }

    cout << ans << endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    solve(X, Y);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

int main()
{
	std::size_t N, M;
	std::cin >> N >> M;

	std::vector<std::size_t> count;

	for (std::size_t i = 0; i < N; i++) {
		count.push_back(0);
	}
	for (std::size_t i = 0; i < M; i++) {
		std::size_t a_i, b_i;
		std::cin >> a_i >> b_i;
		count.at(a_i - 1)++;
		count.at(b_i - 1)++;
	}

	for (std::size_t i = 0; i < N; i++) {
		std::cout << count.at(i) << std::endl;
	}
	return 0;
}

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

using namespace std;

int main() {
  uint64_t n;
  cin >> n;
  uint64_t t=100;
  uint64_t count =0;
  while(n>t){
    t+=t*0.01;
    count++;
  }
  
  cout << count << endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

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

int main() {
    int N; cin >> N; 
    ll t; cin >> t;
    ll ans=t;
    for(int i=0;i<N-1; i++){
        ll t; cin >> t;
        ans=lcm(t,ans);
    }
    cout << ans << endl;
}

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

#define int long long


signed main()
{
    int n;
    cin >> n;
    int r = 0;
    for (int i = 0; i < 5; i++) {
        int t;
        cin >> t;
        if (r == 0) {
            r = t;
        } else {
            r = min(r, t);
        }
    }
    int T = ((n + r - 1) / r) + 4;
    cout << T << endl;
}

Measured memory_bytes: 256
N=int(input())
st=[list(input().split()) for i in range(N)]
X=input()
num=0
for i in range(N):
    if st[i][0]==X:
        num=i+1
        break
ans=0
for i in range(num,N):
    ans+=int(st[i][1])
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	string N;
	cin >> N;
	auto ans = 0ll;
	auto len = (int)N.length();
	auto next = 0;
	for (auto i = 0; i < len; ++i)
	{
		auto j = len - 1 - i;
		auto val = N[j] - '0' + next;
		if (val > 5)
		{
			next = 1;
			ans += 10 - val;
		}
		else if (val == 5 && j > 0)
		{
			auto nextVal = N[j - 1] - '0';
			if (nextVal >= 5)
			{
				next = 1;
				ans += 10 - val;
			}
			else
			{
				next = 0;
				ans += val;
			}
		}
		else
		{
			next = 0;
			ans += val;
		}
	}
	ans += next;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1412
#include <bits/stdc++.h>
using namespace std;
int dp[3001][3001];
int main() {
	string s,t;
	cin>>s>>t;
	int i,j;
	int n=s.length(),m=t.length();
	for(i=0;i<=s.length();i++)
	{
		for(j=0;j<=t.length();j++)
		{
			if(i==0||j==0)dp[i][j]=0;
			else if(s[i-1]==t[j-1])dp[i][j]=max(dp[i][j],1+dp[i-1][j-1]);
			else
			dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	string ans="";
int ctr=dp[n][m];
        int r=m;
        for(int i=n;i>=1;i--)
        {
            for(int j=r;j>=1;j--)
            {
                if(dp[i][j]==ctr&&s[i-1]==t[j-1])
                {
                    ans+=s[i-1];
                 //   r=j-1;
                    ctr--;
                    break;
                }
            }
        }
        reverse(ans.begin(),ans.end());
        
cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 38800
import java.util.Scanner;
//import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = 0;
		for(int i=1; i<=5; i++){
			if(sc.nextInt() == 0){
				a = i;
			}
		}
		System.out.println(a);
	}
}


Measured memory_bytes: 35772
import java.io.*;
import java.util.*;

public class Main{

	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader(){
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		public String next(){
			try{
				while(st==null||!st.hasMoreElements()){
					st = new StringTokenizer(br.readLine());
				}
			}catch(Exception e){
				e.printStackTrace();
			}
			return st.nextToken();
	
		}
		public int nextInt(){
			return Integer.parseInt(next());
		}
		public long nextLong(){
			return Long.parseLong(next());
		}
		public double nextDouble(){
			return Double.parseDouble(next());
		}
		public String nextLine(){
			String s = "";
			try{
				s = br.readLine();
			}catch(Exception e){
				e.printStackTrace();
			}	
			return s;		
		}
	} 
	
	public static void main(String[] args){
		FastReader in = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		int n = in.nextInt();
		int m = in.nextInt();
		int a[] = new int[n];
		int b[] = new int[n];
		int c[] = new int[m];
		int d[] = new int[m];

		for(int i =0; i<n;i++){
			a[i] = in.nextInt();
			b[i] = in.nextInt();
		}
		for(int i =0; i < m;i++){
			c[i] = in.nextInt();
			d[i] = in.nextInt();
		}	
		int prevres = 0;
		int min = 0;
		for(int i = 0; i < n; i++){
			int res = Integer.MAX_VALUE;
			for(int j = 0; j < m;j++){
				prevres = res;
				res = Math.min(Math.abs(c[j]-a[i])+Math.abs(d[j]-b[i]),res);
				if(res!=prevres)
				min = j+1;
				
			}
			out.println(min);
			
		}	
		out.flush();
		out.close();  
	}

}





Measured memory_bytes: 21332
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        char[] charAr = input.toCharArray();
        
        Map<Character,Integer> map = new HashMap<>();
        for(int i = 0; i < charAr.length; i++){
            if(!map.containsKey(charAr[i])){
                map.put(charAr[i], 1);
            } else {
            	map.put(charAr[i], map.get(charAr[i]) + 1);
            }
        }
        if(map.size() == 2 && map.get(charAr[0]) == 2){
            System.out.println("Yes");
        } else{
            System.out.println("No");
        }
    }
}


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

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n, m;
    cin >> n >> m;
    Graph G(n);

    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    queue<int> que;
    que.push(0);
    vector<int> dist(n, -1);
    dist[0] = 0;

    while(!que.empty()) {
        int v = que.front();
        que.pop();
        for (auto nv : G[v]) {
            if (dist[nv] != -1) continue;
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }

    if (dist[n-1] == 2) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;

    return 0;
}

Measured memory_bytes: 13168
import sys

readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = list(map(int, readline().split()))
b = list(map(int, readline().split()))


def f(md, pos):
    res = 0
    fpos = -2
    for av in a:
        while True:
            if pos != -1 and av + b[pos] >= md:
                pos -= 1
            else:
                if fpos == -2:
                    fpos = pos
                res += pos + 1
                break
    return res, fpos


def solve():
    dp = [0] * 31
    for i in range(28, -1, -1):
        md = pow(2, i + 1)
        for j in range(n-1, -1, -1):
            b[j] %= md
            a[j] %= md
        a.sort()
        b.sort()
        pos = n - 1
        res3, pos = f(md // 2 * 3, pos)
        res2, pos = f(md // 2 * 2, pos)
        res1, pos = f(md // 2, pos)
        dp[i] += (n * n - (res1 + res3 - res2)) % 2
    t = 0
    for i in range(31):
        t += pow(2, i) * dp[i]
    print(t)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 90760
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        
        List<Character> used = new ArrayList<Character>();
        
        for(int i = 0; i < s.length(); i++){
            char c = s.charAt(i);
            
            if(used.contains(c)){
                System.out.println("no");
                return;
            }
            used.add(c);
        }
        System.out.println("yes");
    }
}


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

int isSo(int a, int b) {
  int temp;
  if(a > b) temp = b;
  else temp  = a;
  for(int i = 2; i <= temp; i++) {
    if(a % i == 0 && b % i == 0) return 0;
  }
  return 1;
}
int mod26(int x) {
  return x % 26;
}

int main(void) {
  string str, out;
  int n;
  int flag;
  cin >> n;
  getchar();
  for(int i = 0; i < n; i++) {
    getline(cin, str);
    out = str;
    flag = 0;
    for(int a = 1; a <= 26; a++) {
      if(!isSo(a, 26)) continue;
      for(int b = 1; b <= 26; b++) {
	for(int j = 0; j < (int)str.length(); j++) {
	  if(str[j] == ' ') out[j] = str[j];
	  else out[j] = (char)(mod26(a*((int)str[j]-(int)'a')+b)+(int)'a');
	}
	for(int j = 0; j < out.length()-3; j++) {
	  string temp;
	  temp = out.substr(j,4);
	  if(temp == "that" || temp == "this") {
	    flag = 1;
	    break;
	  }
	}
	if(flag) break;
      }
      if(flag) break;
    }
    cout << out << endl;
  }
  return 0;
}

Measured memory_bytes: 924
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
  int a,b,d=0;
  cin>>a;
  int x[101]={0};
  for(int i=1;i<=a;i++)
   {
     cin>>b;
     x[b]=1;
   }
   for(int j=1;j<=100;j++)
     d+=x[j];
   cout<<d;
  system ("pause");
 return 0;
}

Measured memory_bytes: 504
S = input()
T = input()
ans = float('inf')
for i in range(len(S)-len(T)+1):
    st = S[i:len(T)+i]
    count = 0
    for j in range(len(T)):
        if st[j]!=T[j]:
            count+=1
    ans = min(ans,count)
print(ans)

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

int main(){
  int n,m,x,y,cn1=0,cn2 =0;
  cin >> n >> m >> x;
  int a[m];
  for(int i=0;i<m;i++){
    cin >> a[i];
    if(a[i]>x)cn2++;
    else cn1++;
  }
  cout << min(cn1,cn2) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define vi vector <int>
#define si set <int>
#define mii map <int,int>
#define pii pair <int,int>
#define endl "\n"
#define FOR(P,Q) for(int P=0;P<(Q);P++)
#define FORR(P,Q) for(int P=1;P<=(Q);P++)
#define rep(P,R,Q) for(int P=(R);P<=(Q);P++)
#define repb(P,R,Q) for(int P=(R);P>=(Q);P--)
#define pb push_back
#define eb emplace_back
#define bug(P) cerr<<P<<" "
#define NL cerr<<endl
#define D1(arr,a) rep(P,1,a) bug(arr[P]) 
#define F first
#define S second
typedef long long ll;
typedef long double ld;
using namespace std;


    
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("error.txt","w",stderr);
    #endif
    int tces=1;
    // cin>>tces;
    while(tces--){
        string s;
        cin>>s;
        int ans=0,m=0;
        FOR(i,3){
            if(s[i]=='R')
                ans++;
            else{
                m=max(m,ans);
                ans=0;
            }
        }
        m=max(m,ans);
        cout<<m;
    }
    
return 0;
}

Measured memory_bytes: 3648
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline int read()
{
	int f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x);putchar(' ');}
inline void pr2(int x){write(x);putchar('\n');}
const int MAXN=100005;
struct edge{int x,y,next;}a[2*MAXN];int len,last[MAXN];
void ins(int x,int y){len++;a[len].x=x;a[len].y=y;a[len].next=last[x];last[x]=len;}
int du[MAXN],dep[MAXN],mn[MAXN],n,m;
bool vis[MAXN];
int fa[25][MAXN],bin[25];
void dfs(int x)
{
	vis[x]=1;mn[x]=(1<<31-1);
	for(int i=1;bin[i]<=dep[x];i++)fa[i][x]=fa[i-1][fa[i-1][x]];
	for(int k=last[x];k;k=a[k].next)
	{
		int y=a[k].y;
		if(!vis[y])
		{
			fa[0][y]=x;
			dep[y]=dep[x]+1,dfs(y);
			mn[x]=min(mn[x],mn[y]);
		}
		else mn[x]=min(mn[x],dep[y]);
	}
}
int jump(int x,int u)
{
	for(int i=20;i>=0;i--)if(bin[i]<=u)x=fa[i][x],u-=bin[i];
	return x;
}
int cal[MAXN],ln;
int vi[MAXN],tim,sum[MAXN];
int check(int x)
{
	ln=(x!=1);cal[1]=0;tim++;
	for(int k=last[x];k;k=a[k].next)
	{
		int y=a[k].y;
		if(dep[y]<dep[x])cal[1]++;
		else 
		{
			int u=jump(y,dep[y]-dep[x]-1);
			if(vi[u]!=tim)vi[u]=tim,sum[u]=0;
			sum[u]++;
		}
	}
	for(int k=last[x];k;k=a[k].next)if(dep[a[k].y]==dep[x]+1)
	{
		if(mn[a[k].y]>dep[x])cal[1]+=sum[a[k].y];
		else cal[++ln]=sum[a[k].y];
	}
	int ct=0;
	for(int i=1;i<=ln;i++)ct+=(cal[i]&1);
	if(ct&1)return false;
	return ln-ct+ct/2-1;
//	return true;
}
int main()
{
	bin[0]=1;for(int i=1;i<=20;i++)bin[i]=bin[i-1]<<1;
	n=read();m=read();
	for(int i=1;i<=m;i++)
	{
		int x=read(),y=read();
		ins(x,y);ins(y,x);
		du[x]++;du[y]++;
	}
	for(int i=1;i<=n;i++)if(du[i]&1)return puts("No"),0;
	dfs(1);
	int cnt=0;
	for(int i=1;i<=n;i++)
		cnt+=check(i);
	puts(cnt>=2?"Yes":"No");
	return 0;
}


Measured memory_bytes: 16384
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())

    b_min = INF
    a_min = 0
    for _ in range(N):
        A, B = map(int, readline().split())
        if B < b_min:
            b_min = B
            a_min = A

    print(a_min + b_min)


if __name__ == '__main__':
    main()


Measured memory_bytes: 73796
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplt(n): return [tuple(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
ans = (10**n - 2*(9**n) + 8**n) % mod
print(ans)

Measured memory_bytes: 32908
N = int(input())
A = list(map(int, input().split()))

left = 0
right = 0
length = 0
sm = 0
ans = 0
while left!=N or right!=N:
    if right == N:
        sm -= A[left]
        length -= 1
        left += 1
    elif left == right or (sm&A[right] == 0):
        sm += A[right]
        length += 1
        right += 1
        ans += length
    else:
        sm -= A[left]
        length -= 1
        left += 1

    
print(ans)

Measured memory_bytes: 24840
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
using namespace std;

const int N = 7777;
int n, k, s;
int inf = 1e9;
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("flow2.in", "r", stdin);
    //freopen("flow2.out", "w", stdout);
    cin >> n >> k >> s;
    if (k == 0){
        if (s == inf){
            for (int i = 1; i <= n; i++){
                cout << 1 << " ";
            }
        }
        else {
            for (int i = 1; i <= n; i++){
                cout << inf << " ";
            }
        }
        return 0;
    }
    if (s == inf){
        for (int i = 1; i <= k; i++){
            cout << inf << " ";
        }
        for (int i = k + 1; i <= n; i++){
            cout << 1 << " ";
        }
    }
    else {
        for (int i = 1; i <= k; i++){
            cout << s << " ";
        }
        for (int i = k + 1; i <= n; i++){
            cout << inf << " ";
        }
    }
    return 0;
}


Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<vector>

using namespace std;

void printEdge(int W) {
    for(int x = 0; x < W + 2; x++) {
        cout << "#";
    }

    cout << endl;
}

int main() {
    int H, W;

    cin >> H >> W;

    string S[H];
    for(int y = 0; y < H; y++) {
        cin >> S[y];
    }

    printEdge(W);
    for(int y = 0; y < H; y++) {
        cout << "#" << S[y] << "#" << endl;
    }
    printEdge(W);

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	private static int sum(int num) {
		int result = (1+num)*num/2;
		return result;
	}

	private static double kitai(int qi_n, int pi_n) {
		return qi_n / (double)pi_n;
	}

	public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	int n = sca.nextInt();
	int k = sca.nextInt();
	int[] pi = new int[n];
	int[] qi = new int[n];
	double[] resu = new double[n];  // n番目までの期待値の累積和
	double result = 0.0;
	double loop = 0.0;
	for(int i = 0; i < n; i++) {
		pi[i] = sca.nextInt();
		qi[i] = sum(pi[i]);
	}
	for(int i = 0; i < n; i++) {
		if(i == 0) {
			resu[i] = kitai(qi[i], pi[i]);
			continue;
		}
		resu[i] = resu[i-1] + kitai(qi[i], pi[i]);
	}

	result = resu[k-1];
	for(int i = k; i < n; i++) {
		loop = resu[i] - resu[i-k];
		if(result < loop) {
			result = loop;
		}
	}
	System.out.println(result);

	// 後始末
	sca.close();
	}
}

Measured memory_bytes: 86404
#include <iostream>

using namespace std;

int main(){
    int N;
    cin>>N;
    
    for(int i=1;i<10;i++){
        for(int j=1;j<10;j++){
            if(i*j==N){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i,N){
        cin >> A.at(i);
    }
    ll length = 0;
    REP(i,N){
        length += A.at(i);
    }
    ll half = length/2;
    ll half1 = 0;
    ll ans=0;
    REP(i,N){
        half1 += A.at(i);
        if(half1>half){
            if(i==0){
                half1 = length - half1;
                ans = length - 2 * half1;
                break;
            }
            half1 -= A.at(i);
            if(length - 2 * half1 > 2 * half1 + 2 * A.at(i) - length){
                ans = 2 * half1 + 2 * A.at(i) - length;
            }
            else{
                ans = length - 2 * half1;
            }
            break;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>

int main(void){
    int n;
    std::cin >> n;

    double inverseSum = 0;

    for(int i = 0; i < n; i++){
        int a;
        std::cin >> a;

        inverseSum += 1.0 / a;
    }

    double ans = 1.0;

    ans /= inverseSum;

    std::printf("%lf",ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<long long> v(N), noten;
    for (int i = 0; i < N; ++i){
        cin >> v[i];
        if (v[i] % 10 != 0) noten.push_back(v[i]);
    }

    int sum = accumulate(v.begin(), v.end(), 0);

    if (sum % 10 != 0) cout << sum << endl;
    else {
        if (noten.size() == 0) cout << 0 << endl;
        else cout << sum - *std::min_element(noten.begin(), noten.end()) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    string s;
    cin >> n >> s;
    ll l = 0, h = n;
    while((l + 1) < h) {
        ll m = (l + h) / 2;
        bool f = false;
        rep(i, n - m) {
            string ss = s.substr(i, m);
            if (s.rfind(ss) >= (i + m)) {
                f = true;
                break;
            }
        }
        if (f) l = m;
        else h = m;
    }
    cout << l << endl;
    return 0;
}


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

using namespace std;

int k,q;

long long modm(int x,int m){
    if(x%m == 0) return m;
    return x%m;
}
void solve(){
    int i,j;
    string str;
    cin >> k >> q;
    vector<long long> d(k);
    for(i = 0;i < k;i++) cin >> d[i];
    for(i = 0;i < q;i++){
        long long n,x,m;
        cin >> n >> x >> m;
        vector<long long> dm(k);
        for(j = 0;j < k;j++) dm[j] = modm(d[j],m);
        long long sd = 0;
        for(j = 0;j < k;j++) sd += dm[j];
        sd *= (n-1) / k;
        sd += x%m;
        for(j = 0;j < (n-1)%k;j++) sd += dm[j];
        cout << n-1-sd/m << endl;
    }
}

int main(){
    solve();
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MAX 2000005
#define MOD 1000000007
#define MOD2 998244353
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define vi vector<ll>
#define vp vector<pii>
#define all(v) v.begin(),v.end()
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

ll mexp(ll a, ll b){
    ll ans=1;
    a%=MOD;
    while(b){
        if(b&1) ans=ans*a%MOD;
        b>>=1;
        a=a*a%MOD;
    }
    return ans;
}

int main(){
    IOS
    int n;
    cin>>n;
    int a[n+1],b[n+1];
    FOR(i,1,n+1){
        cin>>a[i];
        b[i]=a[i];
    }
    sort(b+1,b+n+1);
    int m=(b[n/2]+b[n/2+1])/2;
    FOR(i,1,n+1){
        if(a[i]<=m){
            cout<<b[n/2+1]<<endl;
        }
        else{
            cout<<b[n/2]<<endl;
        }
    }


    cerr<<"Time: "<<1.0/CLOCKS_PER_SEC<<" ms"<<endl;
    return 0;
}

Measured memory_bytes: 3712
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(S: str):
    n = len(S)
    ret = [0] * n
    cur = 'R'
    cnt = 1
    r_idx = 0
    for i in range(1, n):
        c = S[i]
        if c == cur:
            cnt += 1
        elif c == 'L':
            l_idx = i
            cur = 'L'
        else:
            r = l_idx - r_idx
            l = i - l_idx
            ret[l_idx - 1] = (r // 2) + r % 2 + (l // 2)
            ret[l_idx] = (r // 2) + (l // 2) + l % 2 
            r_idx = i
            cnt = 1
            cur = 'R'
    r = l_idx - r_idx
    l = n - l_idx
    ret[l_idx - 1] = (r // 2) + r % 2 + (l // 2)
    ret[l_idx] = (r // 2) + (l // 2) + l % 2 
    print(' '.join([str(r) for r in ret]))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 10740
# -*- coding: utf-8 -*-       
import sys

n, h = list(map(int,input().split()))
a = [0 for i in range(n)]
b = [0 for i in range(n)]

for i in range(n):
    a[i], b[i] = list(map(int,input().split()))

MAX_a = max(a)
bs = sorted(b)[::-1]
ans = 0
for i in bs:
    if(i<=MAX_a):
        break
    ans += 1
    h -= i
    if(h<=0):
        print(ans)
        sys.exit()
ans += h//MAX_a
if(h%MAX_a != 0):ans += 1
print(ans)
    

Measured memory_bytes: 12632
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    char c;
    cin >> c;
    cout << (char)(c+1) << endl;
    return 0;
}

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

using namespace std;

void setIO() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef DEBUG
    //freopen("solution.out", "w", stdout);
    freopen("1.in", "r", stdin);
#endif
}

const int maxn = 101, maxw = 1e5 + 1;
const long long inf = 1e18;
long long dp[maxn][maxw];

int main() {
    setIO();

    int n, w;
    cin >> n >> w;
    vector<pair<int, int> > item(n); // first = weight, second = value
    for (int i = 0; i < n; ++i) {
        cin >> item[i].first >> item[i].second;
        for (int j = 0; j < w + 1; ++j) {
            dp[i][j] = -inf;
        }
    }
    dp[0][item[0].first] = item[0].second;
    long long sol = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j <= w; ++j) {
            if (item[i].first <= j) {
                dp[i][j] = max(dp[i][j], (long long) item[i].second);
            }
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            if (j + item[i + 1].first <= w) {
                dp[i + 1][j + item[i + 1].first] = max(
                        {dp[i + 1][j + item[i + 1].first], dp[i][j] + item[i + 1].second});
            }
            if (i == n - 1) {
                sol = max(sol, dp[i][j]);
            }
        }
    }
    cout << sol << "\n";
    return 0;
}


Measured memory_bytes: 82536
// https://atcoder.jp/contests/agc040/tasks/agc040_a
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int len = s.length();
    vector<int> v(len + 1);
    for (int i = -1; i < len; i++) {
        if (i == -1 || i == len - 1 || s[i] == '<' && s[i + 1] == '>') {
            int t1 = 0, t2 = 0;
            int pos = i;
            while (pos >= 0 && s[pos] == '<') {
                t1++;
                pos--;
            }
            pos = i + 1;
            while (pos < len && s[pos] == '>') {
                t2++;
                pos++;
            }
            v[i + 1] = max(t1, t2);
            FOR(j, 1, t1) { v[i - j] = t1 - j; }
            FOR(j, 1, t2) { v[i + j + 1] = t2 - j; }
        }
    }
    cout << accumulate(ALL(v), 0LL) << endl;
    return 0;
}


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

int main() {
	
	int n;
	cin >> n;
	vector<int> a(n);
	for(auto &i:a) cin >> i;
	int q;
	cin >> q;
	vector<int> m(q);
	for(auto &i:m) cin >> i;
	set<int> s;
	for(int i=0; i<(1<<n); i++){
		int cnt =0;
		for(int j=0; j<n; j++){
			if(i&(1<<j)) cnt += a.at(j);
		}
		s.insert(cnt);
		
	}
	for(int i=0; i<q; i++) cout << (s.count(m.at(i))?"yes":"no") << endl;
	
}


Measured memory_bytes: 3132
N = int(input())
row = input().split()
T = int(row[0])
A = int(row[1])
H = input().split()
H = list(map(int, H))

for i in range(N):
    H[i] = abs(T - H[i] * 0.006 - A)
print(H.index(min(H))+1)

Measured memory_bytes: 3060
#include <iostream>

int main(){
    
    int a,b;
    std::cin>>a>>b;
    
    if(a>b){
        std::cout << "a > b" << std::endl; 
    }
    else if(a<b){
        std::cout << "a < b" << std::endl; 
    }
    else{
        std::cout << "a == b" << std::endl; 
    }
    
    return 0;
}


Measured memory_bytes: 3104
S = input()
import datetime

strptime = datetime.datetime.strptime

try:
  strptime(S, '%y%m')
  can_be_yymm = True
except ValueError as e1:
  can_be_yymm = False

try:
  strptime(S, '%m%y')
  can_be_mmyy = True
except ValueError as e2:
  can_be_mmyy = False

if can_be_yymm and can_be_mmyy:
  print('AMBIGUOUS')
elif can_be_yymm and not can_be_mmyy:
  print('YYMM')
elif not can_be_yymm and can_be_mmyy:
  print('MMYY')
else:
  print('NA')


Measured memory_bytes: 4696
#include <iostream>
#include <algorithm>
#include <map>
#include <set>

using namespace std;

int main(){
    set<int> st;
    int n,i=0,in,f;
    cin >> n;

    while(n!=i){    
        cin >>in>>f;
        if(in==0){
            st.insert(f);
            cout << st.size() << endl;
        }
        else{
            if(st.count(f)== 0){
                cout << 0 << endl;
            }
            else{
                cout << 1 << endl;
            }
        }
    i++;
    }
    
return 0;
}


Measured memory_bytes: 12380
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t; cin >> s >> t;
    if (t.substr(0, (int)s.size()) == s) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 3652
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0
for i in range(a+1):
    for n in range(b+1):
        for m in range(c+1):
            if 500*i + 100*n + 50*m == x:
                count += 1
print(count)

Measured memory_bytes: 3060
N, M = map(int, input().split())
p = [int(i) for i in input().split()]
graph = [[] for _ in range(N+1)]
group = [0]*(N+1)
ans = 0
for _ in range(M):
    x, y = map(int, input().split())
    graph[x].append(y)
    graph[y].append(x)
for i, num in enumerate(p, 1):
    space = [i]
    for point in space:
        if not group[point]:
            group[point] = i
            space.extend(graph[point])
    ans += (group[num] == group[i])
print(ans)

Measured memory_bytes: 28900
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
	int N,y[110000],x[110000],t[110000];
	cin >> N;
	t[0]=x[0]=y[0]=0;
	bool can = true;
	for(int i=0; i<N; i++){
	    cin >> t[i+1] >> x[i+1] >> y[i+1];
	}
	for(int i=0; i<N; i++){
		int dt = t[i+1] - t[i];
		int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
		if(dt<dist) can=false;
		if(dist%2 != dt%2) can =false;
	}
	if(can) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    char a, b;
    cin >> a >> b;
    cout << (a == 'H' ^ b == 'H' ? 'D' : 'H') << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <string>
#include <iomanip>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <math.h>
#include <stack>
#include <cctype>
using namespace std;
#define int long long
#define pi 2*acos(0.0)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)

signed main()
{
	int n, m;
	cin >> n >> m;
	vector<int> brg(n,0);
	int tmp,tmp2;
	REP(i, m){
		cin >> tmp >> tmp2;
		brg[tmp - 1]++;
		brg[tmp2 - 1]++;
	}
	REP(i, n){
		cout << brg[i] << endl;
	}
}

Measured memory_bytes: 256
M,D = list(map(int, input().strip().split()))
count = 0
for m in range(2,M+1):
    for d in range(11, D+1):
        if ((d%10) >= 2) and (int(d/10) >= 2) and (m == int(d/10) * (d%10)):
            count+=1
print(count)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    for (int z = 0; z < t; ++z) {
        lint n, a, b, c, d;
        cin >> n >> a >> b >> c >> d;
        map<lint, lint> cost;
        cost[1]                  = d;
        cost[0]                  = 0;
        cost[2]                  = min(d + a, 2 * d);
        function<lint(lint)> dfs = [&](lint k) {
            if (cost.count(k) != 0)
                return cost[k];
            lint ret = inf;
            if (inf / d >= k)
                ret = k * d;
            lint l  = k / 2 * 2;
            lint r  = l + 2;
            ret     = min(ret, dfs(l / 2) + a + d * abs(k - l));
            ret     = min(ret, dfs(r / 2) + a + d * abs(k - r));
            l       = k / 3 * 3;
            r       = l + 3;
            ret     = min(ret, dfs(l / 3) + b + d * abs(k - l));
            ret     = min(ret, dfs(r / 3) + b + d * abs(k - r));
            l       = k / 5 * 5;
            r       = l + 5;
            ret     = min(ret, dfs(l / 5) + c + d * abs(k - l));
            ret     = min(ret, dfs(r / 5) + c + d * abs(k - r));
            cost[k] = ret;
            return ret;
        };

        cout << dfs(n) << endl;
    }
    return 0;
}

Measured memory_bytes: 4860
use std::cmp;

const INF: i64 = 1e17 as i64;

fn main() {
    use std::io::{stdin, stdout, BufWriter, Write};
    let (s, out) = (stdin(), stdout());
    let (mut sc, mut out) = (Scanner(s.lock()), BufWriter::new(out.lock()));

    let l: usize = sc.read();
    let a: Vec<i64> = sc.vec(l);

    let mut dp = [0; 5];
    for a in a.into_iter() {
        let mut next = [INF; 5];
        for from in 0..5 {
            for to in from..5 {
                let cost = match to {
                    0 | 4 => a,
                    1 | 3 => {
                        if a == 0 {
                            2
                        } else {
                            a % 2
                        }
                    }
                    2 => (a + 1) % 2,
                    _ => unreachable!(),
                };
                next[to] = cmp::min(next[to], dp[from] + cost);
            }
        }
        dp = next;
    }

    write!(out, "{}", dp.into_iter().min().unwrap()).unwrap();
}

pub struct Scanner<R>(R);

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> k(m);
    vector<int> s(n);
    bool flag = true;
    int cnt = 0;
    rep(i,m){
        cin >> k[i];
        rep(j,k[i]){
            int s_in; cin >> s_in;
            s[i] += pow(2,n-s_in);
        }
    }
    vector<int> p(m);
    rep(i,m) cin >> p[i];

    rep(i,1<<n){
        rep(j,m){
            if(__builtin_popcount(s[j] & i) % 2 != p[j]) flag = false;
        } 
        if(flag) {cnt++;}
        flag = true;
    }

    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define pb(v) push_back(v)
#define mp(x, y) make_pair(x, y)
#define fi first
#define se second
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using P = pair<int ,int>;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int n; cin >> n;
    vector<int> vec = {n/100, (n/10)%10, n%10};
    if (count(all(vec), 7)) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int arr[100],n;
bool pd(){
    for(int i=1;i<n;i++)
        if(arr[i]>arr[i+1])return 0;
    return 1;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)cin>>arr[i];
    int ans=0;
    if(pd())ans=1;
    for(int i=1;i<=n;i++)
    for(int j=i+1;j<=n;j++){
        swap(arr[i],arr[j]);
        if(pd())ans=1;
        swap(arr[i],arr[j]);
    }
    if(ans==1)puts("YES");
    else puts("NO");
}


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
*/

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = { -1, 0, +1, 0 };
int dx4[4] = { 0, +1, 0, -1 };
int dy8[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };
int dx8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
	return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
	if (r == 0 || r == n){
		return 1;
	}
	else if (r == 1){
		return n;
	}
	return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
	r = n - r;
	ll ret = 1;
	for (ll i = n; i >= r + 1; i--) ret *= i;
	return ret;
}

//-----------------------ここから-----------

int main(void){
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];

	int ans = 0;

	for (int i = 0; i < n - 1; i++){
		if (a[i] == a[i + 1]){
			ans++;
			i++;
		}
	}

	cout << ans << endl;
} 


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

const double EPS = 1E-10;

double A[18][18];
double R[18][18][18];
double dp[(1<<16)][18];

double solve(int st,int id){
  if( dp[st][id] > -EPS ) return dp[st][id];
  double ret = 0.0;
  if( id == N ) return dp[st][id] = 1.0;
  for(int i=0;i<M;i++){
    if( st & (1<<i) ) continue;
    double at=0.0;
    for(int j=id;j<=N;j++){
      at += solve(st|(1<<i),j)*R[i][id][j];
    }
    ret = max( ret, at );
  }
  return dp[st][id] = ret;
}

int main(){
  fill(dp[0],dp[(1<<16)],-1.0);
  
  cin >> M >> N;
  for(int i=0;i<M;i++)
    for(int j=0;j<N;j++) cin >> A[i][j];
  for(int i=0;i<M;i++){
    for(int j=0;j<N;j++){
      R[i][j][j] = (1.0-A[i][j]);
      double r = A[i][j];
      for(int k=j+1;k<N;k++){
        R[i][j][k] = r * (1.0-A[i][k]);
        r *= A[i][k];
      }
      R[i][j][N] = r;
    }
  }
  printf("%.10lf\n",solve(0,0));  
}

Measured memory_bytes: 10512
import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')

a = input().strip()
if a.isupper():
    print('A')
else:
    print('a')

Measured memory_bytes: 85036
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
typedef pair<int,int> P;
using vi=vector<long long>;
using vvi=vector<vector<long long>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const int inf=1000000009;
void chmin(auto &a,auto b){if(b<a)a=b;}
void chmax(auto &a,auto b){if(a<b)a=b;}

int main(){
  string s;cin>>s;
  if(s=="Sunny")cout<<"Cloudy"<<endl;
  else if(s=="Cloudy")cout<<"Rainy"<<endl;
  else cout<<"Sunny"<<endl;
}

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ans = 0

for i in range(n):
    if A[i] >= 0 and A[i] <= B[i]:
        ans += A[i]
        B[i] -= A[i]
        A[i] = 0
    else:
        ans += B[i]
        B[i] = 0
        A[i] -= B[i]
    
    if B[i] > 0 and A[i+1] <= B[i]:
        ans += A[i+1]
        A[i+1] = 0
        B[i] -= A[i+1]
    elif B[i] > 0 and A[i+1] > B[i]:
        ans += B[i]
        A[i+1] -= B[i]
        B[i] = 0
print(ans)

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

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

using namespace std;
using ll = long long;

int main(void) {
  int n;
  cin >> n;
  vector<int> vec(n);
  int m = 0;
  rep(i, n) {
    cin >> vec[i];
    if (m < vec[i]) {
      m = vec[i];
    }
  }
  vector<int> cnt(m+1);
  rep(i, n) {
    if (vec[i] == 0) {
      cnt[0]++;
      cnt[1]++;
    } else {
      cnt[vec[i] - 1]++;
      cnt[vec[i]]++;
      cnt[vec[i] + 1]++;
    }
  }
  std::vector<int>::iterator iter = max_element(cnt.begin(), cnt.end());
  cout << *iter << endl;


  return 0;
}



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

int main()
{
    char c;
    cin >> c;
    if (c == 'A')
        cout << 'T';
    else if (c == 'T')
        cout << 'A';
    else if (c == 'C')
        cout << 'G';
    else
        cout << 'C';
}


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

int main() {
  int a, b, L;
  cin >> a >> b;
  
  L = a * b % 2;
  if (L == 1){
      cout << "Odd" << endl;
  }
  else {
      cout << "Even" << endl;
  }
}
  

Measured memory_bytes: 256
#include <cstdio>
#include <deque>

int n;
std::deque<int> q;

int main()
{
    scanf("%d", &n);
    for (int i = 0, a; i < n; ++i) {
        scanf("%d", &a);
        if ((i ^ n) & 1) q.push_front(a); else q.push_back(a);
    }

    for (int i = 0; i < n; ++i) printf("%d%c", q[i], i == n - 1 ? '\n' : ' ');

    return 0;
}


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

int main() {
	ll n;
	cin >> n;
	vector<ll> a;
	vector<ll> cnt(n, 0);
	for (ll i = 0; i < n; ++i) {
		ll tmp;
		cin >> tmp;
		a.push_back(tmp - 1);
		++cnt[tmp - 1];
	}
	ll preans = 0;
	for (ll x : cnt) {
		preans += x * (x - 1) / 2;
	}
	for (ll i = 0; i < n; ++i) {
		ll ans = preans;
		ll tai = cnt[a[i]];
		ans -= tai * (tai - 1) / 2;
		if (tai != 0) {
			ans += (tai - 1) * (tai - 2) / 2;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 5872