akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
#include <iomanip>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
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;}

int main(){
	string s,t;
	cin >> s >> t;
	
	vector<string> ans;
	REP(k,(int)s.size()-(int)t.size()+1){
		string a = string((int)s.size(), '.');
		bool ok = true;
		for(int i=0; i<(int)s.size();i++){
			if(i<k || k+(int)t.size()<=i){
				if(s[i]=='?') a[i] = 'a';
				else a[i] = s[i];	
			}else if(k<=i && i<k+(int)t.size()){
				if(s[i]=='?'){
					a[i] = t[i-k];
				}else if(s[i]==t[i-k]){
					a[i] = t[i-k];
				}else{
					ok = false;
					break;
				}
			}
		}
		if(ok) ans.push_back(a);
	}
	
	if(ans.size()==0){
		cout << "UNRESTORABLE\n";
		return 0;
	}
	
	sort(ans.begin(),ans.end());
	
	cout << ans[0] << endl;
	
	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <deque>
#include <climits> 

int main()
{
    long A,B;
    std::cin >> A >> B;
    if(A==B){
        std::cout << "Draw" << std::endl;
    }else if(A==1 || (B!=1 && B<A)){
        std::cout << "Alice" << std::endl;
    }else{
        std::cout << "Bob" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
using namespace std;
typedef long long int ll;

int main(){
	int n; cin >> n;
	vector<ll> a(n),b(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	for(int i=0;i<n;i++){
		cin >> b[i];
	}
	ll sum=0;
	ll cnt=0;
	for(int i=0;i<n;i++){
		if(a[i]<b[i]){
			cnt+=(b[i]-a[i])/2;
		}
		else if(a[i]>b[i]){
			sum+=(a[i]-b[i]);
		}
	}
	if(sum<=cnt){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).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 long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int n, k; cin >> n >> k;
    int h[n];
    rep(i, n) cin >> h[i];

    ll dp[n + 1];
    fill(dp, dp + n + 1, INF);
    dp[0] = 0;
    rep(i, n)
    {
        Rep(j, 1, k + 1)
        {
            if (j < n)
            {
                if (i + j < n) chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
                //COUT(dp[i + j]);
            }

        }
    }
    //for (auto it : dp) COUT(it);
    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1408
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Element {

    static final Element NONE = new Element( null, null );

    final Element left;
    final Element right;

    Element(){
	this.left = NONE;
	this.right = NONE;
    };

    Element( Element left, Element right ) {
	this.left = left;
	this.right = right;
    }

    Element intersection( Element e ) {
	if ( this == NONE || e == NONE ) {
	    return NONE;
	} else {
	    final Element interLeft = left.intersection( e.left );
	    final Element interRight = right.intersection( e.right );
	    return new Element( interLeft, interRight );
	}	    
    }

    Element union( Element e ) {
	if ( this == NONE ) {
	    return e;
	} else if( e == NONE ) {
	    return this;
	} else {
	    final Element unionLeft = left.union( e.left );
	    final Element unionRight = right.union( e.right );
	    return new Element( unionLeft, unionRight );
	}
    }

    public String toString() {
	if ( this == NONE ) {
	    return "";
	} else {
	    final String strLeft = left.toString();
	    final String strRight = right.toString();
	    return String.format( "(%s,%s)", strLeft, strRight );
	}
    }
}

class Tokenizer {

    int index;
    final String input;

    Tokenizer( final String input ) {
	this.input = input;
    }

    boolean isEOF() {
	return input.length() <= index;
    }

    void next() {
	index++;
    }

    char token() {
	return input.charAt( index );
    }
}

class Main {

    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );

	while ( stdin.hasNextLine() ) {

	    final String[] input = stdin.nextLine().split( " " );
	    final String order = input[ 0 ];
	    final Element left = parse( new Tokenizer( input[ 1 ] ) );
	    final Element right = parse( new Tokenizer( input[ 2 ] ) );

	    if ( "i".equals( order ) ) {
		System.out.println( left.intersection( right ) );
	    } else {
		System.out.println( left.union( right ) );
	    }	    
	}	
    }

    static Element parse( Tokenizer tk ) {
	if ( tk.isEOF() || tk.token() != '(' ) {
	    return Element.NONE;
	} else {
	    tk.next();  // (
	    final Element left = parse( tk );
	    tk.next();  // ,
	    final Element right = parse( tk );
	    tk.next(); // )
	    return new Element( left, right );
	}
    }    
}

Measured memory_bytes: 17256
a, b = input().split()  # まず文字列で受け取ります
p = int(a) # aはそのままint型にします
q = int(b[0] + b[2] + b[3])  # b[0] + b[2] + b[3]を整数に変換すれば、bの100倍を正確に得られます

print(p * q // 100)  # 掛けて100で整数の割り算をすれば終わりです

Measured memory_bytes: 9128
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	int N;
	int ave=0;
	cin>>N;
	std::vector<int>A(N);
	REP(i,N){
		cin>>A[i];
		ave+=A[i];
	}
	ave/=N;
	int ans=10000000,x=0;
	REP(i,N){
		x+=(ave-A[i])*(ave-A[i]);
	}
	ans=min(ans,x);
	x=0;
	REP(i,N){
		x+=(ave-1-A[i])*(ave-1-A[i]);
	}
	ans=min(ans,x);
	x=0;
	REP(i,N){
		x+=(ave+1-A[i])*(ave+1-A[i]);
	}
	ans=min(ans,x);
	
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a[100001];
int main()
{
	long long n,sum=0,m,ans=0,i;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		a[i]=i;
		sum=sum+i;
		ans++;
		if(sum>n)
		{
			break;
		}
	}
	m=sum-n;
	for(i=1;i<=ans;i++)
	{
		if(i!=m)
		{
			cout<<a[i]<<endl;
		} 
		else
		{
			continue;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lowb lower_bound
#define upb upper_bound
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};

string s[100];
bool used[100][100];
int h, w;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

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

	while(cin >> h >> w, h) {
		rep(i, h) {
			cin >> s[i];
			rep(j, w) used[i][j] = false;
		}

		int x = 0, y = 0, f = 0;
		while(!used[x][y]) {
			used[x][y] = 1;
			if(s[x][y] == '.') {
				f = 1;
				cout << y << " " << x << endl;
				break;
			}
			int r = (s[x][y] == '>' ? 0 : s[x][y] == '<' ? 2 : s[x][y] == 'v' ? 1 : 3);
			x += dx[r];
			y += dy[r];
		}
		if(!f) cout << "LOOP" << endl;
	}
	return 0;
}


Measured memory_bytes: 3168
#include<iostream>
using namespace std;
int main(){
	int n=0,a=0,m=0;
	cin>>n;
	int H[n];
	for(int i=0;i<n;i++){
		cin>>H[i];
	}
	for(int i=0;i<n;i++){
		if(H[i]>a){
			m++;
			a=H[i];
		}else if(H[i]==a){
			m++;
		}
	}
	cout<<m<<endl;
	return 0;
}

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

int n, y, m, d;

inline int y_c(int y) {
	if (y % 3 == 0) {
		return 200;
	}
	return 195;
}
inline int m_c(int y, int m) {
	if (y % 3 == 0 || m % 2 == 1) {
		return 20;
	}
	return 19;
}

int main(){
	int mil, bir;
	scanf("%d", &n);
	for (int I = 0; I < n; I++) {
		scanf("%d %d %d", &y, &m, &d);
		mil = 0;
		bir = d;
		for (int i = y; i < 1000; i++) {
			mil += y_c(i);
		}
		for (int i = 1; i < m; i++) {
			bir += m_c(y, i);
		}
		printf("%d\n", mil - bir + 1);
	}

	return 0;
}

Measured memory_bytes: 2724
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
int mod = 1000000007;

int main() {
  int N, M;
  cin >> N >> M;
  int state = (1 << N);
  vector<int> dp[M + 1];
  rep(i, M + 1) dp[i].resize(state);

  int A[M], B[M];
  rep(i, M) {
    int a, k;
    cin >> a >> k;
    A[i] = a;
    int acc = 0;
    rep(j, k) {
      int c;
      cin >> c;
      acc += (1 << (c - 1));
    }
    B[i] = acc;
  }

  rep(i, M + 1) rep(j, state) dp[i][j] = INF;
  dp[0][0] = 0;
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < state; j++) {
      dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
      int to = j | B[i];
      dp[i + 1][to] = min(dp[i + 1][to], dp[i][j] + A[i]);
    }
  }
  if (dp[M][state - 1] == INF)
    cout << -1 << endl;
  else
    cout << dp[M][state - 1] << endl;
  return 0;
}


Measured memory_bytes: 16256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		x: i128,
		k: i128,
		d: i128,
	}

	let xabs = x.abs();
	let s = xabs / d;
	if s >= k {
		if 0 < x {
			println!("{}", x - k * d);
			return;
		}
		else {
			println!("{}", (x + k * d).abs());
			return;
		}
	}

	let tx;
	let tk;
	if 0 < x {
		tx = x - s * d;
		tk = k - s;
		if tk % 2 == 0 {
			println!("{}", tx);
			return;
		}
		else {
			println!("{}", (tx - d).abs());
			return;
		}
	}
	else {
		tx = x + s * d;
		tk = k - s;
		if tk % 2 == 0 {
			println!("{}", tx.abs());
			return;
		}
		else {
			println!("{}", tx + d);
			return;
		}
	}
}



