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

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
  public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
  public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i+1] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};

vl a,s;
ll n,m;

bool check(int X){
  ll h = 0;
  rep(i,n) {
    int j = lower_bound(all(a),X-a[i]) - a.begin();
    h += n-j;
  }

  return h <= m;
}

int main(){
  cin >> n >> m;
  a.resize(n);
  rep(i, n) cin >> a[i];
  sort(all(a));
  s.resize(n+1);
  rep(i,n) s[i+1] = s[i] + a[i];

  int ok = 2e5+1, ng = -1;
  while (abs(ng-ok)>1){
    int mid = (ok+ng)/2;
    if(check(mid)) ok = mid;
    else ng = mid;
  }

  ll ans = 0;
  ll cnt = 0;
  rep(i,n) {
    int j = lower_bound(all(a),ok-a[i]) - a.begin();
    cnt += n-j;
    ans += (n-j)*a[i] + (s[n] - s[j]);
  }

  ans += (m-cnt)*(ok-1);

  cout << ans << endl;

}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }

const int mod=1e9+7;

signed main()
{
    int N; cin>>N;
    vector<int> a(N),b(N);
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    for(int i=0;i<N;i++){
        cin>>b[i];
    }
    
    int ans=1;
    for(int i=0;i<N;i++){
        if(i==0 or a[i-1]<a[i]){
        //h[i]=a[i]
            if(i==N-1 or b[i]>b[i+1]){
            //h[i]=b[i]
                if(a[i]!=b[i]) ans=0;
            }else{
            //h[i]<=b[i]
                if(a[i]>b[i]) ans=0;
            }
        }else{
        //h[i]<=a[i]
            if(i==N-1 or b[i]>b[i+1]){
            //h[i]=b[i]
                if(b[i]>a[i]) ans=0;
            }else{
            //h[i]<=b[i]
                ans=(ans*min(a[i],b[i]))%mod;
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
from collections import deque
import sys

#modの掛け算

def modmal(a,b,mod): #a*bをmodを法にして求める

    return a * b % mod


#modの割り算

def moddiv(a,b,mod): #a/bをmodを法にして求める

    return (a * pow(b,mod-2,mod)) % mod


#逆元

def inverse(a,mod): #aのmodを法にした逆元を返す
    return pow(a,mod-2,mod)



#modのn!と、n!の逆元を格納したリストを返す(拾いもの)
#factorialsには[1, 1!%mod , 2!%mod , 6!%mod… , n!%mod] が入っている
#invsには↑の逆元が入っている

def modfac(n, MOD):
 
    f = 1
    factorials = [1]
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
    return factorials, invs


def modnCr(n,r,mod,fac,inv): #上で求めたfacとinvsを引数に入れるべし(上の関数で与えたnが計算できる最大のnになる)

    return fac[n] * inv[n-r] * inv[r] % mod



N,K = map(int,input().split())

mod = 10**9+7
fac,inv = modfac(max(N,K)+100 , mod)

dic = {}

for i in range(N-1):

    a,b = map(int,input().split())
    a -= 1
    b -= 1

    if a not in dic:
        dic[a] = []
    if b not in dic:
        dic[b] = []

    dic[a].append(b)
    dic[b].append(a)

ans = K

for i in dic:

    if i == 0:

        ans *= fac[K-1] * inv[K-len(dic[i])-1]
        ans %= mod

        if len(dic[i]) >= K:
            print (0)
            sys.exit()

    else:

        ans *= fac[K-2] * inv[K-len(dic[i])-1]
        ans %= mod

        if len(dic[i]) >= K:
            print (0)
            sys.exit()

print (ans)
    

Measured memory_bytes: 73932
// abc083 C
#include <iostream>
#include <cmath>
using namespace std;

int main(void){
  unsigned long long x, y, p, count;
  cin >> x >> y;
  count = 0;

  while(x <= y){
    count++;
    x *= 2;
  }

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <math.h>
#include <algorithm> 
#include <string>

#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define sum(n) accumulate((n).begin(), (n).end(), 0)
using namespace std;


int main(){
	int n, a[10010],i = 0;
	bool check = false;
	cin >> n;

	rep(j,10010) {
		a[j] = -1;
	}
	while (n != 0) {
		if (n % -2 == -1) {
			a[i] = 1;
			n /= -2;
			n++;
		}
		else if (n % -2 == 1) {
			a[i] = 1;
			n /= -2;
		}
		else if (n % -2 == 0) {
			a[i] = 0;
			n /= -2;
		}
		i++;
	}

	for (int j = 10009; j >= 0;j--) {
		if (a[j] == 1) {
			check = true;
		}

		if (a[j] != -1 && check) {
			cout << a[j];
		}
	}

	if (!check) {
		cout << 0;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import java.util.StringTokenizer;
 
public class Main {
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n-1];
		
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		
		for (int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
		}
		
		for (int i = 0; i < n - 1; i++) {
			c[i] = sc.nextInt();
		}
		
		// System.out.println(Arrays.toString(c));
		
		int res = 0;
		int prev = -1;
		for (int i = 0; i < n; i++) {
			int k = prev + 1;
			if (prev != -1 && prev + 1 == a[i]) {
				res += c[prev - 1]; 
			}
			res += b[a[i] - 1];
			prev = a[i];
		}
		
		System.out.println(res);
	}
  
    static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
#define int long long int
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll m = 998244353;
int power(int x,int y, int m) 
{ 
    if (y == 0) 
        return 1;
    int p = power(x, y/2, m) % m; 
    p = (p * p) % m; 
  
    return (y%2 == 0)? p : (x * p) % m; 
} 
int modInverse(int a, int m) 
{     
        return power(a, m-2, m); 
}
int mod(int x)
 {
	if(x<0)return -x;
	else return x;
 } 
signed main()
{
 string s,t;
 cin>>s>>t;
 int n=s.size();
 int m=t.size();
 int ans[n+1][m+1];
 FOR(i,0,n)
 {
 	FOR(j,0,m)
 	{
 		ans[i][j]=0;
	 }
  } 
  FOR(i,1,n)
  {
  	FOR(j,1,m)
  	{
  		if(s[i-1]==t[j-1])
  		{
  		ans[i][j]=ans[i-1][j-1]+1;	
		}
		else
		{
			ans[i][j]=max(ans[i-1][j],ans[i][j-1]);
		}
	}
  }
  //cout<<ans[n][m]<<endl;
  if(ans[n][m]==0)
  cout<<" ";
  else
  {
  vi v;
 // v.pb(0);
  int i=n-1,j=m-1;
  while(i>=0 && j>=0)
  {
  if(s[i]==t[j])
  {
  v.pb(i);
  i--;j--;
  }
  else
  {
  	if(ans[i+1][j+1]==ans[i][j+1])
  	i--;	
	else if(ans[i+1][j+1]==ans[i+1][j])
	j--;
  }
 }
 FORD(i,ans[n][m]-1,0)
 {
 	cout<<s[v[i]];
 }
 v.clear();
}
}

Measured memory_bytes: 70656
def make_lcs(a,b):
    a_size = len(a)
    b_size = len(b)
    lcs = [[0 for _ in range(a_size+1)] for _ in range(b_size+1)]
    for i in range(1,b_size+1):
        for j in range(1,a_size+1):
            if a[j-1] == b[i-1]:
                match = 1
            else:
                match = 0
            lcs[i][j] = max(lcs[i-1][j-1]+match, lcs[i-1][j], lcs[i][j-1])
    # ここまではlcs()と同じ

    # lcsを使用して復元
    res = ''
    i,j = b_size,a_size
    while((i>0) & (j>0)):
        if lcs[i][j] == lcs[i-1][j]:
            i -= 1
        elif lcs[i][j] == lcs[i][j-1]:
            j -= 1
        else:
            res = b[i-1] + res
            i -= 1
            j -= 1
    return res

def main():
    a = list(input())
    b = list(input())
    print(make_lcs(a,b))

if __name__ == "__main__":
    main()
    

Measured memory_bytes: 120284
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A_lis = [list(map(int, input().split())) for i in range(N)]

ans = 0
for i in range(N):
	output = 0
	for j in range(M):
		output = output + A_lis[i][j]*B[j]
	output = output + C
	if output > 0:
		ans = ans + 1

print(ans)

Measured memory_bytes: 3064
/******************************************
* AUTHOR : Harish Manoharan *
******************************************/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i < b; i++)
#define N 100005
#define MOD 1000000007

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n;
    cin>>n;
    if(n%1000==0)
        cout<<0;
    else cout<<1000-n%1000;
}

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

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;

    vector< int > parent( n, -1 );
    vector< int > distance( n, INT_MAX );

    parent[ 0 ] = distance[ 0 ] = 0;

    vector< vector< int > > path( n );

    int x, y;
    for( int i = 0; i < m; i++ )
    {
        cin >> x >> y;
        x--;
        y--;
        path[ x ].push_back( y );
        path[ y ].push_back( x );
    }

    queue< int > q;
    q.push( 0 );

    while( !q.empty())
    {
        int temp = q.front();
        q.pop();

        for( int i : path[ temp ] )
        {
            if( distance[ i ] > 1 + distance[ temp ] )
            {
                distance[ i ] = 1 + distance[ temp ];
                parent[ i ] = temp;
                q.push( i );
            }
        }
    }

    bool poss = true;
    for( int i = 0; i < n; i++ )
    {
        if( distance[ i ] == INT_MAX )
        {
            poss = false;
            break;
        }
    }

    if( poss )
    {
        cout << "Yes" << "\n";
        for( int i = 1; i < n; i++ )
            cout << parent[ i ] + 1 << "\n";
    }
    else
        cout << "No" << "\n";

    return 0;
}

Measured memory_bytes: 10680
#include<iostream>
#include<cassert>
#include<algorithm>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<29)
#define MAX 3000000
using namespace std;
typedef long long ll;
struct P
{
  ll color,w;
  P(ll color=-inf,ll w=-inf):color(color),w(w){}
};
P par[MAX];
void init(){ rep(i,MAX)par[i] = P(i); }

P find(int x)
{
  if(x == par[x].color)return par[x];
  P p = find(par[x].color);
  if(par[x].w == -inf)par[x].w = 0;
  par[x].w += p.w,par[x].color = p.color;
  return par[x];
}

void unit(int x,int y,ll w)//x <= y
{
  P X = find(x); 
  P Y = find(y);
  //if(X.color == Y.color)return;
  par[X.color].color = par[Y.color].color;
  if(par[X.color].w == -inf)par[X.color].w = 0;
  if(par[Y.color].w == -inf)par[Y.color].w = 0;
  par[X.color].w = par[X.color].w + (par[y].w-w - par[x].w);
  //par[x].w -= par[y].w;
}

int N,M;

int main()
{
  while(cin >> N >> M,N|M)
    {
      init();
      char c;
      ll a,b,w;
      rep(_,M)
	{
	  cin >> c;
	  if(c == '!')
	    {
	      cin >> a >> b >> w;
	      unit(a,b,w);
	    }
	  else
	    {
	      cin >> a >> b;
	      P B = find(b);
	      P A = find(a);
	      if(B.color != A.color)cout << "UNKNOWN" << endl;
	      else cout << B.w-A.w << endl;
	    }


	}
    }
  return 0;
} 

Measured memory_bytes: 53248
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef long long int ll;
void swap(ll *x, ll *y) {
    ll temp;
    temp = *x;
    *x = *y;
    *y = temp;
}
ll asc(const void *a, const void *b) { return *(ll *)a - *(ll *)b; }
ll desc(const void *a, const void *b) { return *(ll *)b - *(ll *)a; }
ll max(ll x, ll y) { return x > y ? x : y; }
ll min(ll x, ll y) { return x > y ? y : x; }
/*void
 * qsort(配列のアドレス,配列のサイズ,sizeof(配列の型のサイズ),比較関数(昇順or降順))
 */

int main(){
    int n,p[500],a,b;
    int cnt1,cnt2,cnt3;
    cnt1=cnt2=cnt3=0;

    scanf("%d",&n);
    scanf("%d %d",&a,&b);
    for(int i=0;i<n;i++)scanf("%d",&p[i]);

    for(int i=0;i<n;i++){
        if(p[i]<=a)cnt1++;
        if(a+1<=p[i]&&p[i]<=b)cnt2++;
        if(b+1<=p[i])cnt3++;
    }
    int min=999;
    if(min>cnt1)min=cnt1;
    if(min>cnt2)min=cnt2;
    if(min>cnt3)min=cnt3;
    printf("%d\n",min);
    return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
	static ArrayList<String> l = new ArrayList<>();
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int A = Character.getNumericValue(s.charAt(0));
		int B = Character.getNumericValue(s.charAt(1));
		int C = Character.getNumericValue(s.charAt(2));
		int D = Character.getNumericValue(s.charAt(3));
		int[] a = {A, B, C, D};
		dfs(a, 0, 0, "");
		System.out.println(l.get(0)+"=7");
	}
	
	static void dfs(int[] a, int i, int acc, String accs) {
		if(i==3) {
			if(acc+a[3]==7) {
				l.add(accs+"+"+a[3]);
			}
			if(acc-a[3]==7) {
				l.add(accs+"-"+a[3]);
			}
			return;
		}
		if(i==0) {
			dfs(a, i+1, a[0], Integer.toString(a[0]));
		} else {
			dfs(a, i+1, acc+a[i], accs+"+"+Integer.toString(a[i]));
			dfs(a, i+1, acc-a[i], accs+"-"+Integer.toString(a[i]));
		}
	}
	
	static int binarySearch(int[] A, int x) {
		int l = 0;
		int r = A.length;
		while(l<r) {
			int mid = (l+r)/2;
			if(A[mid] == x) return mid;
			else if(x<A[mid]) r = mid;
			else l = mid+1;
		}
		return -1;
	}
	
	static long upper_bound(int[] A, int b) {
		// bよりおおきい値がはじめて出てくるindexを返す
		return lower_bound(A, b+1);
	}

	static long lower_bound(int[] A, int b) {
		// b以上の値がはじめて出てくるindexを返す
		int lb=0;
		int ub=A.length;
		while(ub>lb) {
			int mid = (lb+ub)/2;
			if(A[mid]>=b) ub = mid;
			else lb = mid+1;
		}
		return lb;
	}
	
	// union find lib
	// usage:
	// 最初にinitを呼ぶ
	// root: 直接は呼ばないで
	// unite: まとめる
	// same: グループ判定
	static void init(int par[], int N) {
		for(int i=0; i<N; i++) {
			par[i] = i;
		}
	}
	
	static int root(int x, int [] par) {
		if(par[x] == x) {
			return x;
		} else {
			return (par[x] = root(par[x], par));
		}
	}
	
	static boolean same(int x, int y, int[] par) {
		return root(x, par) == root(y, par);
	}
	
	static void unite(int x, int y, int[] par) {
		x = root(x, par);
		y = root(y, par);
		if(x == y) return;
		par[x] = y;
	}
	
	// end union find lib
	
	// number lib
	
	static int max(int...ls) {
		int ans = Integer.MIN_VALUE;
		for(int i=0; i<ls.length; i++) {
			ans = Math.max(ans, ls[i]);
		}
		return ans;
	}
	
	static int min(int...ls) {
		int ans = Integer.MAX_VALUE;
		for(int i=0; i<ls.length; i++) {
			ans = Math.min(ans, ls[i]);
		}
		return ans;
	}
	
	static long lcm(long a, long b) {
		return a*(b/gcd(a, b));
	}
	
	static long gcd(long a, long b) {
		long ta = Math.max(a, b);
		long tb = Math.min(a, b);
		long tmp;
		while((tmp = ta%tb) != 0) {
			ta = tb;
			tb = tmp;
		}
		return tb;
	}
	
	static long modcomb(long n, long k, long mod) {
		if(k==1) {
			return n;
		}
		
		long ans = 1;
		for(long i=n; i>=n-k+1; i--) {
			ans = (ans * i)%mod;
		}
		for(long i=k; 0<i; i--) {
			ans = (ans * modpow(i, mod-2, mod)) % mod;
		}
		return ans;
	}
	
	static long modpow(long a, long b, long mod) {
		if(b==0) return 1;
		if(b%2==0) {
			long d = modpow(a, b/2, mod);
			return (d*d)%mod;
		} else {
			return (a*modpow(a, b-1, mod))%mod;
		}
	}
	
	static int disit(long a, long d) {
		int count = 0;
		while(a!=0) {
			a = a/d;
			count++;
		}
		return count;
	}
	
	// end number lib
}

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define For(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define sz(x) ((int)(x).size())
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef long long ll;

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

  int n; cin>>n;
  vector<vi> a(n,vi(3,0));
  rep(i,n) cin>>a[i][0]>>a[i][1]>>a[i][2];
  vector<vi> dp(n,vi(3,-INF));
  rep(i,3) dp[0][i]=a[0][i];
  For(i,1,n-1) rep(j,3) {
    dp[i][j] = a[i][j] + max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3]);
  }
  cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<'\n';
}


