akhauriyash/Code-Regression huggingface dataset:
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

signed main(void)
{
  int n;
  cin >> n;
  VI v(n);
  REP(i, n) cin >> v[i];

  sort(ALL(v), greater<>());

  int a = 0, b = 0;
  REP(i, n) {
    if(i%2) b += v[i];
    else a += v[i];
  }
  cout << a - b << endl;

  return 0;
}


Measured memory_bytes: 256
from heapq import *
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=list(map(lambda x:x*(-1),a))
heapify(a)
for i in range(m):
    t=heappop(a)
    heappush(a,int(t/2))
print(-1*sum(a))

Measured memory_bytes: 20224
#include <iostream>
using namespace std;
int main(void){
  string s = "",t;
  while(getline(cin,t)){
      s = s+t;
  }

  for(int j='A';j<='Z';j++){
      int num=0;
      for(int i=0;i<s.size();i++){
             char c=s[i];
             if(c==j||c==j+32){
                 num++;
             }
      }
      cout << char(j+32) << " : " << num << endl;
  }

}


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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using Pair = pair<int, int>;
const ll mod = 1e9 + 7;

int main(int argc, char const* argv[])
{
  int h, n;
  cin >> h >> n;

  int s = 0;
  REP(i, n) {
    int a;
    cin >> a;
    s += a;
  }
  if (s >= h) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<ll> vint;
int main() {
  ll n,ans=0;
  cin >> n;
  vint l(n),r(n);
  for (ll i=0;i<n;i++) {
    cin >> l.at(i) >> r.at(i);
    ans += r.at(i)-l.at(i)+1;
  }
  cout << ans;
}

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

char str[200100];
int n,nxt[200100][26],dp[200100];

int DP(int idx) {
    if(idx<=-1) return 0;
    int &ret=dp[idx];
    if(ret!=-1) return ret;

    ret=n+1;
    for(int i=0;i<26;i++) ret = min(ret,DP(nxt[idx][i]-1)+1);
    return ret;
}
string ans;
void trace(int idx) {
    if(idx<=-1) return;
    for(int i=0;i<26;i++) if(DP(nxt[idx][i]-1)+1==DP(idx)) {
        trace(nxt[idx][i]-1);
        ans.push_back(i+'a');
        break;
    }
}
int main() {
    scanf("%d",&n);
    scanf("%s",str+1);

    int c[26]={0,};
    n=strlen(str+1);
    reverse(str+1,str+n+1);
    for(int i=1;i<=n;i++) {
        c[str[i]-'a']=i;
        for(int j=0;j<26;j++) nxt[i][j]=c[j];
    }
    memset(dp,-1,sizeof(dp));
    DP(n);
    trace(n);
    reverse(ans.begin(),ans.end());
    printf("%s\n",ans.c_str());
    
    return 0;
}


Measured memory_bytes: 22016
from collections import deque
''' 
INF = float('inf')
MOD = 10 ** 9 + 7
'''
## ここは１つにまとめれる
# dy = (0, -1, 0, 1)
# dx = (1, 0, -1, 0)
d=[(1,0),(0,1),(-1,0),(0,-1)]

    
H,W=map(int,input().split())
M = []
Max_list = []
for i  in range(H):
    t = input()
    M.append(t)
dist = [[-1]*W for _ in range(H)]
q = deque()
for i in range(H):
    for j in range(W):
        dist = [[-1]*W for _ in range(H)]
        if M[i][j] == '.':
            Ma = 0
            q.append((i, j))
            dist[i][j] = 0
            while q:
                cx,cy = q.popleft()
                for nx,ny in d:
                    x ,y= cx+nx,cy+ny
                    ''' ここの処理がをnotにしてわかりやすく
                    if x<0 or y<0 or x>=H or y>=W or dist[x][y]>0:
                        continue
                    '''
                    if 0<= x < H and 0<= y < W and dist[x][y]<=0:

                        if M[x][y] == "." and dist[x][y] == -1:
                            dist[x][y]=dist[cx][cy]+1
                            Ma = max(Ma,dist[x][y])
                            q.append((x,y))
            Max_list.append(Ma)

print(max(Max_list))

Measured memory_bytes: 3316
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int [] app = new int[N];
        int anc = 0;
        for(int i = 0;i < N;i++){
            int p = sc.nextInt();
            app[i] = p;
        }
        Arrays.sort(app);
        for(int i = 0;i < K;i++){
            anc += app[i];
        }
        System.out.println(anc);
    }
}

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