Measured memory_bytes: 2156
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

from itertools import permutations

n = ni()

def dfs(s):
    if int(s) > n:
        return 0
    res = 1 if all(s.count(c) > 0 for c in '753') else 0
    for c in '753':
        res += dfs(s + c)
    return res

print(dfs('0'))

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

int main(void) {
    string T, P;
    cin >> T >> P;

    int st = 0;
    while (1) {
        auto idx = T.find(P, st);
        if (idx == string::npos) break;

        cout << idx << endl;
        st = idx+1;
    }

    return 0;
}

Measured memory_bytes: 3148
/*
AizuOnline A0092
Title
2013/01/25 WA
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
#define max(x,y) (((x)>(y))?(x):(y))
#define min(x,y) (((x)<(y))?(x):(y))
//
char a[1000][1001];
int b[1000][1001];   //runlen
int n;
void print()
{
  int i,j;

  for(i=0;i<n;i++)
    {
      for(j=0;j<n;j++)
	printf("%d",b[i][j] % 10);
      printf("\n");
    }
}
main()
{
  int i,j,maxrunlen;

  while(EOF != scanf("%d",&n) && n)
    {
      //printf("N=%d\n",n);
      for(i=0;i<n;i++)
	scanf("%s",&(a[i][0]));
      if(n==1)
	{
	  if(a[0][0]=='.')
	    printf("1\n");
	  else
	    printf("0\n");
	  goto NEXT;
	}


      for(i=0;i<n;i++)
	{
	  b[i][0] = (a[i][0]=='.')?1:0;
	  b[0][i] = (a[0][i]=='.')?1:0;
	}
      maxrunlen = 0;
      for(i=1;i<n;i++)
	for(j=1;j<n;j++)
	  if(a[i][j]=='*')
	    b[i][j] = 0;
      //else if(a[i-1][j-1]=='*')
      //      b[i][j] = 1;
	  else
	    {
	      b[i][j] = 1+min(min(b[i-1][j],b[i][j-1]),b[i-1][j-1]);
	      if(b[i][j] > maxrunlen)
		maxrunlen = b[i][j];
	    }
      //print();
      printf("%d\n",maxrunlen);
    NEXT:
      ;
    }



return(0);
}

Measured memory_bytes: 5492
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>

using namespace std;

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n,0);
    int num;
    int cnt = 0;
    rep(i,n){
        cin >> num; num--;
        a[i] = num; 
        //cout << a[i] << endl;
    }
    rep(i,n){
        //cout << a[i] << "," << a[a[i]] << endl;
        if(i == a[a[i]]){
            cnt++;
        }
    }
    //cout << cnt << endl;
    cout << cnt / 2 << endl;

    return 0;
}

Measured memory_bytes: 640
def Divisors(n):
    L=[]
    k=1
    while k*k <= n:
        if n%k== 0:
            L.append(k)
        k+=1
    return L

N=int(input())
T=Divisors(N)

M=10**20
for a in T:
    M=min(M,a+(N//a)-2)
print(M)


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

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

    while (n >= 0) {
        if (n % 4 == 0) {
            std::cout << "Yes" << std::endl;
            return 0;
        }
        n -= 7;
    }
    std::cout << "No" << std::endl;
}


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

typedef long long LL;

const int OO = 1e9;
const int MOD = 1e9 + 7;

void solve() {
	int a;
	string s;
	cin >> a >> s;
	if (a >= 3200) {
		cout << s << '\n';
	} else {
		cout << "red\n";
	}
}

int32_t main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// #endif

	// clock_t begin = clock();

	solve();

	// clock_t end = clock();
	// cerr << "\nELAPSED TIME: " << (double) (end - begin) / CLOCKS_PER_SEC;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
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) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

ll dp[10005];

int main () {
  ll h, n;
  cin >> h >> n;
  vl a(n), b(n);
  rep(i,n) cin >> a[i] >> b[i];

  rep(j,10005) dp[j] = LINF;
  dp[0] = 0;
  rep(i,n)rep(j,h) {
    ll nj = min(j+a[i],h);
    chmin(dp[nj], dp[j]+b[i]);
  }
  cout << dp[h] << endl;
  return 0;
}

Measured memory_bytes: 384
// execute g++ main.cpp -std=c++14 -I C:\Users\naoya\Desktop\code\Atcoder
#include<bits/stdc++.h>
//#include<atcoder/all>
typedef long long ll;
typedef long double ld;
using namespace std;
//using namespace atcoder;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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;}


char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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



int main(){
    int n; cin >> n;
    string s;
    map<int, string> mp;
    cout << 0 << endl;
    cin >> s;
    if(s == "Vacant"){
        return 0;
    }else{
        mp[0] = s;
    }
    cout << n-1 << endl;
    cin >> s;
    if(s == "Vacant"){
        return 0;
    }else{
        mp[n-1] = s;
    }
    int left = 0, right = n-1;
    REP(i, 0, 20){
        int mid = (left + right) / 2;
        int flag = 1;
        cout << mid << endl;
        cin >> s;
        if(s == "Vacant"){
            return 0;
        }else{
            mp[mid] = s;
        }
        if((mid - left) % 2 == 0){
            if(mp[mid] != mp[left]){
                flag = 0;
                right = mid;
            }
        }else{
            if(mp[mid] == mp[left]){
                flag = 0;
                right = mid;
            }
        }
        if(flag){
            if((right - mid) % 2 == 0){
                if(mp[mid] != mp[right]){
                    left = mid;
                }
            }else{
                if(mp[mid] == mp[right]){
                    left = mid;
                }
            }
        }
    }
}

Measured memory_bytes: 3856
import java.util.*;

public class Main {
    public static int count;
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        final int M = sc.nextInt();
        final ArrayList<ArrayList<Integer>> graph = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            graph.add(new ArrayList<>());
        }
        for (int i = 0; i < M; i++) {
            final int a = sc.nextInt() - 1;
            final int b = sc.nextInt() - 1;
            graph.get(a).add(b);
            graph.get(b).add(a);
        }
        count = 0;
        final ArrayList<Integer> path = new ArrayList<>();
        path.add(0);
        step(0, graph, path);
        System.out.println(count);
    }
    public static void step(
        int u, 
        ArrayList<ArrayList<Integer>> graph, 
        ArrayList<Integer> path){
        // System.out.println(u);
        // System.out.println(path.toString());
        if(path.size() >= graph.size()){
            count ++ ;
            return;
        }else {
            for (Integer next : graph.get(u)) {
                if( ! path.contains(next)){
                    path.add(next);
                    step(next,graph,path);
                    path.remove(path.size()-1);
                }
            }
        }
    }
}   

Measured memory_bytes: 22228
#include<stdio.h>

int main(void){
  int W,H;
  char c;

  scanf("%d %d %c",&W,&H,&c);
  for(int h=0;h<H;h++){
    for(int w=0;w<W;w++){
      if(h==0 || h==H-1){
        if(w==0) printf("+");
        else if(w==W-1) printf("+\n");
        else printf("-");
      }else if(h==H/2 && w==W/2){
          printf("%c",c);
      }else{
        if(w==0) printf("|");
        else if(w==W-1) printf("|\n");
        else printf(".");
      }
    }
  }
  return 0;
}



Measured memory_bytes: 2060
from itertools import accumulate

def bs(t):
    l,h = 0,len(b)-1
    while l<=h:
        m = (l+h)//2
        if b[m]<t:
            l=m+1
        elif b[m]>t:
            h=m-1
        else:
            return m
    return h

n,m,k = map(int,input().split())
a = list(accumulate([0]+list(map(int,input().split()))))
b = list(accumulate([0]+list(map(int,input().split()))))
ans = 0
for idx,i in enumerate(a):
    if i<=k:
        #print(idx,bs(k-i))
        ans = max(ans,bs(k-i)+idx)
print(ans)

Measured memory_bytes: 125304
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>

#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 pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;

#define ARRAY_MAX 100005
#define MOD 1000000007
typedef pair<ll,int> LL_IP;




typedef struct edge{

    int to;
    int cost;

}EDGE;

void dijkstra(int n,vector<vector<EDGE> >& G,int x,vector<ll>& d){
    /*頂点の個数、辺の情報、始点となる頂点、直前の頂点の情報、最短距離の情報*/

    /*最終的にdは経由点からの最短距離が格納される、その過程では暫定的な最短距離が格納され、最短距離が見つかれば、その都度更新される*/

    //vector<ll> d(n,INF);/*最終的な最短距離を保持、初期化はINF*/
    d[x] = 0;
    priority_queue<LL_IP,vector<LL_IP>,greater<LL_IP> > que;/*vectorのpriority_queueで暫定的な最短距離が小さい順に取り出す*/
    que.push(LL_IP(0,x));/*経由点からダイクストラを適用するので経由点の暫定的な最短距離のコストは0*/

    while(!que.empty()){/*queが空になれば最短距離が全て探索できたことになる*/

        LL_IP p = que.top();/*最短距離の１番小さいものの取り出し*/
        que.pop();/*取り出したので調べたとみなし、queから出す*/
        int v = p.second;/*取り出した頂点の番号*/
        if(d[v] < p.first){
            /*取り出した頂点からの最短距離よりも短い経路があるので更新の必要はない*/
            continue;
        }

        for(int i = 0;i < G[v].size(); i++){
            /*取り出した頂点から辺でつながっている頂点への最短距離を調べて現在の値より短ければ更新する*/
            EDGE e = G[v][i];/*取り出した頂点からつながっている頂点を1つ取り出す*/
            if(d[e.to] > d[v] + e.cost){
                /*現在の最短距離よりも、現在の頂点を経由する経路のほうが最短距離が短い場合は最短距離を更新し、次の頂点を調べる*/
                d[e.to] = d[v] + e.cost;/*最短経路の更新*/
                que.push(P(d[e.to],e.to));/*先の頂点を調べるためqueに格納*/
            }              
        }
    }
}