Measured memory_bytes: 11136
#include <iostream>
#include <map>

using namespace std;

int main(int argc, char const *argv[])
{
    int N, M;
    cin >> N >> M;
    map<int, int> drink;
    int inA, inB;
    for (int i = 0; i < N; i++)
    {
        cin >> inA >> inB;
        drink[inA] += inB;
    }
    
    long long ans = 0;
    for (auto itr = drink.begin(); itr != drink.end(); itr++)
    {
        if ((itr -> second) > M)
        {
            ans += (long long)(itr -> first) * (long long)M;
            break;
        }else
        {
            ans += (long long)(itr -> first) * (long long)(itr -> second);
            M -= (itr -> second);
        }
        
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
using namespace std;
int main(){
    
   int n;
   cin >> n;
   int ans=0;
   for(int i=1; i<=n; i++){
      if (i%2==1){
         ans++;
      }
   }
   double s;
   s = (double)ans/n;
   cout << s << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=n-1;i > m;i--)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define RS(n) sort(n.begin(), n.end());reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl;
#define Vecpr vector<pair<lli,lli>>
#define mod 1000000007;
int main(){
  lli A,B,C=INF,D=0,E=0,F=INF,G=INF,H=0,N,M,K,S;
  cin >> A >> B;
  C=A*2-1;
  B=B-A+1;
  rep(i,0,C){
    D=B+i;
    if(D<-1000000||D>1000000)continue;
    else Out(D);
  }
}


Measured memory_bytes: 256
N=input()
a=[]
s=len(N)

for i in range(s-1,-1,-1):
    a.append(int(N[i]))
a.append(0)
#print(a)

p=sum(a)
t=0
f=0
c=0
for i in range(len(a)-1):
    if a[i] <= 5:
        t+=a[i]
        if a[i] == 5 and a[i+1]>=5:a[i+1]+=1
        f=0
        
    else:
        c+=10-a[i]
        a[i+1] += 1
        f=1
        
print(t+f+c)

Measured memory_bytes: 13632
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>

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

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;

#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const long long int INF = 1 << 30; //10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

vector<bool> erat(int n) {
  vector<bool> primes(n,true);
  int mult = 2, k = 2;
	while (k < n-mult) {
		k += mult;
	  primes[k] = false;
	}

	mult = k = 3;
	while (mult < n) {
	  if (primes[mult]){
			while (k < n-mult) {
				k += mult;
				primes[k] = false;
		  }
			mult += 2; k = mult;
		}
		else {
			mult += 2; k = mult; 
			continue;
		}
	}

	return primes;
}

int main() {
	vector<bool> primes = erat(100001);
	vector<int>  likes(100001,0);

	primes[0] = primes[1] = false;
	int k = 0;
	for (int i = 1; i < 100001; i++) {
	  if(primes[i] && primes[(i+1)/2]) k++;
		likes[i] = k;
	}

	//debug(primes);
	//debug(likes);

	int q;
	cin >> q;

	rep(i, q) {
		int l,r;
		cin >> l >> r;

		cout << likes[r] - likes[l-1] << endl;
	}
}

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


int main() {
  int N, M;
  cin >> N >> M;
  if (M == N) {
    cout << "Yes" << endl;
  } else {
    cout  << "No" << endl;
  }
  return 0;
}


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

int main(){
  int N;
  cin >> N;
  /*
  if(N % 10 == 0){
    cout << "10" << endl;
    return 0;
  }
  */

  int min = 100000;
  for(int i = 1; i < N; i++){
    int num1 = i;
    int num2 = N - i;
    int sum = 0;
    while(num1 != 0 | num2 != 0 ){
      sum += (num1 % 10 + num2 % 10);
      num1 /= 10;
      num2 /= 10;
    }
    if(min > sum){
      min = sum;
    }
  }
  cout << min << endl;
}

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

#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int n;
vector<int> dp;
int main() {
    cin >> n;
    dp.assign(n+1,-1);
    dp[0] = 1;
    dp[1] = 1;
    FOR(i,2,n+1){//i=nまで計算！
        dp[i] = dp[i-1] + dp[i-2];
    }

    cout << dp[n] << endl;
    return 0;
}



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

int main(void){
	int n,i;
	long long int a,odd[100000],even[100000];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lld",&a);
		if(i%2==1) even[i/2] = a;
		else odd[i/2] = a;
	}
	if(n%2==0){
		for(i=n/2-1;i>=0;i--)printf("%d ",even[i]);
		for(i=0;i<n/2;i++)printf("%d ",odd[i]);
	}else{
		for(i=n/2;i>=0;i--)printf("%d ",odd[i]);
		for(i=0;i<n/2;i++)printf("%d ",even[i]);
	}
	return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
#define MSG(a) cout << #a << " " << a << "\n";


int main(){
    int ans = 0;
    int N; cin >> N;
    int A[100002] = {};
    REP(i,N){
        int a; cin >> a;
        A[a] ++;
    }
    vector<int> B(100002);
    for (int i = 1; i < 100001; i++){
        B.at(i) = A[i-1] + A[i] + A[i+1];
    }
 
    sort(B.rbegin(),B.rend());

    ans = B.at(0);
    cout << ans << endl;
 
}

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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define LEFT(i) (2*(i))
#define RIGHT(i) (2*(i)+1)
#define PARENT(i) ((i)/2)

//ヒープ木の構成要素型の定義
typedef struct{
    double priority; //ここの値で降順にする！！
    double value;
}heapdata;

//ヒープ木型の定義
typedef struct{
    int max_size;   //ヒープ二分木(配列A)の中に格納できる最大要素数
    int heap_size;  //ヒープ二分木(配列A)の中に現在入っている要素の数
    heapdata* A;    //要素を格納するための配列(ポインタ)
}* heap;

//ヒープH内の配列のA[i]とA[j]の値を入れ替える関数
void heap_swap(heap H,int i,int j){
    heapdata tmp;
    
    tmp=H->A[i];
    H->A[i]=H->A[j];
    H->A[j]=tmp;
    
    return;
}

//HEAPIFY O(nlogn)
//A[i]を根とする部分木がヒープになるように整序する関数
void heapify(heap H, int i){
    int l,r,largest,size;
    heapdata* A;
    
    l=LEFT(i); //iの左の子の添字
    r=RIGHT(i); //iの右の子の添字
    size=H->heap_size; //今のヒープHのサイズ
    A=H->A; //ヒープ二分木に格納されている要素の配列
    
    //以下largestを決めるコード
    if(l>size&&r>size){
        largest=i;
    }
    else if(l<=size&&r>size){
        if(A[l].priority>A[i].priority){
            largest=l;
        }
        else{
            largest=i;
        }
    }
    else{
        if(A[r].priority>A[l].priority){
            largest=r;
        }
        else{
            largest=l;
        }
        if(A[i].priority>A[largest].priority){
            largest=i;
        }
    }
    
    //largestが決まったら要素を入れ替えする
    if(largest!=i){
        heap_swap(H,i,largest);
        heapify(H,largest);
    }
    
    return;
}

//BUILD_HEAP O(n)
//要素n個の配列A[1]~A[n]、max_sizeをもつヒープ木Hのメモリを確保し出力する関数
heap heap_build(int n, heapdata* A, int max_size){
    int i;
    heap H;
    NEW(H,1);
    
    H->max_size=max_size;
    H->heap_size=n;
    H->A=A;
    
    for(i=n/2;i>=1;i--){
        heapify(H,i);
    }
    
    return H;
}

//EXTRACT_MAX O(logn)
//ヒープ木の中の最大要素を削除し出力、その最大要素を除いたヒープ木を再構成する関数
heapdata extract_max(heap H){
    int n=H->heap_size;
    
    heap_swap(H,1,n);
    H->heap_size=n-1;
    heapify(H,1);
    
    return H->A[n];
}

//INSERT O(logn)
//data xをヒープHに挿入する関数
void heap_insert(heap H,heapdata x){
    int n=H->heap_size;
    
    if(n==H->max_size){
        printf("ERROR　cannot insert anymore\n");
        return;
    }
    else{
        H->A[n+1]=x;
        H->heap_size=n+1;
        
        int i=n+1;
        while(PARENT(i)>=1&&H->A[i].priority>H->A[PARENT(i)].priority){
            heap_swap(H,i,PARENT(i));
            i=PARENT(i);
        }
        return;
    }
}

int main(void){
    int N;
    scanf("%d",&N);

    //A[1]~A[N]に格納
    heapdata* A;
    NEW(A,N+1)
    for(int i=1;i<=N;i++){
        scanf("%lf",&A[i].priority);
    }

    double M=0;

    heap T =heap_build(N,A,N);
    while(T->heap_size>0){;
        M+=1/extract_max(T).priority;
    }

    double ans=1/M;
    printf("%lf\n",ans);

    return 0;
}

//200点
//デバックprintを撮り忘れてジャッジに突っ込んだらWAになるぞ
//doubleの方がいいものは最初からdoubleで、intから変換したら変になることあり

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

int ctoi(char c){
    switch (c){
        case '0': return 0;
        case '1': return 1;
        case '2': return 2;
        case '3': return 3;
        case '4': return 4;
        case '5': return 5;
        case '6': return 6;
        case '7': return 7;
        case '8': return 8;
        case '9': return 9;
        default: return 0;
    }
}

int main(){
    string S;
    cin >> S;
    int len = S.size();
    int ans = 0;
    bool all_9 = true;
    rep(i,len - 1){
        if (S[i + 1] != '9'){
            all_9 = false;
        }
    }
    if (all_9){
        rep(i,len){
            ans += ctoi(S[i]);
        }
    }
    else{
        ans += (ctoi(S[0]) - 1);
        rep(i,len - 1){
            ans += 9;
        }
    }
    if (len == 1) cout << ctoi(S[0]) << endl;
    else cout << ans << endl;
}



Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

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

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<30)

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

    const int maxvar=100000000;

    int a[m],b[m],c[m],dist[100][100];
    for(int i=0;i<m;i++){
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;
        b[i]--;
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i==j)dist[i][j]=0;
            else dist[i][j]=maxvar;
        }
    }

    for(int i=0;i<m;i++){
        int ai=a[i], bi=b[i], ci=c[i];
        dist[ai][bi]=min(dist[ai][bi],ci);
        dist[bi][ai]=min(dist[bi][ai],ci);
    }

    for(int k=0;k<n;k++){
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
            }
        }
    }

    int ans=m;
    for(int i=0;i<m;i++){
        bool shortest=false;
        int ai=a[i],bi=b[i],ci=c[i];
        for(int j=0;j<n;j++)
            if(dist[j][ai]+ci==dist[j][bi]) shortest=true;
        if(shortest) ans=ans-1;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

ll dp[50][3][2];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    vl a(n);
    cin >> a;
    ll s = 0;
    rep(i,n) if(i > 1) s ^= a[i];
    ll k = a[0]+a[1];
    if(k < s) {
        cout << -1 << endl;
        return 0;
    }
    if((k-s)&1) {
        cout << -1 << endl;
        return 0;
    }
    ll L = (k-s)/2;
    if(L > a[0]) {
        cout << -1 << endl;
        return 0;
    }
    if(L*2 > k) {
        cout << -1 << endl;
        return 0;
    }
    ll rem = k-L*2;
    ll ans = L;
    rrep(i,60) {
        if(!(rem>>i&1)) continue;
        if(L>>i&1) {
            cout << -1 << endl;
            return 0;
        }
        ll nans = ans | 1LL<<i;
        if(nans <= a[0]) ans = nans;
    }
    if(ans == 0) {
        cout << -1 << endl;
        return 0;
    }
    cout << a[0]-ans << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int n,m,h[123456],a[123456],b[123456],x[123456],ans;
int main(){
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i];
        a[i]--;
        b[i]--;
        if(h[a[i]]<=h[b[i]]){
            x[a[i]]++;
        }
        if(h[a[i]]>=h[b[i]]){
            x[b[i]]++;
        }
    }
    for(int i=0;i<n;i++){
        if(x[i]==0)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5152
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main() {
    int i;
    char line[81];
    while (fgets(line, 81, stdin) != NULL) {
        while (1) {
            if (strstr(line, "the ") != NULL ||
                strstr(line, "this ") != NULL ||
                strstr(line, "that ") != NULL) {
                break;
            }
            for (i = 0; line[i] != '\0'; i++) {
                if (islower(line[i])) {
                    line[i] = ((line[i] - 'a') + 1) % 26 + 'a';
                }
            }
        }
        printf("%s", line);
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}

//a,b x
int main(){
	ll N,M,X; cin>>N>>M>>X;
	ll l=0,r=0;
	rep(i,M){
		ll A; cin>>A;
		if(A<X) l++;
		else r++;
	}
	cout<<min(l,r);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define printd(x) printf("%.12f\n", ans);
#define print(x) cout << (x) << endl;
#define Yes() cout << "Yes" << endl;
#define No() cout << "No" << endl;
#define YES() cout << "YES" << endl;
#define NO() cout << "NO" << endl;
#define all(x) (x).begin(),(x).end()
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

int main(void) {
    ll h, w;
    cin >> h >> w;

    ll ans1 = 1e9 + 7, ans2 = 1e9 + 7, ans3 = 1e9 + 7, ans4 = 1e9 + 7;

    ll tmp;
    if (h % 3 == 0) tmp = 0;
    else tmp = 1;
    ans1 = (h / 3 + tmp) * w - (h / 3) * w;
    if (w % 3 == 0) tmp = 0;
    else tmp = 1;
    ans2 = (w / 3 + tmp) * h - (w / 3) * h;

    for (int i = 1; i < w; i++) {
        if (h % 2 == 0) {
            chmin(ans3, abs(h * i - (w - i) * (h / 2)));
        }
        else {
            ll s1, s2, s3;
            s1 = h * i;
            s2 = (w - i) * (h / 2);
            s3 = (w - i) * (h / 2 + 1);
            chmin(ans3, abs(max({s1, s2, s3}) - min({s1, s2, s3})));
        }
    }

    for (int i = 1; i < h; i++) {
        if (w % 2 == 0) {
            chmin(ans4, abs(w * i - (h - i) * (w / 2)));
        }
        else {
            ll s1, s2, s3;
            s1 = w * i;
            s2 = (h - i) * (w / 2);
            s3 = (h - i) * (w / 2 + 1);
            chmin(ans4, abs(max({s1, s2, s3}) - min({s1, s2, s3})));
        }
    }
    
    cout << min(min(ans1, ans2), min(ans3, ans4)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card {
  char suit;
  int value;
};

struct Card L[MAX/2+2], R[MAX/2+2];

void merge(struct Card A[], int n, int left, int mid, int right) {
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  for(int i=0;i<n1;i++) L[i] = A[left + i];
  for(int i=0;i<n2;i++) R[i] = A[mid  + i];
  L[n1].value = R[n2].value = SENTINEL;
  i = j = 0;
  for(k=left; k<right; k++) {
    if(L[i].value <= R[j].value) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}

void mergeSort(struct Card A[], int n, int left, int right) {
  if(left+1 < right) {
    int mid = (left+right) / 2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid, right);
    merge(A,n,left,mid,right);
  }
}

int partition(struct Card A[], int n, int p, int r) {
  int i, j;
  struct Card t, x;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++) {
    if(A[j].value <= x.value) {
      i++;
      t=A[i]; A[i]=A[j]; A[j]=t;
    }
  }
  t=A[i+1]; A[i+1]=A[r]; A[r]=t;
  return i+1;
}

void quickSort(struct Card A[], int n, int p, int r) {
  int q;
  if(p<r) {
    q = partition(A,n,p,r);
    quickSort(A,n,p,q-1);
    quickSort(A,n,q+1,r);
  }
}

int main() {
  int n, i, v;
  struct Card A[MAX], B[MAX];
  char S[10];
  int stable = 1;

  scanf("%d", &n);

  for(i=0;i<n;i++) {
    scanf("%s %d",S,&v);
    A[i].suit =  B[i].suit  = S[0];
    A[i].value = B[i].value = v;
  }

  mergeSort(A,n,0,n);
  quickSort(B,n,0,n-1);

  for(i=0;i<n;i++) {
    // ????????????????????¨??????????????????????????????????????????
    if(A[i].suit != B[i].suit) stable = 0;
  }

  if(stable==1) printf("Stable\n");
  else printf("Not stable\n");
  for(i=0;i<n;i++) {
    printf("%c %d\n",B[i].suit,B[i].value);
  }

  return 0;
}

Measured memory_bytes: 4192
def func(n, A):
    for i in range(1, n):
        print (" ".join(map(str, A)))
        v = A[i]
        j = i-1
        while (j >= 0 and A[j] > v):
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
    print (" ".join(map(str, A)))

n = int(input())
A = list(map(int, input().split(" ")))
func(n, A)


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

int main(){
    string s;
    cin >> s;
    rep(i,3){
        if(s[i] == '7'){
            cout << "Yes" << endl; 
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3604
n = int(input())
w = [input() for i in range(n)]
f = 0
for i in range(n-1):
    if w[i][len(w[i])-1] != w[i+1][0]:
        f = 1
    for j in range(n):
       if j != i:
            if w[i] == w[j]:
                f = 1
if f==1:
    print('No')
else:
    print('Yes')

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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

int main()
{
    canhazfast();

    ull n, ans;

    cin >> n;
    ans = n-1;
    for (ull p = 2; ; ++p) {
        ull q = n/p, r = n%p;
        brif(q < p);
        ctif(r);
        ans = min(ans, p+q-2);
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.array, std.conv, std.math, std.algorithm;

void main() {
    while (true) {
        int n = readln.chomp.to!int;
        if (n == 0) break;
        double[] s = readln.chomp.split.to!(double[]);
        double m = s.sum / n;
        s[] -= m;
        double sigma = sqrt(s.map!(a => a ^^ 2).sum / n);
        writefln("%0.8f", sigma);
    }
}


Measured memory_bytes: 2560
#include<stdio.h>
//greatest common divisor
int main(){
  int X,Y,l,m,n=1;
  scanf("%d%d",&X,&Y);
  if(X>Y){
    m=X;
    l=Y;
  }
  else{
    l=X;
    m=Y;
  }
  while(n!=0){
    n=m%l;
    m=l;
    l=n;
  }
  printf("%d\n",m);
  return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1000000007;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
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<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N-1+M), B(N-1+M), niv(N), S;
    vector<vector<ll>> G(N), H(N);
    rep(i,N-1+M){
        cin >> A[i] >> B[i];
        A[i]--;B[i]--;
        G[A[i]].push_back(B[i]);
        H[B[i]].push_back(A[i]);
    }
    rep(i,N-1+M){
        niv[B[i]]++;
    }
    queue<ll> que;
    vector<ll> memo(N);
    rep(i,N){
        if(niv[i] == 0){
            que.push(i);
            S.push_back(i);
            memo[i] = 1;
        }
    }
    //PR(S,S.size());
    while(!que.empty()){
        ll v = que.front();
        que.pop();
        S.push_back(v);
        for(auto& u:G[v]){
            niv[u]--;
            if(niv[u] == 0){
                que.push(u);
            }
        }
    }
    //PR(S,N);
    vector<ll> note(N);
    rep(i,N){
        note[S[i]] = i;
    }
    vector<ll> ans(N);
    rep(i,N){
        ll Mv = -1;
        ll u = -1;
        for(auto& v:H[i]){
            if(Mv < note[v]){
                Mv = note[v];
                u = v;
            }
        }
        ans[i] = u+1;
    }
    rep(i,N){
        cout << ans[i] << endl;
    }
}

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

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

  int score = 0;
  rep (i, n-1) {
    if (s[i] == s[i+1]) score++; 
  }

  int ans = min(n-1, score + 2*k);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
//#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sort stable_sort
#define all(x) (x).begin(),(x).end()
#define rep(i,x) for (register int (i)=(1);(i)<=(x);(i)++)
#define rep2(i,x) for (register int (i)=(x);(i)>=(1);(i)--)
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
using namespace std;
char mp[305][305];
int n,m,i,j,k,a[305][305],cnt;
vector<pair<int,int> > pos[305];
int main()
{
	scanf("%d%d%d",&n,&m,&cnt);cnt=0;
	rep(i,n){
		scanf(" ");
		rep(j,m){
			scanf("%c",&mp[i][j]);
			if(mp[i][j]=='#'){
				pos[i].push_back(make_pair(j,++cnt));
			} 
		}
	}
	rep(i,n){
		if(!pos[i].empty()){
			j=0;
			rep(k,m){
				while(j<pos[i].size()&&pos[i][j].first<k) j++;
				if(j<pos[i].size()) a[i][k]=pos[i][j].second; else a[i][k]=pos[i].back().second;
			}
		}
	}
	for(i=2;i<=n;i++){
		if(pos[i].empty()){
			memcpy(a[i],a[i-1],sizeof(a[i]));
		}
	}
	rep2(i,n-1){
		if(pos[i].empty()){
			memcpy(a[i],a[i+1],sizeof(a[i]));
		}
	}
	rep(i,n){
		rep(j,m){
			printf("%d%c",a[i][j],(j==m?'\n':' '));
		}
	}
	return 0;
}

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

using namespace std;


int main(int argc, char **argv) {
    int N;
    cin>>N;
    map<string,int> m;
    for(int c=0;c<N;c++) {
        string s;
        cin>>s;
        m[s]++;
    }
    cout<<"AC x "<<m["AC"]<<"\nWA x "<<m["WA"]<<"\nTLE x "<<m["TLE"]<<"\nRE x "<<m["RE"];
}


Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
#define int long long
int n,m,l;
struct node1
{
	int x,v;
}dis[100001];
node1 operator+(node1 a,int b)
{
	a.v+=b;
	if(a.v>l)
		a.x++,a.v=b;
	return a;
}
bool operator<(node1 a,node1 b)
{
	if(a.x==b.x)
		return a.v<b.v;
	return a.x<b.x;
}
bool operator>(node1 a,node1 b)
{
	if(a.x==b.x)
		return a.v>b.v;
	return a.x>b.x;
}

struct node
{
    int to,val;
}p;
vector<node> e[100001];
int vis[100001];
struct cmp
{
	bool operator()(int a,int b)
	{
		return dis[a]>dis[b];
	}
};
priority_queue<int,vector<int>,cmp> q;
void spfa(int st)
{
    for(int i=1;i<=n;i++)
		dis[i].x=999999999;
    dis[st].x=dis[st].v=0;
    vis[st]=1;
    q.push(st);
    while(!q.empty())
    {
        int u=q.top();
        q.pop();
        vis[u]=0;
        for(int i=0;i<e[u].size();i++)
        {
            int to=e[u][i].to;
			node1 op=dis[u]+e[u][i].val;
            if(dis[to]>op)
            {
                dis[to]=op;
                if(!vis[to])
                {
                    q.push(to);
                    vis[to]=1;
                }
            }
        }
    }
}
int ans[1001][1001];
signed main()
{
//	freopen("19.in","r",stdin);
    scanf("%lld%lld%lld",&n,&m,&l);
    for(int i=1;i<=m;i++)
    {
        int x,y,w;
        scanf("%lld%lld%lld",&x,&y,&w);
		if(w<=l)
		{
			p.to=y,p.val=w;
			e[x].push_back(p);
			p.to=x;
			e[y].push_back(p);
		}
    }
    for(int i=1;i<=n;i++)
	{
		spfa(i);
		for(int j=1;j<=n;j++)
			ans[i][j]=dis[j].x;
	}
	int T;
	scanf("%lld",&T);
	for(int i=1;i<=T;i++)
	{
		int u,v;
		scanf("%lld%lld",&u,&v);
		if(ans[u][v]>n)
			printf("-1\n");
		else
			printf("%lld\n",ans[u][v]);
	}
    return 0;
}

Measured memory_bytes: 12800
#include <stdio.h>

long long int nCk(int n,int k){
    if(k==0)return 1;
    else return (n+1-k)*nCk(n,k-1)/k;
}

int main(void){
    int N,P;
    int ans1,ans2;
    ans1=0;
    ans2=0;
    scanf("%d %d",&N,&P);
    for(int i=0;i<N;i++){
        int kari;
        scanf("%d",&kari);
        if(kari%2==0)ans1++;
        else ans2++;
    }
    long long int ANS1,ANS2;
    ANS1=1;
    ANS1<<=ans1;
    ANS2=0;
    if(ans2%2==1){
        ANS2=1;
        ANS2<<=(ans2-1);
    }
    if(ans2==0&&P==1)ANS2=0;
    else if(ans2%2==0){
        for(int i=0;i<=ans2;i++){
            if(i%2==P)ANS2+=nCk(ans2,i);
        }
    }
    printf("%lld",ANS1*ANS2);
    return 0;
}


Measured memory_bytes: 128