int main()
{
    int n, w[110] = {0}, sum=0;
    cin >> n;
    for (int i = 0; i < n;i++){
        cin >> w[i];
        sum += w[i];
    }

    int s1 = 0, min = INT_MAX;
    for (int i = 0; i < n;i++){
        s1 += w[i];
        if(abs((sum-s1)-s1)<min){
            min = abs((sum - s1) - s1);
        }
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

//#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

#define dump(x) cerr << #x << " = " << (x);
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    REP(i, tx - sx) {
        cout << "R";
    }
    REP(i, ty - sy) {
        cout << "U";
    }
    REP(i, tx - sx) {
        cout << "L";
    }
    REP(i, ty - sy) {
        cout << "D";
    }

    cout << "D";
    REP(i, tx - sx + 1) {
        cout << "R";
    }
    REP(i, ty - sy + 1) {
        cout << "U";
    }
    cout << "L";
    cout << "U";
    REP(i, tx - sx + 1) {
        cout << "L";
    }
    REP(i, ty - sy + 1) {
        cout << "D";
    }
    cout << "R";
    cout << endl;

    return 0;
}


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

bool to[20][20];
int p[20];

signed main(void){
  
  int N,M; cin >> N >> M;
  for(int i = 0; i < M; i++){ 
    int k; cin >> k;
    for(int j = 0; j < k; j++){
      int s; cin >> s; s--;
      to[s][i] = true;
    }
  }
  
  for(int i = 0; i < M; i++){ cin >> p[i];}
  int ans = 0;
  for(int bit = 0; bit < (1<<N); bit++){
    bool flag = true;
    vector<int> cnt(20,0);
    
    for(int i = 0; i < N; i++){ 
      if( bit >> i & 1 ){ 
        
        for(int j = 0; j < M; j++){
          if( to[i][j] ){ cnt[j]++;}
        }
      }
    }
    
    for(int i = 0; i < M; i++){ 
      if( cnt[i]%2 != p[i] ){ flag = false; }
    }
    if(flag){ ans++; }
    
  }
  
  cout << ans << endl;
  
  return 0;
}
    

Measured memory_bytes: 256
import math
import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
# import sys
# import bisect
# import numpy as np
# from scipy.special import comb


def count(n):

    if n % 2 == 0 or n < 3:
        return False

    count = 2
    for i in range(2, n):
        if n % i == 0:
            count += 1

    if count == 8:
        return True
    else:
        return False


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

    ans = 0
    for i in range(1, N + 1):
        if count(i):
            ans += 1

    print(ans)


list(itertools.combinations([1, 2, 3, 4], 2))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38512
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
#define N 500010
ll n;pair<ll,ll> a[N];
int main(){
    cin>>n;
    lol(i,n)cin>>a[i].first>>a[i].second;
    sort(a,a+n);
    ll sum=0,mini=-a[0].first,ans=0;
    lol(i,n){
	sum+=a[i].second;
	ans=max(ans,sum-a[i].first-mini);
	if(i<n-1){
	    mini=min(mini,sum-a[i+1].first);
	}
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 10936
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define F first
#define S second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n,m,s,t;
vector<int> v[100010];
bool visit[100010][3];
queue<int> q;
int main()
{
	cin >>n>>m;
	for (int i=0;i<m;i++)
	{
		int x,y;
		cin >>x>>y;
		x--,y--;
		v[x].push_back(y);
	}
	cin >>s>>t;
	s--,t--;
	visit[s][0]=1;
	q.push(s);
	q.push(0);
	while (!q.empty())
	{
		int x=q.front(); q.pop();
		int y=q.front(); q.pop();
		if (x==t && y%3==0)
		{
			cout <<y/3;
			return 0;
		}
		int yi=y+1;
		for (int i=0;i<v[x].size();i++)
		{
			int xi=v[x][i];
			if (visit[xi][yi%3]) continue;
			visit[xi][yi%3]=1;
			q.push(xi);
			q.push(yi);
		}
	} 
	cout <<"-1";
	return 0; 
}

Measured memory_bytes: 6016
from fractions import gcd
# from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7

input = sys.stdin.readline
#最初にソートしてるのに何故かヒープ使ってハマった
def main():
    n, c = map(int, input().split())
    stk = [tuple(map(int, input().split())) for i in range(n)]
    stk = sorted(stk, key=lambda x: x[0])

    ans = 1
    l = []
    l = [(stk[0][1], stk[0][2])]
    for i in range(1, n):
        ll = []
        for j in range(len(l)):
            v = l[j]
            if stk[i][2] == v[1]:
                if stk[i][0] < v[0]:
                    ll.append(v)
            else:
                if stk[i][0] - 0.5 < v[0]:
                    ll.append(v)
        ll.append(stk[i][1:])
        l = ll
        ans = max(ans, len(l))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 22044
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n,k = ma()
A = lma()
s = [0]*(n+1)
l = [0]*(n+1)
for i in range(n):
    s[i+1]=(s[i]+A[i])%k
    l[i+1]=(s[i+1]-(i+1))%k
ans = 0
co = collections.Counter(l[:min(n+1,k)])
for num,cnt in co.items():
    ans+=cnt*(cnt-1)//2
for i in range(k,n+1):
    co[l[i-k]]-=1
    ans+=co[l[i]]
    co[l[i]]+=1



print(ans)


Measured memory_bytes: 133476
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define ll long long
typedef pair<ll , ll > pii;
ll mod=998244353;
ll p=1e9+7;

 
int  main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t; cin>>s>>t;
    s+=t[t.length()-1];
    if(s==t) cout<<"Yes";
    else cout<<"No";
    
    return 0;
}

Measured memory_bytes: 3612
fn get_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let (s, w) = {
        let sw = get_line()
            .split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect::<Vec<i32>>();
        (sw[0], sw[1])
    };
    if s <= w {
        println!("unsafe");
    } else {
        println!("safe");
    }
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    Int(n);
    vector<pair<int, i_i> > data(n);
    for (int i = 0; i < n; i++) {
        cin >> data[i].sfir >> data[i].ssec;
        data[i].fir = data[i].sfir + data[i].ssec;
    }
    sort(all(data));

    vvi dp(n+1, vi(n+1, INF));
    dp[0][0] = 0;
    rep(i, n) {
        rep(j, i+1) {
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
            if (dp[i][j] <= data[i].sfir) {
                dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + data[i].ssec);
            }
        }
    }

    for (int i = n; i >= 0; i--) {
        if (dp[n][i] != INF) {
            cout << i << endl;
            return 0;
        }
    }
    cout << 0 << endl;

    return 0;
}