int main(){

    int n,a,b,c,q,k,x,y;
    cin >> n;
    vector<vector<EDGE> > G(n);/*n個の各頂点からそれ以外の頂点へのコスト*/
    vector<ll> Snuke(n,INF);/*最短経路*/
    vector<ll> Fennec(n,INF);

    REP(i,n-1){
        cin >> a >> b;
        a--;
        b--;/*配列の添え字へ合わせる*/
        EDGE e1 = {b,1};
        EDGE e2 = {a,1};
        /*無効グラフなので双方向にコストを保持*/
        G[a].pb(e1);/*頂点aから頂点bへのコストがc*/
        G[b].pb(e2);/*頂点bから頂点aへのコストがc*/
    }
    /*辺の張り終わり*/

    dijkstra(n,G,0,Fennec);//Fennecからの距離
    dijkstra(n,G,n-1,Snuke);//Fennecからの距離

    int cnt_Fennec = 0,cnt_Snuke = 0;
    for(int i = 0;i < n;i++){

        if(Fennec[i] <= Snuke[i]){
            cnt_Fennec++;
        }else{
            cnt_Snuke++;
        }
    }
    /*REP(i,n){
        cout << Fennec[i] << " ";
    }
    cout << endl;
    REP(i,n){
        cout << Snuke[i] << " ";
    }
    cout << endl;
    cout << cnt_Fennec << " " << cnt_Snuke << endl;*/
    if(cnt_Fennec > cnt_Snuke){
        cout << "Fennec" << endl;
    }else{
        cout << "Snuke" << endl;
    }
    return 0;
}

