akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    from collections import Counter
    from itertools import chain
    N, M = list(map(int, input().split()))
    A = [list(map(int, input().split()))[1:] for _ in range(N)]
    c = Counter(chain(*A))
    print(len([v for v in c.values() if v >= N]))
    

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 3444
import java.util.*;

public class Main {
	public Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new aoj2424().doIt();
	}
	class aoj2424{
		void doIt() {
			int n = sc.nextInt();
			for(int i = 0;i < n;i++){
				int num = sc.nextInt();
				int cnt = 0;
				while(true){
					if(num / 10 == 0)break;
					else{
						int num2 = num;
						int max = 0;
						int bai = 10;
						while(bai < num2){
							int sum = (num2 / bai) * (num % bai);
							if(sum > max) max = sum;
							bai = bai * 10;
						}
						num = max;
					}
					cnt++;
				}
				System.out.println(cnt);
			}
		}
	}
}

Measured memory_bytes: 19160
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>

using namespace std;
#define li long long int
#define FOR(i, a, b) for (int i = a ; i < b ; ++i)
#define REP(i, n) for (int i = 0 ; i < n ; ++i)

li gcd(li a,li b) {
    return a % b == 0 ? b : gcd(b, a % b);
}

int main(void) {
    string s, base;
    cin >> s;

    base = "CODEFESTIVAL2016";

    li count;
    FOR(i, 0, s.length()) {
        if (base[i] != s[i]) {
            count += 1;
        }
    }

    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
using namespace std;

int main() {
	string a, b;
	cin >> a >> b;
	if (a == "H") {
		cout << b;
	}
	else {
		if (b == "H") {
			cout << "D";
		}
		else {
			cout << "H";
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <random>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#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 FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

llong pow(int x, int n) {
    llong ans = x;
    if (n == 0) return 1;

    for(int i = 0; i < n - 1; i++) {
        ans *= x;
    }

    return ans;
}

void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}

const static int MAX = 500;

int h, w;
char field[MAX][MAX];
bool flag = false, visited[MAX][MAX] = {false};

void dfs(int i, int j) {
    if (field[i][j] == 'g') {
        flag = true;
        return;
    }
    if (visited[i][j]) return;
    visited[i][j] = true;

    rep(k, 4) {
        if (0 <= i + dx[k] && i + dx[k] <= h - 1 && 0 <= j + dy[k] && j + dy[k] <= w - 1 && field[i + dx[k]][j + dy[k]] != '#') {
            dfs(i + dx[k], j + dy[k]);
        }
    }
}

int main() {
    llong n, k;
    cin >> n >> k;
    long ans = 0;

    for (llong i = k + 1; i <= n; ++i) {
        ans += (i - k) * (n / i);
        if (n % i >= k) ans += n % i - k + 1;
    }

    if (k == 0) {
        cout << ans - n << endl;
    } else {
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>
using namespace std;

void trace(int A[], int n){
    for(int i = 0; i < n; i++){
         if(i > 0){
             cout << " ";
         }
         cout << A[i];
    }
    cout << endl;
}

void insertionSort(int A[], int N){
    for(int i = 1; i < N; i++){
        int v = A[i];
        int j = i - 1;
        while(j >= 0 && A[j] > v){
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A, N);
    }
}

int main(){
    int N;
    int A[100];

    cin >> N;
    for(int i = 0; i < N; i++){
            cin >> A[i];
    }
    trace(A,N);
    insertionSort(A, N);

    return 0;
}


Measured memory_bytes: 3092
n, k = map(int,input().split())
x = list(map(int,input().split()))
ans = 10**10
for i in range(n-k+1):
    ans = min(ans, abs(x[i]) + abs(x[i]-x[i+k-1]), abs(x[i+k-1]) + abs(x[i]-x[i+k-1]))
print(ans)


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

#define Art Code
#define Artist Shivam Gupta
#define MoT This Art belongs to Artist
#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vl(p) vector<p>
#define W while
#define For(i,s,x) for(i=s;i<x;i++)
#define Fore(i,s,x) for(i=s;i<=x;i++)
#define FoR(i,s,x) for(i=s-1;i>=x;i--)
#define ForE(i,s,x) for(i=s;i>=x;i--)
#define all(v) v.begin(),v.end()
#define pb push_back
#define in insert
#define sz size()
#define F first
#define S second
#define nl cout<<"\n"
#define pr(a) cout<<a<<" "
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
#define mod 1000000007
#define MAX 200005

ll N;
ld n, dp[301][301][301];

ld solve(ll x, ll y, ll z) {
    if(x<0||y<0||z<0) return 0;
    if(dp[x][y][z]>=0) return dp[x][y][z];
    // if(x&&y==0&&z==0) a=n/x+solve(x-1,y,z);
    // else if(x==0&&y&&z==0) a=n/y+solve(x+1,y-1,z);
    // else if(x==0&&y==0&&z) a=n/z+solve(x,y+1,z-1);
    // else {
    dp[x][y][z]=(x*solve(x-1,y,z)+y*solve(x+1,y-1,z)+z*solve(x,y+1,z-1)+n)/(x+y+z);
    return dp[x][y][z];
    
}


int main() {
    FASTIO;
    ll t=1, i, j, k, l;
    // cin>>t;
    W(t--) {
        cin>>N;
        n=N;
        ll a[N+1];
        ll x=0, y=0, z=0;
        Fore(i,1,N) {
            cin>>a[i];
            if(a[i]==1) x++;
            if(a[i]==2) y++;
            if(a[i]==3) z++;
        }
        Fore(i,0,300) Fore(j,0,300) Fore(k,0,300) dp[i][j][k]=-1;
        dp[0][0][0]=0;
        cout<<fixed<<setprecision(12)<<solve(x,y,z);
        nl;
    }
    return 0;
}

Measured memory_bytes: 430000
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

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

    cout << max((a+b), max((a-b), a*b)) << endl;
}

Measured memory_bytes: 256
def check(t):
    for i in range(len(t) // 2):
        if t[i] != t[len(t) - 1 - i]:
            return False
    return True

s = input()
if check(s) and check(s[0:int((len(s) - 1) / 2)]) and check(s[int((len(s) + 3) / 2) - 1:]):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
import sys
X = int(input())
if 1 <= X and X < 100:
    print("0")
    sys.exit()
i = 0
dp = [0]*(X+1)
dp[0] = 1
for i in range(100, X+1):
    for j in range(6):
        if dp[i-(100+j)] == 0:
            pass
        else:
            dp[i] = 1
print(dp[X])


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef pair<int, int> p;

int main(){
  int n;
  cin >> n;
  vector<int> v(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(rall(v));
  int longest = v[0];
  int sum = 0;

  for (int i = 1; i < n; i++) {
    sum += v[i];
  }

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

}


Measured memory_bytes: 256
#include<stdio.h>
int partition(int *,int,int);
int main(){
    int n,i;
    int ret;
    scanf("%d",&n);
    int A[n];
    for(i=0;i<n;i++)scanf("%d",&A[i]);

    ret=partition(A,0,n-1);

    for(i=0;i<n;i++){
        if(i>0)printf(" ");
        if(i==ret)printf("[");
        printf("%d",A[i]);
        if(i==ret)printf("]");
    }
    printf("\n");
    return 0;
}

int partition(int A[],int p,int r){
    int tmp,i,j,x;
    x = A[r];
    i = p-1;
    for(j=p;j<=r-1;j++){
        if(A[j]<=x){
            i=i+1;
            tmp=A[i];
            A[i]=A[j];
            A[j]=tmp;
        }
    } 
    tmp=A[i+1];
    A[i+1]=A[r];
    A[r]=tmp;
    return i+1;
}


Measured memory_bytes: 2108
#include <algorithm>
#include <iostream>
#include <vector>
#include <complex>
#include <cmath>
#include <set>
using namespace std;

const double PI = acos(-1);
const complex<double> I(0, 1);
typedef complex<double> Complex;

namespace std {
    bool operator<(const Complex& a, const Complex& b) {
        return make_pair(a.imag(), a.real()) < make_pair(b.imag(), b.real());
    }
}

enum class EventType {
    LINE_BEGIN, LINE_END, PASSENGER,
};

struct Event {
    double y;
    EventType type;
    int index;

    bool operator<(const Event& other) const {
        return y > other.y;
    }
};

// 時計回りに45度回転
Complex rotated(const Complex& p) {
    return p * exp(-I * PI * 0.25);
}

// 反時計回りに45度回転
Complex unrotated(const Complex& p) {
    return p * exp(I * PI * 0.25);
}

int main() {
    int N, Q;
    while (cin >> N >> Q) {
        vector<Event> events;
        vector<Complex> ps;
        for (int i = 0; i < N; ++i) {
            double S, T, X;
            cin >> S >> T >> X;
            ps.push_back(Complex(S - 0.5, X));
            Complex p1 = rotated(Complex(S - 0.5, X));
            Complex p2 = rotated(Complex(T - 0.5, X));
            events.push_back({ p1.imag(), EventType::LINE_BEGIN, i });
            events.push_back({ p2.imag(), EventType::LINE_END, i });
        }

        vector<Complex> ds;
        vector<double> answers;
        for (int i = 0; i < Q; ++i) {
            double D; cin >> D;
            Complex p = rotated(Complex(D, 0));
            events.push_back({ p.imag(), EventType::PASSENGER, i });
            ds.push_back(p);
            answers.push_back(-1);
        }

        sort(events.begin(), events.end());

        set<Complex> crossing;
        for (const Event& e : events) {
            switch (e.type) {
                case EventType::LINE_BEGIN: {
                    Complex p = ps[e.index];
                    crossing.insert(p);
                    //cout << "LINE_BEGIN: " << unrotated(p) << endl;
                    break;
                }
                case EventType::LINE_END: {
                    Complex p = ps[e.index];
                    crossing.erase(p);
                    //cout << "LINE_END: " << unrotated(p) << endl;
                    break;
                }
                case EventType::PASSENGER: {
                    if (crossing.empty()) break;
                    Complex p = *crossing.begin();
                    answers[e.index] = p.imag();
                    //cout << "PASSENGER: [" << e.index << "] " << p << endl;
                    break;
                }
            }
        }

        for (double a : answers) {
            cout << (long long)round(a) << '\n';
        }
    }
}

Measured memory_bytes: 31828
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

//

fn run() {
    input! {
        n: usize,
        s: [chars; n],
    }
    let mut ans = 0;
    for s in s.into_iter() {
        let s: String = s.into_iter().collect();
        if s == String::from("E869120") {
            ans += 1;
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}



Measured memory_bytes: 5048
#include<bits/stdc++.h>
using namespace std;
#define M 200005
#define ll long long
int n,L[M],R[M],tot,dfsline[M],q;
ll sum[M];
vector<int>edge[M];
void dfs(int x,int f){
	L[x]=++tot;dfsline[tot]=x;
	for(int i=0;i<edge[x].size();++i){
		int y=edge[x][i];
		if(y==f)continue;
		dfs(y,x);
	}
	R[x]=tot;
}
int main(){
	cin>>n>>q;
	for(int i=1,u,v;i<n;++i){
		scanf("%d%d",&u,&v);
		edge[u].push_back(v);
		edge[v].push_back(u);
	}
	dfs(1,0);
	while(q--){
		int a,b;
		scanf("%d%d",&b,&a);
		sum[L[b]]+=a,sum[R[b]+1]-=a;
	}
	int ans[M];
	for(int i=1;i<=n;++i)sum[i]+=sum[i-1],ans[dfsline[i]]=sum[i];
	for(int i=1;i<=n;++i)cout<<ans[i]<<" ";
	return 0;
}

Measured memory_bytes: 30464
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 
const int N = 1e3 + 1;
bool isprime[N];
void gen_primes(){
  fill(isprime + 2, isprime + N, true);
  for(int i = 2; i < N; i++){
	  if (isprime[i]){
		for(int j = 2 * i; j < N; j += i){
	         isprime[j] = false;
	      }  
	   }  
	}	
}

int calc(int n){
	int ret = 1;
	for(int i = 2; i <=n; i++){
	  if(isprime[i]){
		  int cnt = 0;
		  int curr = i;
		  while(curr <= n){
		    cnt += n/curr;
		    curr *= i;	  
		 }
	   ret *= (1 + cnt); 
	   ret %= MOD; 
	   }	
	} 
  return ret;
}

void solve(){
	gen_primes();
	int n;
	cin >> n;
	int val = calc(n);
	val %= MOD;
	cout << val << endl;
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  long long X, K, D; cin >> X >> K >> D;
  // Getting to 0
  long long a = abs(X) / D;
  if (a >= K) {
    // Nothing more to do
    cout << abs(X) - K * D << endl;
    return 0;
  }

  long long b = K - a;
  if (b % 2 == 0) {
    cout << abs(X) - a * D << endl;
    return 0;
  } else {
    cout << abs(abs(X) - a * D - D) << endl;
    return 0;
  }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int stickler(int arr[], int n, int k)
{
    int inc[n-1],mnm=INT_MAX;
    inc[0]=abs(arr[0]-arr[1]);
    for(int i=1;i<n-1;i++)
    {
        mnm=INT_MAX;
        for(int j=max(i-k,0);j<i;j++)
        {
            if(i-k>=0){
            if((inc[j]+abs(arr[i+1]-arr[j+1]))<mnm)
            mnm=inc[j]+abs(arr[i+1]-arr[j+1]);}
            else
                mnm=abs(arr[i+1]-arr[0]);
        }
        inc[i]=mnm;
    }
    return(inc[n-2]);
}
int main()
{
    int n,k;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];
       cout<< stickler(arr,n,k);
    return 0;
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int dp[1<<16][30];
int main(){
    while(true){
	int n,c;
	const int col = 16;
	cin >> n >> c;
	if(n==0&&c==0) break;
	vector<int> p(n,0);
	vector<int> m(c,0);
	REP(i,n){
	    REP(j,col){
		int x = 0;
		cin >> x;
		p[i] = (p[i] << 1) + x;
	    }
	}
	REP(i,c){
	    REP(j,col){
		int x = 0;
		cin >> x;
		m[i] = (m[i] << 1) + x;
	    }
	}

	memset(dp,-1,sizeof(dp));
	dp[0][0] = 0;
	REP(i,n){
	    REP(j,(1<<16)){
		if(dp[j][i] < 0) continue;
		int cur = j|p[i];
		REP(k,c){
		    int cal = (cur & m[k]);
		    int point = __builtin_popcount(cur&m[k]);
		    dp[cur-cal][i+1] = max(dp[cur-cal][i+1],dp[j][i]+point);
		}
	    }
	}

	int ans = 0;
	REP(i,(1<<16)){
	    ans = max(ans,dp[i][n]);
	}
	cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 8884
//😄😄😄😄😄😄😄😄😄😄😄😄😄
//Apno Swagat che//
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pi pair<int,int>
#define vp vector<pi>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define For(i,a,b) for(ll i=a;i<b;i++)
#define endl "\n"
#define debug(x) cout<<"AA Baju Smit------> "<<#x<<" -> "<<x<<endl
#define all(x) x.begin(),x.end()
#define mint map<int,int>
#define mod 10000007
#define ciN cin
////////////////////////////////////////////////////////////////
//Ha Moj Ha///
////////////////////////////////////////////////////////////////
////TEST CASES ATTACHED CHE BHULTO NAI......///////////////////


void jabru() {
	int n; cin >> n;
	vi v(n);
	For(i, 0, n)cin >> v[i];
	ll ans = 0;
	For(i, 0, n) {
		For(j, i + 1, n) {
			For(k, j + 1, n) {
				vi a(3); a[0] = v[i]; a[1] = v[j]; a[2] = v[k];
				sort(all(a));
				if (a[0] == a[1])continue;
				if (a[1] == a[2])continue;
				if (a[0] + a[1] > a[2]) {
					ans++;
					//cout << i << " " << j << " " << k << endl;
				}
			}
		}
	}
	cout << ans << endl;

}




////////////////////////////////////////////////////////////////
//Bas aabaju nai javanu///
////////////////////////////////////////////////////////////////

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

//	int t; cin >> t;
//	while (t--)
	jabru();

	return 0;
}





///////////////////////////////////////////////////////////////////////////////////////////
//Kai baju bhai???



Measured memory_bytes: 3656
import itertools
import math

a = int(input())
cnt = 0
ans = [0]*100000
l = list(range(1,int(math.sqrt(a))))

for x,y,z in itertools.product(l, repeat=3):
	ans[x*x+y*y+z*z+x*y+y*z+z*x]+=1

for i in range(1,a+1):
    print(ans[i])

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

#define mod 1000000007

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

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
 
int main(void){
	
	char a[3];
    cin >> a[0] >> a[1] >> a[2];

    if(a[0] == '7' || a[1] == '7' || a[2] == '7')
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
    
	return 0;
}

Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main{

	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		int[] b=new int[n];
		int[] p =new int[n];
		
		int[] rev=new int[n];
		for(int i=0; i<n;i++) rev[sc.nextInt()-1]=i;
		for(int i=0; i<n; i++) {
			a[i]=30000*(i+1);
			b[i]=30000*(n-i)+rev[i];
		}
		printArray(a);
		printArray(b);
 	}
	
	static void printArray(int[] a) {
		int n=a.length;
		for(int i=0; i<n; i++) {
			if(i==0) System.out.print(a[i]);
			else System.out.print(" "+a[i]);
		}
		System.out.println();
	}

	static class MyScanner
	{
		BufferedReader br;
		StringTokenizer st;
		public MyScanner(InputStream s) 
		{
			br=new BufferedReader(new InputStreamReader(s));
		}
		public String nextLine() throws IOException
		{
			return br.readLine();
		}
		public String next() throws IOException
		{
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException
		{
			return Integer.parseInt(next());
			
		}
		public double nextDouble() throws IOException
		{
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException
		{
			return br.ready();
		}
		public long nextLong() throws IOException
		{
			return Long.parseLong(next());
		}
	}
}


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(obj) obj.begin(), obj.end()

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

const int iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

int main() {
    int A, B;
    cin >> A >> B;
    REP(m, (int)1e7) {
        if ((int)(m * 0.08) == A && (int)(m * 0.10) == B) {
            cout << m << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
pair <int,int> P[200];
int main(){
	int n,a,v,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
	while(cin>>n,n){
		P[0].first=0;
		P[0].second=0;
		int maxx=0,maxy=0,minx=0,miny=0;
		for(int i=1;i<n;i++){
			cin>>a>>v;
			for(int j=0;j<4;j++){
				if(j==v){
					P[i].first=P[a].first+dx[j];
					P[i].second=P[a].second+dy[j];
					break;
				}
			}
			maxx=max(maxx,P[i].first);
			minx=min(minx,P[i].first);
			maxy=max(maxy,P[i].second);
			miny=min(miny,P[i].second);
		}
		cout<<maxx-minx+1<<' '<<maxy-miny+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>

using namespace std;

void scan_list (int X[][100], int a, int b) {
    
    for (int i = 0; i < a; i++) {
        for (int j = 0; j < b; j++) {
            cin >> X[i][j];
        }
    }

}

int main () {

    int n, m ,l;

    int A[100][100];
    int B[100][100];

    long long int C[100][100] = {0};

    int cnt = 0;

    cin >> n >> m >> l;

    scan_list(A, n, m);
    scan_list(B, m, l);

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            for (int k = 0; k < l; k++) {
                C[i][k] += A[i][j] * B[j][k];
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < l; j++) {
            if (j > 0) {
                cout << " ";
            }
            cout << C[i][j];
        }
        cout << endl;
    }

    return 0;
}


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

int main() {
    char x, y;
    cin>> x >> y;
    if (x == y) {
        cout << "=" << endl;
    }
    else if (x > y) {
        cout << ">" << endl;
    }
    else cout << "<" << endl;
}

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

using namespace std;

int main()
{
    string S;
    cin >> S;
    int ff = 0;
    int ss = 0;
    for(int i = 0;i < S.size();i++){
        if(i%2 == 0){
            if(S[i] == 'R' || S[i] == 'U' || S[i] == 'D'){
               ff++;
            }
        }else {
            if(S[i] == 'L' || S[i] == 'U' || S[i] == 'D'){
                ss++;
            }
        }
    }
    if(ff+ss == S.size()){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
            return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<map>
using namespace std;
map<pair <string,string>,int> f;
int main()
{
	int n;
	scanf("%d",&n);
	string st;
	cin >> st;
	int i,j;
	for (i=0;i<(1<<n);i++)
	{
		string s1="",s2="";
		for (j=0;j<n;j++)
		    if (i&(1<<j)) s1+=st[j];
		    else s2+=st[j];
		f[make_pair(s1,s2)]++;
	}
	
	long long ans=0;
	for (i=0;i<(1<<n);i++)
	{
		string s1="",s2="";
		for (j=n-1;j>=0;j--)
		    if (i&(1<<j)) s2+=st[j+n];
		    else s1+=st[j+n];
		ans+=f[make_pair(s1,s2)];
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 91904
N,M=map(int, input().split())

S=[list(map(int, input().split())) for i in range(M)]

T=[0]*N
for i in range(M):
    T[S[i][0]-1]+=1
for i in range(M):
    T[S[i][1]-1]+=1

for i in range(N):
    print(T[i])


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

int main(){
	long n,t,a,i,j;
	double k,b;
	cin >>n;
	cin >>t >>a;
	long h[n];
	for(i=0;i<n;i++)cin>> h[i];
	b=114514.0;
    j=0;
	for(i=0;i<n;i++){
		k=abs((double)(a-t)+0.006*(double)(h[i]));
		if(k<b){
			b=k;
			j=i;
		}
	}
	cout<<j+1;
	return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  int A, B, S;
  A = 0; B = 0; S = 0; 
  
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    A = x;
    B = abs(K - x);
    if (A <= B)
      S += A;
    else if (A > B)
      S += B;
  }   
      cout << 2 * S << endl;
}


Measured memory_bytes: 256
#pragma comment(linker,"/stack:16777216")
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=1;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define repr(a,n) for(int a=n-1;a>=0;a--)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

int n,m;
string s[1010];
ll dp[1010][1010];
int main(int argc,char** argv){
	cin>>n>>m;
	rep(i,n){
		cin>>s[i];
	}
	rep(i,n){
		if(s[i][0]=='.')dp[i][0]=1ll;
		else break;
	}
	rep(i,m){
		if(s[0][i]=='.')dp[0][i]=1ll;
		else break;
	}
	for(int i=1;i<n;i++)for(int j=0;j<m;j++){
		if(s[i][j]=='#'){
			dp[i][j]=0ll;
		}
		else{
			dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
		}
	}
	/*
	rep(i,n){
		rep(j,m){
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}
	*/
	cout<<dp[n-1][m-1]<<endl;
	return 0;
}

Measured memory_bytes: 9216
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残すな
//数値計算 基本はdouble
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

int dig(int N) {//桁数
	int dig = 0;
	while (N) {
		dig++;
		N /= 10;
	}
	return dig;
}

int main() {
	ll N; cin >> N;
	cout << (N - 1) * N / 2 << endl;
}

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

int main() {
  ll int n,a, b;
  cin >> n >> a >> b;
  if(a > b || (n == 1 && a != b)) {
    cout << 0 << endl;
    return 0;
  } else if(a == b && n == 1) {
    cout << 1 << endl;
    return 0;
  }
  
  ll int ans = (b - a) * (n - 2) + 1;
  
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



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

  ll n, a, b;
  cin >> n >> a >> b;

  if (n == 1) cout << (a == b ? 1 : 0) << '\n';
  else {
    if (a > b) cout << 0 << '\n';
    else cout << (b - a) * (n - 2) + 1 << '\n';
  }




  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const ll mod = 1e9+7;
const ll INF = 1e10;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    string s,t;
    cin >> s >> t;
    int n = s.size();
    int ans=0;
    rep(i,n){
        if(s[i]!=t[i]){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

int main(){
    int n;
    string s;
    cin>>n>>s;
    stack<char> st;
    int cnt=0;
    rep(i,n){
        if(s[i]=='(') st.push('(');
        else{
            if(!st.empty()){
                st.pop();
            }
            else cnt++;
        }
    }

    string ans="";
    rep(i,cnt) ans+='(';
    ans+=s;
    rep(i,st.size()) ans+=')';

    cout<<ans<<endl;
}

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

int main() {
   int r, g, b;
   cin >> r >> g >> b;

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

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

using namespace std;

typedef pair<int, int> P;

int N, T, H, L, h, l, Z, tmp;
vector<P> data;

main(){
  cin >> N >> T >> H >> L;
  for(int i=0;i<N;i++){
    cin >> h >> l;
    data.push_back(P(h, l));
  }
  Z = 0;
  while(1){
    for(int i=0;i<N;i++){
      if(data[i].first){
        Z += 10;
        T++;
        data[i].first--;
        if(T > L){
          cout << i+1 << endl;
          goto END;
        }
      }else if(data[i].second){
        Z += 100;
        H++;
        data[i].second--;
      }else{
        cout << i+1 << endl;
        goto END;
      }
      if(Z >= 90){
        tmp = (Z - 90) / 10;
        if(T >= tmp){
          Z = 0;
          T -= tmp;
          data[i].first += tmp;
        }else{
          cout << i+1 << endl;
          goto END;
        }
      }
    }
  }
  END:;
}

Measured memory_bytes: 1196
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second

using namespace std;

int main(){
    int n, p = 0;
    cin >> n;
    vector <int> v(n);
    for (int i = 0; i < n ; i++){
        cin >> v[i];
        p += v[i];
    }
    p /= n;
    ll ans1 = 0, ans2 = 0;
    for (int x : v) ans1 += (x-p)*(x-p);
    for (int x : v) ans2 += (x-p-1)*(x-p-1);
    cout << min(ans1, ans2);
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
int f[] = {0,2,5,5,4,5,6,3,7,6};
signed main(){
    int n,m;
    cin >> n >> m;
    vector<int>v(m);
    for(auto& e: v)cin >> e;
    map<int,int>mp;
    for(auto e: v)cmax(mp[f[e]],e);
    vector<int>u;
    for(auto itr :mp)u.push_back(itr.second);
    vector<string>dp(n+1,"");
    rep(i,dp.size()){
        rep(j,u.size()){
            if(i == 0){
                if(f[u[j]] <= n)dp[f[u[j]]] = to_string(u[j]);
            } else if(dp[i] != ""){
                string t = dp[i];
                string comp = dp[i] + to_string(u[j]);
                sort(all(comp),greater<>());
                if(i + f[u[j]] <= n){
                    if(comp.size() > dp[i + f[u[j]]].size() or( comp.size() == dp[i+f[u[j]]].size() and comp > dp[i+f[u[j]]]))
                        dp[i + f[u[j]]] = comp;
                }
            }
        }
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 27136
import itertools

ans = 0
h, w, k = map(int, input().split())
field = []
for i in range(h):
    s = input()
    field.append(s)
for tate in itertools.product([0, 1], repeat=h):
    for yoko in itertools.product([0, 1], repeat=w):
        tl = list(tate)
        yl = list(yoko)
        cnt = 0
        for t in range(h):
            for y in range(w):
                if ((tl[t] == 1) or (yl[y] == 1)):
                    cnt += 0
                else:
                    if field[t][y] == "#":
                        cnt += 1
        if cnt == k:
            ans += 1
print(ans)


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

typedef std::pair<int, int> ipair;
#define pb push_back
#define ff first
#define ss second
#define fr(i, j, k) for (int i = j; i < k; i++)
#define rf(i, j, k) for (int i = j; i >= k;i--)
#define int long long
#define ld long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define mp make_pair

const int mod = 1000000007;
const ld pi = acos(-1);
const int maxn = 200006;

template<class T> ostream& operator <<(ostream &out,vector<T> &A){for(auto x:A) out<<x<<" ";return out;}
template <class T1,class T2>T1 powr(T1 a,T2 b){T1 res = 1;fr(i,1,b+1)res = res*a;return res;}
#define IOS  std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int32_t main(){
    int n,k;  cin>>n>>k;
    fr(i,k-n+1,k+n) cout<<i<<" ";
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String args[]) {
        int num;
        Scanner scan = new Scanner(System.in);
        num = scan.nextInt();
        int jyun[] = new int[num];
        int manzoku[] = new int[num];
        int tuika[] = new int[num-1];
        for(int i = 0; i< num ;i++){
            jyun[i] = scan.nextInt();
        }
        for(int i = 0; i< num;i++){
            manzoku[i] = scan.nextInt();
        }
        for(int i = 0; i< num -1;i++){
            tuika[i] = scan.nextInt();
        }
        int sum = 0;
        for(int i = 0;i < num;i++){
            sum = sum + manzoku[i];
        }
        for(int i = 0;i < num -1;i++){
            if(jyun[i] == jyun[i+1]-1){
                sum = sum + tuika[jyun[i]-1];
            }
        }
        System.out.println(sum);

    }

}



Measured memory_bytes: 35516
open Scanf
open Printf

let flip f x y = f y x

let rec range a b = if a >= b then [] else a :: range (a+1) b

let read_int () = scanf " %d" (fun x -> x)
let rec read_ints n = if n = 0 then [] else let i = read_int () in i :: read_ints (n-1)

let solve n y =
  let rec f j k = 
    let price = 10000 * j + 5000 * k + 1000 * (n - j - k) in
    if price = y then (j, k, n-j-k)
    else if price < y && j + k < n then f j (k+1)
    else if j < n then f (j+1) 0
    else (-1, -1, -1) in
  f 0 0

let () =
  let n = read_int () in let y = read_int () in
  let a, b, c = solve n y in
  printf "%d %d %d\n" a b c


Measured memory_bytes: 384
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        String s = sc.next();
        int now = 0;
        for(char c : s.toCharArray()){
            now += c - '0';   
        }
        System.out.println(now == 1 ? 10 : now);
    }
}


class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


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

int main(){
  int n;
  string s,t;
  cin >> n >> s >> t;
  
  string ans;
  for(int i=0; i<n; i++){
    ans += s[i];
    ans += t[i];
  }
  
  cout << ans << endl;
}

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

using ll = long long;

using namespace std;

#define amax(a, b) a = max(a, b)
#define INF 1e15

int main() {
    int n;
    cin >> n;
    int k = n / 2;
    ll a[n]; for (auto &ai:a) cin >> ai;
    ll dp[k + 1][3];
    fill(dp[0], dp[k+1], -INF);
    dp[0][0] = 0;
    for (int i=0; i<k; i++) {
        for (int x=0; x<3; x++) {
            for (int y=x; y<3; y++) {
                if (i*2 + y < n)
                    amax(dp[i+1][y], dp[i][x] + a[i*2 + y]);
            }
        }
    }
    cout << max({dp[k][0], dp[k][1], dp[k][2]}) << '\n';
    return 0;
}

Measured memory_bytes: 7528
#include<bits/stdc++.h>
using namespace std;
inline int in()
{
    char c=getchar();
    while(!isdigit(c))c=getchar();
    int x=0;
    while(isdigit(c))
    {
        x=x*10+c-'0';
        c=getchar();
    }
    return x;
}

typedef pair<int,int>pii; //<distance,point>
const int MAX=10000+5;
struct edge
{
    int v;
    int w;
};
vector<edge>e[MAX];
int dis[MAX];
void dijkstra(const int p)
{
    memset(dis,0x3f,sizeof(dis));
    dis[p]=0;
    priority_queue<pii,vector<pii>,greater<pii> >q;
    q.push(make_pair(0,p));
    while(!q.empty())
    {
        pii P=q.top();
        q.pop();
        const int now=P.second;
        if(dis[now]<P.first)continue;
        const int len=e[now].size();
        for(int i=0;i<len;i++)
        {
             edge const * const j=&e[now][i];
            if(dis[j->v]>dis[now]+j->w)
            {
                dis[j->v]=dis[now]+j->w;
                q.push(make_pair(dis[j->v],j->v));
            }
        }
    }
}
int main()
{
    int n=in();
    for(int i=0;i<n;i++)
    {
        const int u=in(),k=in();
        for(int j=0;j<k;j++)
        {
            edge E;
            E.v=in();E.w=in();
            e[u].push_back(E);
        }
    }
    dijkstra(0);
    for(int i=0;i<n;i++)printf("%d %d\n",i,dis[i]);
}



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

int main() {
  int n;cin>>n;
  string s;cin>>s;
  int cnt=1;
  rep(i,n-1){
    if(s[i]==s[i+1])continue;
    cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 3720
N = int(input())
number = [0]*N
for i in range(N):
    a,b = map(int,input().split())
    if a==b:
        number[i]=1

for i in range(N-2):
    if number[i]==1 and number[i+1]==1 and number[i+2]==1:
        print("Yes")
        exit(0)

print("No")


Measured memory_bytes: 9180
# -*- coding: utf-8 -*-
N = int(input())

strList = [""] * N
strList[0] =input()
ans = "Yes"

for count in range(1,N):
    string = input()
    for s in strList:
        if s == string :
            ans = "No"
            break
        else:
            before = strList[count -1]
            car = before[len(before) -1: len(before)] 
            if car != string[:1]:
                ans = "No"
                break
    if ans == "No":
        break
    strList[count] = string

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
    //aからなんばんめか，は (static_cast<int> ("調べたいアルファベット")) - (statc_cast<int> ("a") + 1)
    //input
    int h;
    int w;
    cin >> h >> w;
    //int width = static_cast<int> (w) - static_cast<int> ('a') + 1;
    //cout << width << endl;
    string matrix[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> matrix[i][j];
        }
    }

    //main
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(matrix[i][j] == "snuke"){
                //
                cout << static_cast<char> ('a' + j - 32) << i+1 << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cinttypes>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

const int kDx[] = {0, 1, 0, -1};
const int kDy[] = {1, 0, -1, 0};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int N, M;
  cin >> N >> M;
  
  vector<string> F(N);
  getline(cin, F[0]);
  
  for (auto& l : F) {
    getline(cin, l);
  }
  
  auto IsBad = [&](int x, int y) {
    if (F[x][y] != '#') {
      return false;
    }
    
    for (int k = 0; k < 4; ++k) {
      int nx = x + kDx[k];
      int ny = y + kDy[k];
      if (nx >= 0 && ny >= 0 && nx < N && ny < M) {
        if (F[nx][ny] == '#') {
          return false;
        }
      }
    }
    
    return true;
  };
  
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
      if (IsBad(i, j)) {
        cout << "No" << '\n';
        return 0;
      }
    }
  }
  
  cout << "Yes" << '\n';
    
  return 0;
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/abc159/tasks/abc159_d
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
  ll N; cin>>N;
  vector<ll> an(N);
  unordered_map<ll,ll> tbl;
  for(auto&& a:an){
    cin>>a;
    tbl[a]++;
  }

  ll total=0;
  unordered_map<ll,ll> numtbl; //数字と通りのかず
  for(auto& m:tbl){
    ll n=m.second;
    ll tmp = n * (n-1) /2;
    total += tmp;
    numtbl[m.first] = tmp;
  }

  for(auto&& a: an){
    ll ans=total-numtbl[a];
    ll n =tbl[a]-1;
    ans += n * (n-1) /2;
    cout<<ans<<endl;
  }


  return 0;
}

Measured memory_bytes: 16712