Measured memory_bytes: 195968
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int H, W;
	cin >> H >> W;
	int sty, stx, edy, edx;
	cin >> sty >> stx >> edy >> edx;
	--sty; --stx; --edy; --edx;
	vector<string> maps(H);
	REP(i, H) cin >> maps[i];
	
	vector<vector<int>> d(H, vector<int>(W, INF));
	
	struct Data {
		int y, x, d;
	};
	deque<Data> deq;
	d[sty][stx] = 0;
	deq.emplace_back(Data{sty, stx, 0});
	
	while (!deq.empty()) {
		Data cur = deq.front();
		deq.pop_front();
		if (d[cur.y][cur.x] < cur.d) continue;
		
		auto ok = [&](int y, int x) {
			return x >= 0 && x < W && y >= 0 && y < H && maps[y][x] == '.';
		};
			
		int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
		REP(k, 4) {
			int ny = cur.y + dy[k], nx = cur.x + dx[k];
			if (!ok(ny, nx)) continue;
			if (chmin(d[ny][nx], cur.d)) deq.emplace_front(Data{ny, nx, cur.d});
		}
		FOR(i, -2, 3) FOR(j, -2, 3) {
			int ny = cur.y + i, nx = cur.x + j;
			if (!ok(ny, nx)) continue;
			if (chmin(d[ny][nx], cur.d + 1)) deq.emplace_back(Data{ny, nx, cur.d + 1});
		}
	}
	if (d[edy][edx] == INF) puts("-1");
	else cout << d[edy][edx] << endl;
	return 0;
}


Measured memory_bytes: 9436
/** @Date    : 2017-07-09 19:57:01
  * @FileName: A.cpp
  * @Platform: Windows
  * @Author  : Lweleth (SoungEarlf@gmail.com)
  * @Link    : https://github.com/
  * @Version : $Id$
  */
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int ,int>
#define MP(x, y) make_pair((x),(y))
#define fi first
#define se second
#define PB(x) push_back((x))
#define MMG(x) memset((x), -1,sizeof(x))
#define MMF(x) memset((x),0,sizeof(x))
#define MMI(x) memset((x), INF, sizeof(x))
using namespace std;

const int INF = 0x3f3f3f3f;
const int N = 1e5+20;
const double eps = 1e-8;


int n, p;
LL a[N];
LL odd, eve;
int main()
{
	while(cin >> n >> p)
	{
		odd = eve = 0;
		for(int i = 0; i < n; i++)
		{
			scanf("%lld", a + i);
			if(a[i] % 2)
				odd++;
			else eve++;
		}
		LL ans = 1LL;
		ans = 1LL << (eve);
		if(odd != 0)
			ans *= 1LL << (odd - 1LL);
		if(odd == 0 && p == 1)
			ans = 0;
		printf("%lld\n", ans);
	}
    return 0;
}

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

using namespace std;
using ll = long long;

ll n;
ll a[200005];
vector<ll> V;
ll maximum = 0;
ll second_max = 0;

int main(){
  cin >> n;
  for(int i = 0; i < n; ++i){
    cin >> a[i];
    V.push_back(a[i]);
  }
  sort(V.begin(), V.end());
  maximum = V[n - 1];
  second_max = V[n - 2];
  for(int i = 0; i < n; ++i){
    if(a[i] == maximum){
      cout << second_max << endl;
    }else{
      cout << maximum << endl;
    }
  }
}

Measured memory_bytes: 4848
#include <iostream>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
using namespace std;

int main()
{

    long long int n, a[110000], cnt = 0, x;
    a[0] = 0;

    cin >> n;
    a[n + 1] = 0;
    for(int i = 1; i < n + 1; i++){
        cin >> a[i];
    }
    for(int j = 0; j < n + 1; j++){
        cnt += max(a[j] - a[j + 1], a[j + 1] - a[j]);
    }
    for(int i = 1; i < n + 1; i++){
        x = cnt;
        if(a[i - 1] < a[i] && a[i] < a[i + 1]) cout << x << endl;
        else if(a[i - 1] > a[i] && a[i] > a[i + 1]) cout << x << endl;
        else cout << x + min(a[i - 1] - a[i], a[i] - a[i - 1]) + min(a[i] - a[i + 1], a[i + 1] - a[i]) + max(a[i - 1] - a[i + 1], a[i + 1] - a[i - 1]) << endl;
    }



            return 0;
}


Measured memory_bytes: 2048
import sys

input_ = sys.stdin.readline

# 整数1個だけ
N = int(input_().strip())

rslt = ""
for _ in range(N):
    a, b = [int(x) for x in input_().strip().split(" ")]
    rslt += "Y" if a == b else "N"
print("Yes" if "YYY" in rslt else "No")