Measured memory_bytes: 8544
#include <bits/stdc++.h>
#define SZ(x) ((int) (x).size())
using namespace std;

typedef long long i64;

int main() {
    #ifdef LOCAL_RUN
    freopen("task.in", "r", stdin);
    freopen("task.out", "w", stdout);
    //freopen("task.err", "w", stderr);
    #endif // ONLINE_JUDGE
    ios::sync_with_stdio(false);
    cin.tie(0);

    string s;
    cin >> s;

    int i = 0;
    int ans = 0;
    for (char c: s) {
        if (i) {
            ans += c == 'g';
        } else {
            ans -= c == 'p';
        }
        i ^= 1;
    }

    cout << ans << '\n';
}

Measured memory_bytes: 512
use std::cmp;
use std::io;

#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn input_vector<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let s = input_line_str();
        let split_result = s.split_whitespace();
        let mut vec_line: Vec<T> = Vec::new();
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            vec_line.push(buf);
        }
        v.push(vec_line);
    }
    v
}

fn main() {
    let n: isize;
    let k: isize;
    input!(n, k);
    let mut vplus: Vec<isize> = Vec::new();
    let mut vminus: Vec<isize> = Vec::new();
    let mut plusnum: usize = 0;
    let mut minusnum: usize = 0;
    let mut zero = 0;
    let mut ans = 999999999999;

    let mut str_line = input_line_str();
    let mut str_split = str_line.split_whitespace();

    for i in 0..n {
        let l: isize;
        l = str_split.next().unwrap().parse().unwrap();
        if l > 0 {
            plusnum += 1;
            vplus.push(l);
        } else if l < 0 {
            minusnum += 1;
            vminus.push(-1 * l);
        } else {
            zero += 1;
        }
    }

    if zero == 1 && plusnum == 0 && minusnum == 0 {
        ans = 0;
    }

    for (i, x) in vplus.iter().enumerate() {
        let rest = k - (i as isize) - 1 - zero;
        if (rest as usize) < 0 {
            break;
        } else if (rest as usize) == 0 {
            ans = cmp::min(ans, *x);
            break;
        }

        if (rest as usize) <= minusnum {
            ans = cmp::min(ans, 2 * *x + vminus[minusnum - (rest as usize)]);
        }
    }
    for (i, x) in vminus.iter().rev().enumerate() {
        let rest = k - (i as isize) - 1 - zero;
        if (rest as usize) < 0 {
            break;
        } else if (rest as usize) == 0 {
            ans = cmp::min(ans, *x);
            break;
        }
        if (rest as usize) <= plusnum {
            ans = cmp::min(ans, 2 * *x + vplus[(rest as usize) - 1]);
        }
    }

    println!("{}", ans);
}

Measured memory_bytes: 8444
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if (a >= b && a >= c) cout << 10*a + b + c << endl;
  else if (b >= a && b >= c) cout << 10*b + a + c << endl;
  else if (c >= a && c >= b) cout << 10*c + a + b << endl;
}

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

#define ll long long int
#define mp make_pair
#define ff first
#define ss second
#define fr(i,l,r) for (long long int i = l; i < r; ++i)
#define frr(i,l,r) for (long long int i = r; i >= l; --i) 
#define sortarr sort(arr,arr+n) //sorts array in asc order
#define sortarr_r sort(arr, arr+n, greater<long long int>()) //sorts array in desc order
#define make_set set<long long int>s //Set arranges in asc order
#define make_set_r set<long long int, greater <long long int>>s ////Set arranges in desc order
#define make_vector vector<long long int>v; 
#define max_heap priority_queue <int> pq; // max heap 
#define min_heap priority_queue <int, vector<int>, greater<int> > pq;  //min heap
#define make_pairVector vector<pair<long long int,long long int> > pairVector // vector of pairs
#define hashmap unordered_map<long long int, long long int>hashmap;
#define pb push_back

//transform(s.begin(), s.end(), s.begin(), ::tolower); //to convert a string entirely to lower case

//toupper(s[i]) or tolower(s[i]) // converting a character to upper or lower case

//map<pair<ll,ll>, ll > hash;          // pair,value hashmap where key is a pair
//hash[make_pair(i,j)] = 0;
//if(hash.find(make_pair(i,j)) == hash.end())


//map<ll,ll>::iterator itr;           // iterating a map
//for (itr = hash.begin();itr != hash.end(); itr++)
//{
//   itr->first = key  
//   itr->second = value
//}