Measured memory_bytes: 61984
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> c(13);
  int n;cin >> n;
  for(int i=0;i<n;i++){
    int d;cin >> d;
    c[d]++;
  }
  for(int i=0;i<13;i++){
    if(i==0){
      if(c[i]){
        cout << 0 << endl;
        return 0;
      }
    }
    else if(i==12){
      if(c[i]>=2){
        cout << 0 << endl;
        return 0;
      }
    }
    else{
      if(c[i]>=3){
        cout << 0 << endl;
        return 0;
      }
    }
  }
  int ans=0;
  for(int i=0;i<(1<<11);i++){
    vector<bool> d(25);
    for(int j=0;j<11;j++){
      if(c[j+1]==2){
        d[j+1]=true;
        d[23-j]=true;
      }
      else if(c[j+1]==1){
        if((i>>j)&1){
          d[j+1]=true;
        }
        else{
          d[23-j]=true;
        }
      }
    }
    d[0]=d[24]=true;
    d[12]=(c[12]>=1);
    int cnt=1,res=25;
    for(int i=1;i<25;i++){
      if(!d[i]){
        cnt++;
      }
      else{
        res=min(res,cnt);
        cnt=1;
      }
    }
    ans=max(ans,res);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
while 1:
    a,op,b = raw_input().split()
    a=int(a)
    b=int(b)
    if op=="?":
        break
    elif op=="+":
        print a+b
    elif op=="-":
        print a-b
    elif op=="*":
        print a*b
    elif op=="/":
        print a/b

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

int main() {
  char c;
  cin >> c;
  if(c=='a' || c=='i' || c=='u' ||c=='e' || c=='o'){
    cout << "vowel" <<endl;
  }
  else{
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        s: chars,
    }
    let mut diff = vec![];
    for i in 0..2 * n {
        let ord = if i % 2 == 0 { 'B' } else { 'W' };
        if s[i] != ord {
            diff.push(i);
        }
    }
    if diff.len() != n {
        puts!("0\n");
        return;
    }
    const MOD: i64 = 1_000_000_007;
    let mut ans = 1;
    for i in 0..n {
        ans = ans * (diff[i] as i64 - 2 * i as i64) as i64 % MOD;
        ans = ans * (i + 1) as i64 % MOD;
    }
    puts!("{}\n", ans);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 12540
A = int(input())
B = int(input())
C = int(input())
X = int(input())//50
p = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 10*a + 2*b + c == X:
                p += 1
print(p)

Measured memory_bytes: 2940
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        //String str[]=br.readLine().split(" ");
        int n=Integer.parseInt(br.readLine());
        char c[]=br.readLine().toCharArray();
        int r=0,w=0;
        for(int i=0;i<n;i++)
        {
            if(c[i]=='R')
            r++;
            else
            w++;
        }
        if(w==0||r==0)
        pw.println(0);
        else
        {
            int cntr=0;
            for(int i=0;i<r;i++)
            {
                if(c[i]=='W')
                cntr++;
            }
            pw.println(cntr);
        }
        pw.flush();
        pw.close();
    }
}

Measured memory_bytes: 36404
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  ll h,w,n;
  cin >> h >> w >> n;
  map<pair<ll,ll>, ll> mp;

  rep(i,n) {
    ll x,y; cin >> y >> x;
    rep(j,3)rep(k,3) {
      if (y-j <= h-2 and x-k <= w-2 and y-j >= 1 and x-k >= 1) {
        mp[make_pair(y-j, x-k)]++;
      }
    }
  }

  ll cnt[11];
  rep(i,11) cnt[i] = 0;
  ll len = 0;

  for (auto itr : mp) {
    if (itr.second > 9) {
      cnt[10]++;
      continue;
    }
    cnt[itr.second]++;
    len++;
  }

  ll zero = (h-2) * (w-2) - len;
  cnt[0] = zero;

  rep(i,10) cout << cnt[i] << endl;
}


Measured memory_bytes: 56448
#include <stdio.h>
int main(void){
    /*
    push(d, x): dが0の場合、Aの先頭に整数xを挿入する。dが1の場合、末尾にxを挿入する。
    randomAccess(p): Aの要素apの値を出力する。
    pop(d): dが0の場合、Aの先頭の要素を削除する。dが1の場合、末尾の要素を削除する。
    */
    
    int a[800000];
    int N,i,j,mode,sub,val,cnt,s;
    cnt   = 0;
    s = 400000;
    
    scanf( "%d" , &N );
    
    for( i = 0 ; i < N ; i++ ){
        scanf( "%d %d " , &mode , &sub);
        switch( mode ){
            case 0:
                scanf( "%d " , &val );
                if( sub == 1 ){//末尾に挿入
                    a[cnt+s] = val;
                    cnt++;
                }else{//先頭に挿入
                    cnt++;
                    s--;
                    a[s] = val;
                }
                break;
            case 1:
                printf( "%d\n" , a[s+sub] );
                break;
            case 2:
                if( sub == 1 ){//末尾削除
                    cnt--;
                }else{//先頭削除
                    cnt--;
                    s++;
                }
                break;
        }
    }
    
    
}



Measured memory_bytes: 3432
N = int(input())
a = list(map(int,input().split()))
dic = {}
for nums in a:
  if nums in dic:
    dic[nums] += 1
  else:
    dic[nums] = 1
ma = 0
for keys in dic:
  ma = max(ma,dic[keys])
if ma == 1:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 35240
from sys import stdin