// vector<string> v; //to convert vector to a set
// set<string> s(v.begin(), v.end());


// set<string>s;     // to convert set to a vector
// vector<string> v(s.begin(),s.end());


// cin >> x >> y;
// pairVector.pb(mp(x,y));


// string size = str.size()


// stack <int> s; 


// queue <int> gquiz; 


// __gcd(m, n) 

// ll arr[10e5 + 5];


// char arr[10e5 + 5];


//vec.insert(v.begin(),value)   -> to insert a value in the vector at the begin

// printf ("%.9f\n",x);
// cout << fixed << setprecision(9);

//covert integer to string :  to_string(integer)

bool sortbysec(const pair<long long int,long long int> &a, const pair<long long int,long long int> &b) 
{ 
    return (a.second < b.second); 
}
bool compare(string &s1,string &s2) 
{ 
    return s1.size() < s2.size(); 
} 
int check_key(map<long long int, long long int> m, long long int key) 
{ 
    // Key is not present 
    if (m.find(key) == m.end()) 
        return 0; 
  
    return 1; 
} 

void yes()
{
    cout << "YES" << endl;
}
void no()
{
    cout << "NO" << endl;
}

int main(void)
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n;
    cin >> n;
    ll arr[n+5] = {0};
    for(ll i = 0; i<n; i++)
    {
        cin >> arr[i];
    }
    // sortarr_r;
    sort(arr, arr+n+0, greater<long long int>());
    // for(ll i = 0; i<n; i++)
    // {
    //     cout << arr[i] << endl;
    // }
    ll sum = 0;
    ll num = n;
    num-=2;
    for(ll i = 1; i<n; i++)
    {
        if(num > 0)
        {
            num--;
            sum+=arr[i];
        }
        if(num > 0)
        {
            num--;
            sum+=arr[i];
        }
    }
    cout << sum + arr[0] << endl;
    
    return 0;
}   

Measured memory_bytes: 5112
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+9;
int main()
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	while(a>0&&c>0)
	{
		c-=b;
		if(c<=0)break;
		a-=d;
	}
	if(a<=0)puts("No");
	else puts("Yes");
}


Measured memory_bytes: 3760
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

char X[1001];
char Y[1001];

LongestCommonSubsequence(int x,int y){
  int i,j;
  int z[1001][1001];
  
  for(i = 0;i <= x;i++){
    z[i][0] = 0;
  }
  
  for(i = 0;i <= y;i++){
    z[0][j] = 0;
  }
  
  //printf("o");
  
  for(i = 1;i <= x;i++){
    for(j = 1;j <= y;j++){
      if(X[i-1] == Y[j-1]){
	z[i][j] = z[i-1][j-1]+1;
      }
      else if(z[i-1][j-1] >= z[i][j-1]){
	z[i][j] = z[i-1][j];
      }
      else{
	z[i][j] = z[i][j-1];
      }
    }
  }
  //printf("o");
  
  if(i == 0 || j == 0){
    return 0;
  }
  else if(i > 0 && j > 0 && x == y){
    return z[i-1][j-1];
  }
  else if(i > 0 && j > 0 && x != y){
    return z[x][y];
  }
}

int main(){
  int n;
  int i;
  int length1,length2;
  int conclusion;
  
  scanf("%d", &n);

  for(i = 0;i < n;i++){
    scanf("%s",X);
    scanf("%s",Y);
    
    length1 = strlen(X);
    length2 = strlen(Y);

    //printf("%d %d\n",length1,length2);
    
    conclusion = LongestCommonSubsequence(length1,length2);
    printf("%d\n",conclusion);
  }
  return 0;
}

Measured memory_bytes: 4508
N,Q = map(int,input().split())
S = input()
p = [0]*(N)
a = 0
for i in range(-1,N-2):
    if S[i+1] == "A" and S[i+2]=="C":
        a+=1
    p[i+2]=a
#print(p)
for i in range(Q):
    a,b = map(int,input().split())
    print(p[b-1] - p[a-1])

Measured memory_bytes: 52832
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;


template<int Modulus> 
struct ModInt {
    long long x;
    ModInt(long long x = 0) :x((x%Modulus + Modulus)%Modulus) {}
    constexpr ModInt &operator+=(const ModInt a) {if ((x += a.x) >= Modulus) x -= Modulus; return *this;}
    constexpr ModInt &operator-=(const ModInt a) {if ((x += Modulus - a.x) >= Modulus) x -= Modulus; return *this;}
    constexpr ModInt &operator*=(const ModInt a) {(x *= a.x) %= Modulus; return *this;}
    constexpr ModInt &operator/=(const ModInt a) {return *this *= a.inverse();}

    constexpr ModInt operator+(const ModInt a) const {return ModInt(*this) += a.x;}
    constexpr ModInt operator-(const ModInt a) const {return ModInt(*this) -= a.x;}
    constexpr ModInt operator*(const ModInt a) const {return ModInt(*this) *= a.x;}
    constexpr ModInt operator/(const ModInt a) const {return ModInt(*this) /= a.x;}
    
    friend constexpr ostream& operator<<(ostream& os,const ModInt<Modulus>& a) {return os << a.x;}
    friend constexpr istream& operator>>(istream& is,ModInt<Modulus>& a) {return is >> a.x;}
    
    ModInt inverse() const {// x ^ (-1) 
        long long a = x,b = Modulus,p = 1,q = 0;
        while (b) {long long d = a/b; a -= d*b; swap(a,b); p -= d*q; swap(p,q);}
        return ModInt(p);
    }
    ModInt pow(long long N) {// x ^ N 
        ModInt a = 1;
        while (N) {
            if (N&1) a *= *this;
            *this *= *this;
            N >>= 1;
        }
        return a;
    }
};

using mint = ModInt<1000000007>;

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

    int N; cin >> N;
    mint ans = mint(10).pow(N) - mint(2) * mint(9).pow(N) + mint(8).pow(N);
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long N = long.Parse(str[0]);
		long M = long.Parse(str[1]);
		long[]A = new long[N];
		string[] str2 = Console.ReadLine().Split();
		for(var i=0;i<N;i++){
			A[i] = long.Parse(str2[i]);
		}
		Array.Sort(A,(x,y)=>x.CompareTo(y));
		long[][]B = new long[M][];
		for(var i=0;i<M;i++){
			string[] str3 = Console.ReadLine().Split();
			B[i] = new long[2];
			B[i][0] = long.Parse(str3[0]);
			B[i][1] = long.Parse(str3[1]);
		}
		Array.Sort(B,(x,y)=>y[1].CompareTo(x[1]));
		long a1 = 0;
		var list = new List<long>();
		int ct = 0;
		for(var i=0;i<M;i++){
			for(var j=a1;j<B[i][0];j++){
				list.Add(B[i][1]);
				ct++;
				if(ct>N){
					break;
				}
			}
		}
		long ans = 0;
		for(var i=0;i<Math.Min(N,list.Count);i++){
			ans += Math.Max(A[i],list[i]);
		}
		for(var i=Math.Min(N,list.Count);i<N;i++){
			ans += A[i];
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 35136
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  ll S; 
  cin >> S;
  
  ll tmp = 1000000000;
  ll a = S / tmp;
  if(a == tmp) {
    cout << 0 << " " << 0 << " " << 0 << " " << tmp << " " << tmp << " " << 0 << endl;
  } else {
    cout << 0 << " " << 0 << " " << 1 << " " << tmp << " " << (a + 1) << " " << (tmp - S % tmp) << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define int long long
#define all(c) (c).begin(),(c).end()
#define endl '\n'
using namespace std;

//                                          mdsaqib
signed main(){
    fast;
    int a;
    cin >> a;
    cout << a+a*a+a*a*a;
    
}

Measured memory_bytes: 3608
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	cs := make([][]int, 3)
	for r := 0; r < 3; r++ {
		cs[r] = make([]int, 3)
	}

	for i := 0; i < 3; i++ {
		for j := 0; j < 3; j++ {
			cs[i][j] = nextInt()
		}
	}

	if cs[0][0] + cs[1][1] + cs[2][2] == cs[0][1] + cs[1][2] + cs[2][0] && cs[0][0] + cs[1][1] + cs[2][2] == cs[0][2] + cs[1][0] + cs[2][1] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 640
#include<iostream>
 
using namespace std;
#define newl '\n'

void solve(){
  int n ;
  cin >> n;
  int flag = 0;
  while( n != 0){
    int q = n % 10;
    if(q == 7){
      flag = 1;
    }
    n /= 10;
  }
  if(flag == 0){
    cout<< "No" <<endl;
  }
  else{
    cout<< "Yes" <<endl;
  }

}


int main(){
  
  solve();

}

Measured memory_bytes: 3128
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;

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

    int x, y;

    cin >> x >> y;

    cout << (x + y / 2) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int (i) = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int (i) = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int (i) = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define Pi 3.1415926535
#define MOD = 1e9+7;
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}

int solve(){
    double l; cin >> l;
    cout << l*l*l/27 << endl;

    return 0;
}

int main(){
    cin.tie(0);
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 100001
#define NIL -1
using namespace std;

struct Node {
	int parent, left, right;
};

Node **T;
int *depth;

Node* newNode(int parent, int left, int right){
	Node* p = new Node;
	p->parent=parent; p->left=left; p->right=right;
	return p;
}
void df(int id, int dp){
	depth[id] = dp;
	if(T[id]->left != NIL){
		int now = T[id]->left;
		while(1){
			if(now == NIL) break;
			df(now, dp+1);
			now = T[now]->right;
		}
	}
}

void calDepth(int n){
	int rt=NIL;
	for(int i=0;i<n;i++){
		if(T[i]->parent == NIL) rt = i;
	}
	df(rt, 0);
}

int main(){
	int n;
	cin >> n;
	T = new Node*[N];
	depth = new int[N];
	for(int i=0;i<n;i++) T[i] = newNode(NIL, NIL, NIL);
	for(int i=0;i<n;i++){
		int d,h;
		cin >> d >> h;
		if(h==0){
		} else {
			int bef=0;
			for(int j=0;j<h;j++){
				int l;
				cin >> l;
				if(j==0){
					T[d]->left = l;
				} else if(j>0){
					T[bef]->right = l;
				}
				bef = l;
				T[l]->parent = d;
			}
		}
	}
	calDepth(n);
	for(int i=0;i<n;i++){
		cout << "node " << i << ": parent = "<<T[i]->parent;
		cout << ", depth = " << depth[i] <<", ";
		if(T[i]->parent == NIL){
			cout << "root, ";
		} else if(T[i]->left==NIL){
			cout << "leaf, ";
		} else {
			cout << "internal node, ";
		}
		cout << "[";
		if(T[i]->left != NIL){
			int now = T[i]->left;
			while(1){
				cout << now;
				if(T[now]->right == NIL) break;
				cout << ", ";
				now = T[now]->right;
			}
		}
		cout << "]" << endl;
	}
	for(int i=0;i<N;i++) delete T[i];
	delete[] T;
	return 0;
}

Measured memory_bytes: 5492
n,m = map(int,input().split())
p = []
ansl = 1
ansr = n
for i in range(m):
    l,r = map(int,input().split())
    if ansl < l:
        ansl = l
    if ansr > r:
        ansr = r
print(max(0,ansr-ansl+1))

Measured memory_bytes: 43480
fun main(args: Array<String>) {
    val (N,K) = readLine()!!.split(" ").map { it.toInt() }
    val h = (1..N).map { readLine()!!.toInt() }.sorted()

    val ans = (1..N-K+1).map {
        val i = it - 1
        h[i+K-1] - h[i]
    }.min()

    println(ans)
}

Measured memory_bytes: 45372
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <sstream>
#include <math.h>
#include <functional>

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007

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

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

}



Measured memory_bytes: 384
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <bitset>
#include <array>
#include <set>
#include <string>

#include <iterator>
#include <algorithm>
#include <numeric>

#include <ios>
#include <sstream>
#include <iostream>
#include <fstream>


#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define range(i,m,n) for(int i=m, i<n;i++)
#define each(i,n) for(auto i:n)
#define all(i) i.begin(),i.end()

#define makevv(i,j,k,l,m) vector<vector<i>> j(k,vector<i>(l,m))

using vi=std::vector<int>;
using vvi=std::vector<vi>;
using pii=std::pair<int,int>;
using ll=long long;


template <typename T>
std::string printItr(T b, T e, std::string delim=" ")
{
    std::stringstream ss;
    std::ostream_iterator<decltype(*b)> out_it(ss, delim.c_str());
    std::copy(b,e - 1, out_it);
    ss<<*(e-1);
    return ss.str();
}
using namespace std;

int main(void){
    int n,m,ans=0;
    cin>>n>>m;
    vector<vector<int>> lst(n);
    vector<vector<int>> edge(m);
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        lst[a-1].push_back(b-1);
        lst[b-1].push_back(a-1);
        edge[i]={a-1,b-1};
    }
    each(e,edge){
        queue<int> stk;
        vi cost(n,0);
        stk.push(0);
        while(!stk.empty()){
            cost[stk.front()]=1;
            each(i,lst[stk.front()]){
                if(cost[i]==0 && (stk.front()!=e[0] || i!=e[1]) && (stk.front()!=e[1] || i!=e[0])){
                    stk.push(i);
                }
            }
            stk.pop();
        }
        bool is=false;
        each(i,cost){
            is|=(i==0);
        }
        if(is)ans++;
    }
    cout<<ans;


}