if __name__ == '__main__':
    n = int(stdin.readline().rstrip())
    p = list(map(int, stdin.readline().rstrip().split()))

    def get_nexts(p):
        d, e = [n for i in range(n)], [n for i in range(n)]
        stack1, stack2 = [], []
        for i in range(n):
            while stack2 and p[stack2[-1]] < p[i]:
                idx = stack2.pop()
                e[idx] = i

            to_append = []
            while stack1 and p[stack1[-1]] < p[i]:
                idx = stack1.pop()
                d[idx] = i
                to_append.append(idx)

            while to_append:
                stack2.append(to_append.pop())
            stack1.append(i)

        dist1, dist2 = [], []
        for i in range(n):
            dist1.append(d[i] - i)
            dist2.append(e[i] - d[i])
        return dist1, dist2

    dist1, dist2 = get_nexts(p)
    dist3, dist4 = get_nexts(p[::-1])
    ans = 0
    for i in range(n):
        ans += (dist1[i] * dist4[n - 1 - i] + dist2[i] * dist3[n - 1 - i]) * p[i]
    print(ans)


Measured memory_bytes: 74700
N,K = map(int,input().split())
treelist = []
difflist = []
append = treelist.append
#print(treelist)
append_diff = difflist.append
for i in range(N):
    tree = int(input())
    #print(tree)
    append(tree)
treelist.sort()
#print(treelist)
for i in range(K-1,N):
    diff = treelist[i] - treelist[i-K+1]
    #print(diff)
    append_diff(diff)
print(min(difflist))

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


#define REP(A, H) for(int A = 0; A < H; A++)

typedef long long ll;

int main(void) {
  ll n; std::cin >> n;
  std::vector<ll> as(n);
  REP(i, n) std::cin >> as[i];

  ll a = as[0];
  REP(i, n) {
    if (i == 0) continue;
    a += (i % 2 == 1 ? -as[i] : as[i]);
  }
  
  ll prev = a / 2;
  std::cout << prev * 2 << " ";
  REP(i, n - 1) {
    prev = as[i] - prev;
    std::cout << prev * 2 << " ";
  }

  std::cout << std::endl;

  return 0;
}

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

using namespace std;

int a[100010];
vector<int> vec[100010];
int pre[100010];
//在find的同时进行路径压缩
int Find(int x)
{
    int p,tmp;
    p=x;
    while(x!=pre[x])
        x=pre[x];
    while(p!=x)
    {
        tmp=pre[p];
        pre[p]=x;
        p=tmp;
    }
    return x;
}

void join(int x,int y)
{
    int fx=Find(x);
    int fy=Find(y);
    if(fx!=fy)
        pre[fx]=fy;
}
priority_queue<int> Q1;
priority_queue<int> Q2;
int main()
{
    int n,m,x,y;
    scanf("%d%d",&n,&m);
    for(int i=1; i<=n; i++)
        pre[i]=i;
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(int i=0; i<m; i++)
    {
        scanf("%d%d",&x,&y);
        join(x,y);
    }
    for(int i=1; i<=n; i++)
    {
        int f=Find(i);
        vec[f].push_back(i);
    }
    int ans=0;
    for(int i=1; i<=n; i++)
    {
        for(int j=0; j<vec[i].size(); j++)
        {
            Q1.push(vec[i][j]);
            Q2.push(a[vec[i][j]]);
        }
        while(1)
        {
            if(Q1.empty()||Q2.empty())
                break;
            int t1=Q1.top();
            int t2=Q2.top();
            if(t1==t2)
            {
                ans++;
                Q1.pop();
                Q2.pop();
            }
            else if(t1<t2)
            {
                Q2.pop();
            }
            else
                Q1.pop();

        }
        while(!Q1.empty())
            Q1.pop();
        while(!Q2.empty())
            Q2.pop();
    }
    cout << ans << endl;
    return 0;
}



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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
typedef long long ll;
/*
    problem : http://abc058.contest.atcoder.jp/tasks/arc071_b
*/
int n, m;
const int MOD = 1e9 + 7;
ll calc(int num)
{
	VI A(num);
	REP(i, 0, num) cin >> A[i];

	ll res = 0;
	REP(i, 1, num){
		res += (1ll * (A[i]-A[i-1]) * i) % MOD * (num-i);
		res %= MOD;
	}

	return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
	cin >> n >> m;


	ll sumX = calc(n), sumY = calc(m);
	
	cout << (sumX * sumY) % MOD << endl;

	return 0;
}

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

int c[300001];

int solve(int p, int k){
  if(p > 300000) return 0;
  if(c[p]) return 1;
  return solve(p+k, k);
}

int main(){
  
  int n, q, k, i;
  cin >> n >> q;
  
  while(n--) cin >> k, c[k] = 1;
  
  while(q--){
    cin >> k;
    for(i=k-1;i>=0;i--)
      if(solve(i, k)){cout << i << endl; break;}
  }
}

Measured memory_bytes: 2332
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Stack;

public class Main{
	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static int mod = (int) (1e9+7),n;
	static long cf = 998244353;
    static final int MAX = (int) 1e6;
    public static List<Integer>[] edges;
    public static int[][] parent;
    public static int col = 20;
    public static long[] Bit;
    public static long[] fact,inv;
    public  static int[] prime; 
    public static long[] seg,lazy;
	public static FastReader sc = new FastReader();
	public static void main(String[] args) {
	//	Scanner sc = new Scanner(System.in);

	
		int x = sc.nextInt();
		while(!BigInteger.valueOf(x).isProbablePrime(20)) ++x;
		out.print(x);
		out.close();
	}
	 
	
}

Measured memory_bytes: 21588
#include "bits/stdc++.h"
using namespace std;
/////////////////// TYPES & MACROS ///////////////////////////////
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define vv vector
#define exist(s,e) (s.find(e)!=s.end())
#define sz(x) ((int)(x).size())
#define int ll
#define el '\n'
typedef long long ll; typedef long double ld; typedef double dd;typedef vector<int> vi; typedef pair<int, int> pii;typedef pair<ll,ll> pll;
const ll INFLL=(ll)4e18, MOD=1e9+7; const int INF=0x3f6f6f6f;
//////////////////// DEBUG /////////////////////////////////////////
#define D(x) cerr<<#x<<" is:\t"<<x<<'\n';
#define DD(x,y) cerr<<'('<<#x<<','<<#y<<") are:\t"<<x<<' '<<y<<'\n';
#define DDD(x,y,z) cerr<<'('<<#x<<','<<#y<<','<<#z<<") are:\t"<<x<<' '<<y<<' '<<z<<'\n';
/////////////////// VARIABLES & FUNCTIONS//////////////////////////
vv<vv<int>> adj; vi vis, color, level; int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1},dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
inline ll mexp(ll x,ll n,ll m=MOD){ll res=1;x%=m;while(n){if(n&1)res=(res*x)%m;n>>=1;x=(x*x)%m;}return res;}
inline ll gcd(ll a, ll b){while (a>0 && b>0){if(a>b)a%=b;else b%=a;}return a+b;}

const int NN=410;
ll a[NN], memo[NN][NN];
ll dp(int l, int r){
	if(l==r) return 0;
	else if(memo[l][r]!=0x7f7f7f7f7f7f7f7f) return memo[l][r];
	ll& ret=memo[l][r];
	for(int i=l;i<r;++i){
		ret=min(ret, dp(l,i)+dp(i+1,r)+a[i]-(l==0?0:a[l-1])+a[r]-a[i]);
	}
	return ret;
}
///////////////////// MAIN STARTS //////////////////////////////////
int32_t main(void){
ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
cout<<fixed;cerr<<fixed; cout<<setprecision(10); cerr<<setprecision(3);
mt19937 genr(chrono::high_resolution_clock::now().time_since_epoch().count());


int n; cin>>n;
memset(memo, 0x7f, sizeof(memo));
for(int i=0;i<n;++i) cin>>a[i];
for(int i=1;i<n;++i) a[i]+=a[i-1];
cout<<dp(0,n-1)<<el;

return 0;
}


Measured memory_bytes: 1536
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        ArrayList<Integer> list = new ArrayList<Integer>();
        String n =scan.nextLine();
        int saizu =0;
        while(scan.hasNextInt()){
            int x = scan.nextInt();
            list.add(x);
        }
        for(int i=0;i<=list.size();i++){
            saizu = list.size();
            saizu -= 1;
            saizu -= i;
            System.out.print(list.get(saizu));
            if(saizu == 0){
                System.out.println("");
                break;
            }
            else{
                System.out.print(" ");
            }
         
        }
    }
}

Measured memory_bytes: 26308
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define vmax 10000
constexpr ll inf = 100000000000000;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

static const int N=1000;

int lcs(string x,string y){
  int c[N+1][N+1];
  int m=x.size();
  int n=y.size();
  int maxl=0;
  x=' '+x;//x[0]に空白を挿入
  y=' '+y;//y[0]に空白を挿入
  for(int i=0;i<=m;i++) c[i][0]=0;
  for(int i=1;i<=n;i++) c[0][i]=0;

  for(int i=1;i<=m;i++){
    for(int j=1;j<=n;j++){
      if(x[i]==y[j]){
        c[i][j]=c[i-1][j-1]+1;
      }else{
        c[i][j]=max(c[i-1][j],c[i][j-1]);
      }
      maxl=max(maxl,c[i][j]);
    }
  }

  return maxl;
}

int main(){
  string s1,s2;
  int n;cin>>n;
  rep(i,n){
    cin>>s1>>s2;
    cout<<lcs(s1,s2)<<endl;
  }
  return 0;
}







Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define UU(a,b,c) for(ll (a)=(b);(a)<=(c);(a)++)
#define DN(a,b,c) for(ll (a)=(b);(a)>(c);(a)--)
#define DU(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)
#define MOD 1000000007

ll n, fact[1000005], p10[1000005], p8[1000005];

void reset()
{
	fact[0] = 1;
	p10[0] = 1;
	p8[0] = 1;
	UU(i,1,1000000)
	{
		p10[i] = p10[i - 1] * 10LL;
		if(p10[i] >= MOD)
		{
			p10[i] %= MOD;
		}
		
		p8[i] = p8[i - 1] * 8LL;
		if(p8[i] >= MOD)
		{
			p8[i] %= MOD;
		}
		
		fact[i] = fact[i - 1] * i;
		if(fact[i] >= MOD)
		{
			fact[i] %= MOD;
		}
	}
}

ll fast(ll times, ll val)
{
	if(times == 0)
	{
		return 1;
	}
	else if(times == 1)
	{
		return val;
	}
	else
	{
		ll ret = fast(times / 2, val);
		if(ret >= MOD)
			ret %= MOD;
		
		ret *= ret;
		if(ret >= MOD)
			ret %= MOD;
					
		if(times & 1)
		{
			ret *= val;
		}
		if(ret >= MOD)
			ret %= MOD;
					
		return ret;
	}
}