Measured memory_bytes: 256
word = list(input())

count = {}
result = "Yes"
for s in word:
  if count.get(s) != None:
    count[s] += 1
  else:
    count[s] = 1
if (len(count) != 2):
  result = "No"
else:
  for t in count.values():
    if t != 2:
      result = "No"

print(result)

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

vector<pair<int, int>> Search(int n)
{
    vector<pair<int, int>> vecRes;
    for(int i=1; i*i<=n; i++){
        if(n%i != 0)
            continue;

        vecRes.emplace_back();
        vecRes.back().first = i;
        vecRes.back().second = n/i;
    }

    return vecRes;
}

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

    vector<pair<int, int>> vecPair;
    vecPair = Search(n);

    bool Check = false;
    for(int i=0; i<vecPair.size(); i++){
        if(1<=vecPair[i].first && vecPair[i].first<=9){
            if(1<=vecPair[i].second && vecPair[i].second<=9){
                Check = true;
            }
        }
    }

    string res;
    res = Check ? "Yes" : "No";
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second
#define P pair<int, int>
typedef long long int ll;
using namespace std;
#define N 1000005
int num[N];

int main(){
    ll n, m, t, ans = 0;
    cin>>n>>m;
    ans = ((n-m)*100+1900*m);
    for(int i=0;i<m;++i){
        ans *= 2;
    }
    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;

ll gcd(ll a, ll b) {
  ll t;
  while(b) t = a % b, a = b, b = t;
  return a;
}

int main(void) {
  ll a, b;
  scanf("%lld%lld", &a, &b);
  printf("%lld", a * b / gcd(a, b));
  return 0;
}

Measured memory_bytes: 128