ll modex(ll val)
{
	return fast(MOD - 2, val) % MOD;
}

void input()
{
	cin>>n;
}

ll comb(ll n, ll r)
{
	ll ret = fact[n];
	ret *= modex(fact[n - r]);
	ret %= MOD;
	
	ret *= modex(fact[r]);
	ret %= MOD;
	
	return ret;
}

void solve()
{
	if(n < 3)
	{
		cout<<0<<endl;
		return;
	}
	
	ll total = 1;
	UU(i,2,n)
	{
		if(i * 3 > n) break;
		total += comb(n - (3*i) + (i - 1), i - 1);
		total %= MOD;
	}
	
	
	cout<<total<<endl;
}

void LetsRock()
{
	solve();
}

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
		
		reset();
		input();
		LetsRock();
	
	return 0;
}


Measured memory_bytes: 27076
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    int cnt = 0;
    while(1){
        int flag = 0;
        for(int i = 0; i < N; i++){
            if(A[i] % 2 != 0) flag = 1;
            else A[i] /= 2;
        }
        if(flag == 1) break;
        cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3532
#include <stdio.h>
#define N 10000
#define Q 500

int main()
{
  int S[N], T[Q], i, j, n, q, count=0;

  scanf("%d", &n);
  for( i = 0 ; i < n ; i++){
    scanf("%d", &S[i]);
  }
  scanf("%d", &q);
  for( i = 0 ; i < q ; i++){
    scanf("%d", &T[i]);
  }
  
  for( i = 0 ; i < q ; i++){
    j = 0;
    S[n] = T[i];
    while(S[j] != T[i]){
      j++;
    }
    if(j != n){
      count++;
    }
  }

  printf("%d\n", count);
  
  return 0;
}

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

using namespace std;

#define DB( x ) cout << #x << " = " << x << endl;
#define LEFT(n) (2 * (n))
#define RIGHT(n) (2 * (n) + 1)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> node;
//typedef vector <vector <ll>> matrix;

const ll INF = 1e18;
const double EPS = 1e-9;
const ll MOD = (ll)(998244353);
const ll MAXV = (ll)(3e5 + 10);
const ll MAXE = (ll)(1e6 + 10);


int main(){
	cin.sync_with_stdio( 0 );cin.tie( 0 );

	int m, d;

	cin >> m >> d;

	int ans = 0;

	for(int i = 11;i <= d;i ++){
		int a = i / 10;
		int b = i % 10;

		if(a * b <= m && a >= 2 && b >= 2)
			ans ++;
	}

	cout << ans << "\n";

	return 0;
}


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

int main(){
    int n;
    cin >> n;
    string s = to_string(n);
    for (auto c:s){
        if (c == '7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3664
#include <cstdio>
#include <stack>
#include <algorithm>
using namespace std;

struct Val {
    int height;
    int pos;
};

int h;
int w;
int ans;
int c[1401][1401];
int suc[1401][1401];

int main() {
    scanf("%d%d", &h, &w);
    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            scanf("%d", &c[i][j]);
            c[i][j] ^= 1;
            suc[i][j] = c[i][j];
        }
    }

    for (int i=1; i<h; i++) {
        for (int j=0; j<w; j++) {
            if (c[i][j]) {
                suc[i][j] = suc[i-1][j]+1;
            } else {
                suc[i][j] = 0;
            }
        }
    }
            
    for (int i=0; i<h; i++) {
        stack<struct Val> st;
        
        for (int j=0; j<=w; j++) {
            struct Val v;
            int newpos = j;

            v.height = suc[i][j];
            while (!st.empty() && st.top().height >= v.height) {
                struct Val pre = st.top(); st.pop();
                int area = pre.height * (j - pre.pos);
                ans = max(ans, area);
                newpos = pre.pos;
            }
            v.pos = newpos;
            st.push(v);
        }
    }

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

Measured memory_bytes: 16368
#include<stdio.h>
int R=1,C=1,H[2000010],N[2000010];
int MIN(int a,int b){return a<b?a:b;}
//評価関数（）
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return N[H[a]]>N[H[b]]?1:0;
}
//挿入関数
void hin(int a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//取り出す関数
int hout(){
  int rt=H[1],i,j=2,k=H[--C];
  for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[j/2]=k;
  return rt;
}
int p[200010];
int d[200010]={};
int q[200010];
int Top(int a){
  for(;p[a]-a;a=p[a]);
  return a;
}
int Find(int a,int b){
  int n,r;
  for(r=Top(a);p[a]!=a;a=n){
    n=p[a];
    p[a]=r;
  }
  for(r=Top(b);p[b]!=b;b=n){
    n=p[b];
    p[b]=r;
  }
  return a-b?1:0;
}
void Union(int a,int b){
  if(Find(a,b)){
    a=Top(a);
    b=Top(b);
    int c=MIN(q[a],q[b]);
    q[a]=q[b]=c;
    d[a]<d[b]?(p[a]=b):(p[b]=a);
    if(d[a]==d[b])d[a]++;
  }
}
int main(){
  int T,n,i,j,k[200010],l[200010],r[200010],kk[200010];
  long long ans;
  scanf("%d",&T);
  while(T--){
    scanf("%d",&n);
    //for(i=0;i<=n;i++)p[i]=q[i]=i;
    for(i=0;i<n;i++)scanf("%d %d %d",&k[i],&l[i],&r[i]);
    ans=0;
    R=C=1;
    for(i=0;i<=n;i++)p[i]=q[i]=i;
    //for(i=0;i<=n;i++)printf("p%d q%d\n",p[i],q[i]);
    for(i=0;i<n;i++){
      if(l[i]>r[i]){
	ans+=r[i];
	kk[R]=k[i];
	hin(l[i]-r[i]);//printf("ans%lld %d %d\n",ans,k[i],l[i]-r[i]);
      }
    }   //for(i=0;i<=n;i++)printf("%d\n",);
    while(C-1){
      i=hout();
      j=q[Top(kk[i])];//printf("i;%d j:%d kk%d top%d\n",i,j,kk[i],Top(kk[i]));
      if(j){
	ans+=N[i];
	Union(j,j-1);
      } 
    }//printf("ans:%lld\n",ans);
    R=C=1;
    for(i=0;i<=n;i++)p[i]=q[i]=i;
    for(i=0;i<n;i++){
      if(l[i]<=r[i]){//printf("%d\n",i);
	ans+=l[i];//printf("%lld\n",ans);
	kk[R]=n-k[i];
	hin(r[i]-l[i]);
      }
    }
    while(C-1){
      i=hout();
      j=q[Top(kk[i])];//printf("jj%d\n",j);
      if(j){
	ans+=N[i];
	Union(j,j-1);
      }
    }
    
    printf("%lld\n",ans);
  }
  return 0;
}
    


Measured memory_bytes: 7592
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;


int main(void) {
    int N;
    cin >> N;
    if (N % 2 == 0) {
        cout << (double) 1.0 / 2.0 << endl;
    } else {
        int n = N - 1;
        n = n / 2;
        cout << (double) (n+1) / N << endl; 
    }
    return 0;
}

Measured memory_bytes: 256
//In The Name of Allah
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5 + 10;

ll a[N], ps[N], n, m;

ll check(ll x){
    int l = 1; ll res = 0;
    for (int r = n; r && l <= r; r --){
        while (a[l] + a[r] < x && l < r)
            l ++;
        if (r <= l)
            break;
        res += 2 * (r - l);
    }
    for (int i = 1; i <= n; i ++)
        if (x <= 2 * a[i])
            res ++;
    return res;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i ++)
        cin >> a[i];
    sort(a + 1, a + n + 1);
    ll l = 0, r = 2 * N;
    while (1 < r - l){
        ll mid = (l + r) / 2;
        if (m <= check(mid))
            l = mid;
        else
            r = mid;
    }
    ll ans = 0, cnt = 0;
    int p1 = 1;
    for (int i = 1; i <= n; i ++)
        ps[i] = a[i] + ps[i - 1];
    for (int p2 = n; p2 && p1 < p2; p2 --){
        while (a[p1] + a[p2] <= l && p1 < p2)
            p1 ++;
        if (p2 <= p1)
            break;
        ans += 2LL * (p2 - p1) * a[p2] + 2LL * (ps[p2 - 1] - ps[p1 - 1]);
        cnt += 2LL * (p2 - p1);
    }
    for (int i = 1; i <= n; i ++){
        if (l < 2 * a[i]){
            ans += 2LL * a[i];
            cnt ++;
        }
    }
    ans += (m - cnt) * l;
    cout << ans;
    return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

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

	int n;
	cin >> n;

	cout << (n >= 1000 ? "ABD" : "ABC") << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using static System.Console;
using static System.Int32;
using static System.Math;
using System.Linq;
using System.Collections.Generic;

class Solution
{
    static void Main()
    {
    lb:
        var sp = ReadLine().Split();
        var k = Parse(sp[1]);
        var list = ReadLine().Split().Select(Parse).ToList();
        list.Sort();
        long result = 0;
        var count = list.Count - k;
        for(int i = 0; i < list.Count; ++i)
        {
            if (count <= i) break;
            result += list[i];
        }
        WriteLine(result);
    }
}


Measured memory_bytes: 31488
import java.util.Comparator;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			final int N = s.nextInt();
			final int M = s.nextInt();

			Map<Integer, Integer> map = new TreeMap<Integer, Integer>(Comparator.reverseOrder());
			for (int i = 0; i < N; i++) {
				Integer a = s.nextInt();
				if (map.containsKey(a)) {
					map.put(a, map.get(a).intValue() + 1);
				} else {
					map.put(a, 1);
				}
			}

			for (int i = 0; i < M; i++) {
				int b = s.nextInt();
				Integer c = s.nextInt();

				if (map.containsKey(c)) {
					map.put(c, map.get(c).intValue() + b);
				} else {
					map.put(c, b);
				}
			}

			long sum = 0;
			int n = N;
			for (Map.Entry<Integer, Integer> e : map.entrySet()) {
				long w = Math.min(n, e.getValue());
				sum += e.getKey() * w;
				n -= w;
				if (n < 1) {
					break;
				}
			}
			System.out.println(sum);
		}
	}
}


Measured memory_bytes: 108992
N, W = map(int, input().split())
l = []
for i in range(N):
  L = list(map(int, input().split()))
  l.append(L)
dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1,N+1):
  for j in range(W+1):
    if j >= l[i-1][0]:
      dp[i][j] = max(dp[i-1][j], dp[i-1][j-l[i-1][0]]+l[i-1][1])
    else:
      dp[i][j] = dp[i-1][j]
print(dp[N][W])

Measured memory_bytes: 171528