akhauriyash/Code-Regression huggingface dataset:
import bisect

INF = 10 ** 18

A, B, Q = map(int, input().split())
S = [-INF]
T = [-INF]
X = []

for i in range(A):
    s = int(input())
    S.append(s)

S.sort()
S.append(INF)

for j in range(B):
    t = int(input())
    T.append(t)

T.sort()
T.append(INF)

for i in range(Q):
    x = int(input())
    ans = INF
    idx_s, idx_t = bisect.bisect_right(S, x), bisect.bisect_right(T, x)
    for s in S[idx_s - 1], S[idx_s]:
        for t in T[idx_t - 1], T[idx_t]:
            a = abs(s - x) + abs(t - s)
            b = abs(t - x) + abs(s - t)
            ans = min(ans, a, b)
    print(ans)

Measured memory_bytes: 12092
import java.util.*;
//import java.util.stream.Collectors;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int h = Integer.parseInt(sc.next());
		sc.nextLine();
		String[] s = new String[h];
		Arrays.setAll(s, i -> sc.nextLine());
		for(int i=0; i<h; i++){
			System.out.println(s[i]);
			System.out.println(s[i]);
		}
	}
}


Measured memory_bytes: 36532
#include<iostream>
int main(){
  int n,k;
  std::cin >> n >> k;
  int h[n];
  int i;
  int cnt = 0;
  for(i=0;i<n;i++){
    std::cin >> h[i];
  }
  for(i=0;i<n;i++){
    if(h[i]>=k) cnt ++;
  }
  std::cout << cnt;
}

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

vector<int>graph[200100];
int sum[200100];
void dfs(int v,int p,int now)
{
	for(auto it:graph[v]){
		if(it==p)continue;
		dfs(it,v,sum[v]+now);
	}
	sum[v] += now;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,q;
	cin >> n >> q;
	for(int i=1;i<n;i++){
		int  u,v;
		cin >> u >> v;
		graph[u].push_back(v);
		graph[v].push_back(u);
	}
	while(q--){
		int p,x;
		cin >> p >> x;
		sum[p] += x;
	}
	dfs(1,-1,0);
	for(int i=1;i<=n;i++){
		cout << sum[i] << " ";
	}
	cout << "\n";
}


Measured memory_bytes: 26624
<?php
  $n = trim(fgets(STDIN));
  $a = explode(" ", trim(fgets(STDIN)));
  rsort($a);
  $alice = 0;
  for($i=0; $i<$n; $i++){
    if($i%2 == 0){
      $alice += $a[$i];
    }else{
      $alice -= $a[$i];
    }
  }
  echo $alice."\n";

Measured memory_bytes: 4604
#include <stdio.h>

int main()
{
    int W, H, x, y, r;
    scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);

    int flag = 1;
    if( y-r < 0 || H < y+r ) flag = 0;
    if( x-r < 0 || W < x+r ) flag = 0;

    if( flag ) printf("Yes\n");
    else printf("No\n");

    return 0;
}

Measured memory_bytes: 584
/*  -*- coding: utf-8 -*-
 *
 * e.cc: E - Almost Everywhere Zero
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;
const int MAX_K = 3;

/* typedef */

typedef long long ll;
typedef vector<int> vi;
typedef queue<int> qi;
typedef pair<int,int> pii;

/* global variables */

char s[MAX_N + 4];
int es[MAX_K + 1];

/* subroutines */

inline int nck(int n, int k) {
  if (n < k) return 0;
  if (k == 0) return 1;
  if (k == 1) return n;
  if (k == 2) return n * (n - 1) / 2;
  return n * (n - 1) * (n - 2) / 6;
}

/* main */

int main() {
  int k;
  scanf("%s%d", s, &k);
  int n = strlen(s);

  es[0] = 1;
  for (int i = 0; i < k; i++) es[i + 1] = es[i] * 9;

  int sum = 0;
  for (int i = 0; k > 0 && i < n; i++) {
    int ai = s[i] - '0';
    if (ai > 0) {
      sum += es[k] * nck(n - 1 - i, k);
      sum += (ai - 1) * es[k - 1] * nck(n - 1 - i, k - 1);
      k--;
      if (k == 0) sum++;
    }
  }

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


Measured memory_bytes: 384
N, M = [int(x) for x in input().strip().split(" ")]

import sys
c = 0
d = {}
for line in sys.stdin:
    p, r = [int(x) for x in line.strip().split(" ")]
    if p not in d:
        d[p] = []
    d[p].append((c, r)) 
    c += 1
rs = [""] * M
for key in d:
    tt = sorted(d[key], key = lambda x : x[1])
    for i, t in enumerate(tt):
        rs[t[0]] = "{:06d}{:06d}".format(key, i+1)

print("\n".join(rs))


Measured memory_bytes: 81372
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
          var a = cin.ReadInt;
          var b = cin.ReadInt;
          var p = a * b;
          if( p % 2 == 0){
            Console.WriteLine("Even");
          }else{
            Console.WriteLine("Odd");
          }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n;
ll a[100005];
ll m=100000000000000000;
ll cnt;
ll sum;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        m=min(m,abs(a[i]));
        sum+=abs(a[i]);
        if(a[i]<0){
            cnt++;
        }
    }
    if(cnt%2==0){
        cout<<sum<<endl;
    }else{
        cout<<sum-m*2<<endl;
    }

}


Measured memory_bytes: 4360
import java.util.Comparator;
import java.util.Scanner;

/* static int java.util.Arrays.binarySearch(int[] a, int key); */


public class Main {
    Scanner sc = new Scanner(System.in);
    String s, t;
    public void run(){
        s = sc.next();
        t = sc.next();
        solve();
    }
    public void solve(){
        for(int i = 0; i < s.length(); i++){
            String ns = s.substring(s.length()-1) + s.substring(0, s.length() - 1);
            s = ns;

            if(s.equals(t)){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }

    public static void main(String[] args){
        new Main().run();
    }

    static class Pair {
        int first,second;
        public Pair(int a,int b) {
            this.first = a;
            this.second = b;
        }
    }
    static class Edge{
        int to, cost;
        public Edge(int a, int b){
            this.to = a;
            this.cost = b;
        }
    }
    class MyComparator implements Comparator {
        @Override
        public int compare (Object arg0, Object arg1) {
            int x = ((Pair)arg0).first;
            int y = ((Pair)arg1).first;

            if (x < y) {
                return 1;
            } else if (x > y) {
                return -1;
            } else{
                return 0;
            }
        }
    }
    static class UnionFind{
        int par[];
        int rank[];

        //n要素で初期化
        public UnionFind(int maxn){
            par = new int[maxn];
            rank = new int[maxn];

            for(int i = 0; i < maxn; i++){
                par[i] = i;
                rank[i] = 0;
            }
        }

        //木の根を求める
        int find(int x){
            if(par[x] == x){
                return x;
            }
            else {
                return par[x] = find(par[x]);
            }
        }

        // xとyの属する集合を併合
        void unite (int x, int y){
            x = find(x);
            y = find(y);
            if(x == y){
                return;
            }

            if(rank[x] < rank[y]){
                par[x] = y;
            }
            else{
                par[y] = x;
                if(rank[x] == rank[y]) rank[x]++;
            }
        }

        // xとyが同じ集合に属するか否か
        boolean same(int x, int y){
            return find(x) == find(y);
        }
    }

}

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

using namespace std;

using ll = long long;

inline ll f(ll x) { return (x & 1 ? 3 * x + 1 : x / 2); }

int Solve() {
    ll s;
    cin >> s;

    ll x = s;
    std::vector<int> a;
    for (int i = 1; i < 1000; ++i) {
        a.push_back(x);
        x = f(x);
    }

    const int n = a.size();
    int ans = n * n;
    for (int i = 0; i < n; ++i) {
        int find = -1;
        for (int j = i + 1; j < n; ++j) {
            if (a[i] == a[j]) {
                find = j;
                break;
            }
        }
        if (find != -1) ans = min(ans, find + 1);
    }

    return ans;
}

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

    cout << Solve() << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <random>
#include <atcoder/all>
using namespace std; typedef unsigned long long _ulong; typedef long long int lint; typedef pair<lint, lint> plint; typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define endk '\n'
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
const lint MOD = 1e9 + 7, INF = 1e18;
lint dx[8] = { 0, -1, 1, 0, 1, -1, 1, -1 }, dy[8] = { 1, 0, 0, -1, -1, -1, 1, 1 };
typedef pair<lint, char> pa;

using namespace atcoder;
lint T, N, M, A, B;
int main() {
	cin >> T;
	while (T--) {
		cin >> N >> M >> A >> B;
		cout << floor_sum(N, M, A, B) << endk;
	}
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define DUMP(v) for(auto& x : v) cerr << x << " "; cerr << endl;
using namespace std;

using ll = long long;

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; }
constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);

inline ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

  int n, x;
  cin >> n >> x;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  ll ans = abs(x - a[0]);
  rep(i, n) {
    ans = gcd(ans, abs(x - a[i]));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
N=int(input())
a=[int(i) for i in input().split()]
res=[0]*N
for i in range(N,0,-1):
    cnt=0
    for times in range(2,N//i+1):
        cnt+=res[i*times-1]
    res[i-1] = 0 if cnt%2==a[i-1] else 1
print(sum(res))
for i in range(N):
    if res[i]==1:
        print(i+1,end=" ")
print()


Measured memory_bytes: 7276
// i_m_arin

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef priority_queue<ll> pqll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef map<ll,ll> mpll;
typedef set<ll> stll;

#define f(i, a, n) 	for(ll i=a; i<(ll)n; i++)
#define f2(i, a, b) for(ll i=a; i<=(ll)b; i++)
#define pb 			push_back
#define ff 			first
#define ss 			second
#define pf			push_front
#define mp			make_pair
#define all(a)		(a).begin(),(a).end()
#define decimal(x)	fixed<<setprecision(x)
#define fsort(a)	sort(all(a))
#define rsort(a)	sort(all(a),greater<>())
#define fast_io		ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mem0(a)		memset(a,0,sizeof(a))
#define mem1(a)		memset(a,-1,sizeof(a))
#define lcm(a,b)	(a*b)/__gcd(a,b)
#define ub(v,x)		upper_bound(all(v),x)-v.begin()
#define lb(v,x)		lower_bound(all(v),x)-v.begin()

const ld PI  = acos(-1);
const ll MOD = 1e9+7;
const ll INF = LLONG_MAX;
const ll SIZE= 100000;

vll ar[1000000];
bool vis[1000000];
ll level[1000000];
ll pos=-1,pos2;

void dfs1(ll node,ll par){
	if(par==0) level[node]=0;
	else level[node]=level[par]+1;
	vis[node]=true;
	for(auto x:ar[node]){
		if(!vis[x]) dfs1(x,node);
	}
}

ll dfs(ll node,ll par){
	vis[node]=true;
	for(auto x:ar[node]){
		if(!vis[x]){
			ll val=dfs(x,node);
			if(val!=0) return val;
		}
		else{
			if(x!=par) {
				pos=x;
				pos2=node;
				return abs(level[node]-level[x]+1);
			}
		}
	}
	return 0;

}

// vll vect(1000000);

// void dfs2(ll cur,ll req){
// 	vis[cur]=true;
// 	vect.pb(cur);
// 	if(cur==req) return;
// 	for(auto x:ar[cur]){
// 		if(!vis[x]) dfs2(x,req);
// 	}
// }

void solve(){
ll n,k;
cin>>n>>k;
ll a[n+5];
f(i,0,1000000) vis[i]=false;
f(i,1,n+1) {
	ll x;
	cin>>x;
	a[i]=x;
	ar[i].pb(x);
}
dfs1(1,0);

f(i,0,1000000) vis[i]=false;
ll ret=dfs(1,0);
if(pos==-1){
	ll ans=0,i=1;
	while(n--){
		ans=a[i];
		i=a[i];
	}
	cout<<ans<<endl;
}
else{
	ll ans=0;
	
	ll fir=level[pos]-level[1];
	if(k<=fir+ret){
		ll i=1;
		while(k--){
			ans=a[i];
			i=a[i];
		}
		cout<<ans<<endl;
	}
	else{

		k=k-(fir+ret);

		if(k>ret) k=k%ret;
		if(k==0) k=ret;
		// f(i,0,1000000) vis[i]=false;
		// dfs2(pos,pos2);
		// vll vet(n+5);
		// f(i,0,vect.size()){
		// 	if(vect[i]>0){

		// 		vet[vect[i]]=a[vect[i]];
		// 	}
		// }
		
		ll i=pos;
		while(k--){
			ans=a[i];
			i=a[i];
		}
		cout<<ans<<endl;
	}
}
}


int main(){
	fast_io;
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 46656
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  int n, l, x, a = 1;
  cin >> n >> l;
  rep(i,n)
  {
    cin >> x;
    l -= x;
    if (l < 0) {
      break;
    }
    a++;
  }
  cout << a;
}


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

using namespace std;

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

	vector<int32_t> v( n );
	for (auto& x : v) {
		cin >> x;
	}

	cout << count_if(v.begin(), v.end(), [a, b](int32_t n) {return n < a || b <= n; }) << endl;
}


Measured memory_bytes: 384
using System;

class Program
{
	static void Main(string[] args)
	{
		string[] strInput = Console.ReadLine().Split(' '); ;
		int x = int.Parse(strInput[0]);
		int y = int.Parse(strInput[1]);

		int tsuru, kame;

		if(y % 2 != 0)
		{
			Console.WriteLine("No");
			return;
		}

		kame = y / 2 - x;
		tsuru = 2 * x - y / 2;
		if(kame < 0 || tsuru < 0)
		{
			Console.WriteLine("No");
			return;
		}

		if(kame + tsuru == x)
		{
			if(2 * tsuru + 4 * kame == y)
			{
				Console.WriteLine("Yes");
				return;
			}
		}

		Console.WriteLine("No");
		return;
	}
}

Measured memory_bytes: 27372
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, M, K;
vi A, B;
string S, T;

void input() {
  int x, y, z;
  ;
  cin >> N;
}
void solve() {
  cout << "ABC" << N << endl;
  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

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

int main () {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  
  int s,t,u,z;
  
  s=a*b;
  t=c*d;
  u=(b-d)*c;
  z=(a-c)*d;
  
  cout << s-t-u-z;
}
  

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

#define NIL -1

int heap_size;

int parent(int i){
  return i/2;
}

int left(int i){
  return i*2;
}

int right(int i){
  return i*2+1;
}

void swap(int *a, int *b){
  int temp;

  temp = *a;
  *a = *b;
  *b = temp;

}

void maxHeapify(int *A, int i){
  int l, r, largest;

  l = left(i);
  r = right(i);

  if(l <= heap_size && A[l] > A[i]){
    largest = l;
  }else{
    largest = i;
  }

  if(r <= heap_size && A[r] > A[largest]){
    largest = r;
  }

  if(largest != i){
    swap(&A[i], &A[largest]);
    maxHeapify(A, largest);
  }
}

void buildMaxHeap(int *A){
  int i;

  for(i = heap_size/2; i > 0; i--){
    maxHeapify(A, i);
  }

}

void heapIncreaseKey(int *A, int i, int key){



  A[i] = key;

  while(i > 1 && A[parent(i)] < A[i]){
    swap(&A[i], &A[parent(i)]);
    i = parent(i);
  }

}

void maxHeapInsert(int *A, int key){
  heap_size = heap_size+1;
  A[heap_size] = NIL;
  heapIncreaseKey(A, heap_size, key);
}

int HeapExtractMax(int *A){

  int max;



  max = A[1];
  A[1] = A[heap_size];
  heap_size--;
  maxHeapify(A, 1);

  return max;
}


int main(){
  int i, k;
  int A[2000000];
  char s[10];

  scanf("%s", s);
  
  while(strcmp(s, "end") != 0){

    if(strcmp(s, "insert") == 0){
      scanf("%d", &k);
      maxHeapInsert(A, k);
    }else{
      printf("%d\n", HeapExtractMax(A));
    }  

    scanf("%s", s);

  }

  return 0;
}

Measured memory_bytes: 5024
#include <bits/stdc++.h>
using namespace std;
 //Compiler version g++ 6.3.0

 int main()
 {
 	long long int p,d,ans=0,y=0,z=0;
 	cin >> p>>d;
 	vector <long long int> b;
 	long long int a[p+1]{0};
 	a[0]++;
 	b.push_back(0);
 	for (int i = 0; i < p; i++){
 		long long int x;
 		cin >> x;
 		y=(x+y)%d;
 		b.push_back(y);
 		auto itr = find(b.begin(), b.end(), y);
 		long long int h=itr-b.begin();
 		a[h]++;
 		if(z<h){
 			z=h;
 		}
 	}
 	for (int i = 0; i <= z; i++){
 		ans=ans+a[i]*a[i]-a[i];
 	}
 	cout << ans/2 << endl;
 }

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

int main(){
    
    int n;
    cin >> n;
    vector<int> a(n);
    double pro=1,ans;

    rep(i,n){
        cin >> a[i];
        pro *= a[i];
    }

    rep(i,n){
        ans += pro/a[i];
    }

    printf("%.6f",pro/ans);

    return 0;
}


Measured memory_bytes: 256
using System;

#region Program
namespace Program
{
    #region Solver
    public class Solver
    {

        // ?????? ????´???° ??????
        public static int upper = 100;

        // ????´???°
        int N;

        // ??°???
        int[] A = new int[upper];

        #region Solver
        public Solver()
        {
            N = int.Parse(Console.ReadLine());

            /* ?????????????????¨?????????????????? */
            string[] strAryA = Console.ReadLine().Split(' ');

            /* ????????????????????´??°?????????????????? */
            A = Array.ConvertAll<string, int>(
                    strAryA
                    , delegate (string value)
                    {
                        return int.Parse(value); 
                    }
                );
        }
        #endregion

        #region Solve
        public void Solve()
        {
            trace(A, N);
            insertionSort(A, N);
        }
        #endregion

        #region insertionSort
        /* ?????\????????? 0?????????????????? */
        public void insertionSort(int[] A, int N)
        {
            int i;
            int j;
            int v;
            for (i = 1; i < N; i++)
            {
                v = A[i];
                j = i - 1;
                while (j >= 0 && A[j] > v)
                {
                    A[j + 1] = A[j];
                    j--;
                }
                A[j + 1] = v;
                trace(A, N);
            }
        }
        #endregion

        #region trace
        /* ?????????????´??????????????????? */
        public void trace(int[] A, int N)
        {
            int i;
            for (i = 0; i < N; i++)
            {
                if (i > 0)
                {
                    /* ??£??\??????????´??????????1????????????????????? */
                    Console.Write(" ");
                }
                Console.Write(A[i]);
            }
            /* ????°??????????????????? */
            Console.Write(Environment.NewLine);
        }
        #endregion
    }
    #endregion
}
#endregion

#region Execute
class Execute
{
    public static void Main(string[] args)
    {
        new Program.Solver().Solve();
    }
}
#endregion

Measured memory_bytes: 9328
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define pll pair<ll,ll>
#define vll vector<ll>
#define forn(i,n) for(ll i=0; i<n; ++i)
#define pb push_back
#define MOD 1000000007
#define range(c) c.begin() , c.end()
#define Print(a) for(auto it : a)cout << (it) <<" ";cout << endl;
#define test ll t;cin >> (t);while(t--)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : ";cout << arg1 <<" ";}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {const char *comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : ";
cout << arg1 <<" ";cout << " | ";__f(comma + 1, args...);}
char local ='O';
#define db(...) if(local=='L') {__f(#__VA_ARGS__, __VA_ARGS__); cout<<endl;}
//////////////////////////////////////////////////////////////
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
	local = 'L';
#endif

	string s;
	cin >> s;
	ll ans = 0;
	forn(i,s.size())
	{
		ans+= s[i] - '0';
	}
	if(ans%9)
		cout << "No";
	else
		cout <<"Yes";
}

Measured memory_bytes: 3780
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
using namespace std;
using ll = long long;
typedef std::pair<ll,ll> P;
//#include <boost/multiprecision/cpp_int.hpp>
//using bint = boost::multiprecision::cpp_int;


int main(){
    string s;
    cin >> s;
    int a = 0;
    int b = 0;
    rep(i,3){
        if (s[i]=='A') a= 1;
        if(s[i] == 'B') b = 1;
    }
    cout << (a*b?"Yes":"No");
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String args[]){
        String lang1;
        String lang2;
        String lang3;
        Scanner sc = new Scanner(System.in);

        lang1 = sc.next();
        lang2 = sc.next();
        lang3 = sc.next();
        String[] lang_ = lang2.split("");

        System.out.println("A" + lang_[0] + "C");
    }
}

Measured memory_bytes: 21716
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String t0 = sc.nextLine();
      	String t = sc.nextLine();
		String S[] = t.split("");
		String  tmp = S[0];
		int count = 1;

		for(int i = 1; i < S.length;i++) {
			String s = S[i];
			if(tmp.equals(s)) {
				
			}else {
				count++;
			}
			tmp = s;
		}
		System.out.println(count);
	}

}



Measured memory_bytes: 32452
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
#include <numeric>
using namespace std;

#define all(container) container.begin(), container.end()
#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))
#define LLONG_MAX numeric_limits<long long>::max()
#define INT_MAX numeric_limits<int>::max()

typedef long long       ll;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<vi>		vvi;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;

typedef struct edge_ {
	ll to;
	ll cost;
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

constexpr double	PI = 3.14159265358979323846;
constexpr ll		INF = 1 << 15;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template<typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

istream& operator >> (istream& is, point& p) {
	is >> p.x >> p.y;
	return is;
}

template<typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) {
	os << "{" << p.first << " " << p.second << "}";
	return os;
}

ostream& operator << (ostream& os, const point& p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}


template <typename T>
void vecOutPadding(vector<T>& vec, string pad = " ") {
	for (const T& elem : vec)
		cout << elem << pad;
}

template <typename T>
void matOut(vector<vector<T>>& mat) {
	for (const auto& row : mat) {
		for (const T& col : row)
			cout << col << " ";
		cout << endl;
	}
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/


int main()
{
	string s;
	cin >> s;
	int ans = 0;
	for (auto ss : s) {
		if (ss == '2') ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.*;
import java.util.function.*;
import java.util.function.Predicate;
import java.math.BigInteger;
import java.rmi.MarshalException;
import java.time.Instant;
import java.time.Duration;
import java.util.concurrent.*;

public class Main {
    static String lastcard(String a, String b) {
        int k = a.length();
        String ret = "";
        for (int i = 0; i < k; i++) {
            if (a.charAt(i) == b.charAt(i)) {
                ret += a.charAt(i);
            } else {
                if (a.charAt(i) == 'S' && b.charAt(i) == 'E' || a.charAt(i) == 'E' && b.charAt(i) == 'S') {
                    ret += 'T';
                }
                else if (a.charAt(i) == 'S' && b.charAt(i) == 'T' || a.charAt(i) == 'T' && b.charAt(i) == 'S') {
                    ret += 'E';
                }
                else if (a.charAt(i) == 'E' && b.charAt(i) == 'T' || a.charAt(i) == 'T' && b.charAt(i) == 'E') {
                    ret += 'S';
                }
            }
        }
        return ret;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // long startTime = System.nanoTime();
        // int  = sc.nextInt();
        // int  = sc.next();
        /////////////////////////////////////////////////////
        String s = sc.next();
        System.out.println((char) (s.charAt(0) + 1));
        /////////////////////////////////////////////////////
        // long endTime = System.nanoTime();
        // System.out.printf("Executed in: %.2fms\n", ((double)endTime - startTime) / 1000000);
        // sc.close();
    }

    static boolean isEven(int n) {
        return n % 2 == 0;
    }
    static boolean isOdd(int n) {
        return n % 2 == 1;
    }
     
    static boolean isPrime(int n) {
        if (n == 0 || n == 1) {
            return false;
        } else {
            for (int i = 2; i * i <= n; i++) {
                if (n % i == 0) {
                    return false;
                }
            }
            return true;
        }
    }
}

class Pair {
    public int x;
    public int y;

    public Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        // System.out.println("inside equals");
        if (o == this) {
            return true;
        } else if (!(o instanceof Pair)) {
            return false;
        } else {
            Pair p = (Pair)o;
            return this.x == p.x && this.y == p.y;
        }
    }

    @Override
    public int hashCode() {
        // System.out.println("inside hashcode");
        return Arrays.hashCode(new int[]{this.x, this.y});
    }

    @Override
    public String toString() {
        return "(" + this.x + ", " + this.y + ")";
    }
}

Measured memory_bytes: 20692
#include<bits/stdc++.h>
#define ff first
#define ss second
#define INF (int)2e9
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main(void){
	ios::sync_with_stdio(false); cin.tie(NULL);
	ll n; cin>>n;
	cout<<(n-1)*n/2;
	return 0;
}

Measured memory_bytes: 256
n, m = list(map(int, input().split()))
ans = 1
if n==m:
    for i in range(1, n+1):
        ans *= i
        ans %= 10**9+7
    print((ans**2*2)%(10**9+7))
elif abs(n-m)==1:
    for i in range(1, n+1):
        ans *= i
        ans %= 10**9+7
    for i in range(1, m+1):
        ans *= i
        ans %= 10**9+7
    print(ans%(10**9+7))
else:
    print(0)

Measured memory_bytes: 3064
#include<stdio.h>
int main(void)
{
	int a,b,i,x,s;
	if (scanf("%d", &a) == 1) {}
	if (scanf("%d", &b) == 1) {}
	i = 0;

	for(s = 1;s < b;)
	{
		s = (s - 1) + a ;
			i++;
	
	
}
printf("%d\n",i);
return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<cstring>
#include<unordered_map>
using namespace std;

int n,m;
vector<vector<int>> adj;
vector<long> dp1;
vector<long> dp2;

/*long rec(vector<int> adj[], int m, int id, long **mem, int prev=-1)
{
  if(prev!=-1&&mem[id][prev]!=-1)
    return mem[id][prev];
  long ans=1;
  for(int i=0;i<adj[id].size();i++)
  {
    if(adj[id][i]!=prev)
    {
      ans*=rec(adj,m,adj[id][i],mem,id);
      ans%=m;
    }
  }
  if(prev!=-1)
	ans++;
  ans%=m;
  mem[id][prev]=ans;
  return ans;
}*/

void dfs1(int vert, int par)
{
  int sz=adj[vert].size();
  long w=1;
  for(int i=0;i<sz;i++)
  {
    int ch=adj[vert][i];
    if(ch!=par)
    {
      dfs1(ch,vert);
      w*=(dp1[ch]+1)%m;
      w%=m;
    }
  }
  dp1[vert]=w;
}


void dfs2(int vert, int parval, int par)
{
  int sz=adj[vert].size();
  long w=1;
  w=(dp1[vert]*((1+parval)%m))%m;
  dp2[vert]=w;
  vector<int> child;
  for(int i=0;i<sz;i++)
  {
    if(adj[vert][i]!=par)
      child.push_back(adj[vert][i]);
  }
  sz=child.size();
  vector<long> pre(sz,1), suf(sz,1);
  for(int i=1;i<sz;i++)
  {
    pre[i]=(pre[i-1]*((dp1[child[i-1]]+1)%m))%m;
  }
  for(int i=sz-2;i>=0;i--)
  {
    suf[i]=(suf[i+1]*((dp1[child[i+1]]+1)%m))%m;
  }
  for(int i=0;i<sz;i++)
  {
    int u=child[i];
    int pv=(((pre[i]*suf[i])%m)*((parval+1)%m))%m;
    dfs2(u,pv,vert);
  }
  
    
}


int main(){
  cin>>n>>m;
  adj.resize(n);
  for(int i=0;i<n-1;i++)
  {
    int x,y;
    cin>>x>>y;
    adj[x-1].push_back(y-1);
    adj[y-1].push_back(x-1);
  }
  /*long **mem=new long*[n+1];
  for(int i=0;i<=n;i++)
  {
  	mem[i]=new long[n+1];
  	for(int j=0;j<=n;j++)
  	  mem[i][j]=-1;
  }
  
  for(int i=1;i<=n;i++)
  {
  	cout<<rec(adj,m,i,mem)<<endl;
  }*/
  
  
  dp1.resize(n,-1);
  dp2.resize(n,-1);
  
  dfs1(0,-1);
  dfs2(0,0,-1);
  
  for(int i=0;i<n;i++)
    cout<<dp2[i]<<endl;
  

}

Measured memory_bytes: 22912
package main

import "fmt"
import "bufio"
import "os"
import "strconv"

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
//  var sc = bufio.NewScanner(os.Stdin
  
  cnt := 0
  
  sc.Split(bufio.ScanWords)
  num := nextInt()
  
  var arr []int
  for i:=0; i<num; i++ {
    arr = append(arr, nextInt())
  }

  for ; ; cnt++ {
    for i:=0; i<num; i++ {
      if arr[i] % 2 != 0 {
        fmt.Print(cnt)
        return
      }
      arr[i] /= 2
    }
  }

  fmt.Print(cnt)  
}

Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef long long ll;
int n, k;
int main(){
    scanf("%d%d", &n, &k);
    printf("%s\n", k <= (n + 1) / 2 ? "YES": "NO");
    return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx2")
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
void FastInputOutput(){
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}

ll power(ll x, ll p, ll m){
    ll res = 1;
    while(p){
        if(p&1)    res = (res * x)%m;
        x = (x * x)%m;
        p >>= 1;
    }
    return res;
}


const int N = 1e5 + 5;
int dp[N], n;
int solve(int rem){
    if(rem <= 0)
        return -1e9 * rem < 0;
    int &ret = dp[rem];
    if(~ret)
        return ret;
    ret = solve(0) + rem;
    for(int i = 9; i <= rem; i *= 9)
        ret = min(ret, solve(rem - i) + 1);
    for(int i = 6; i <= rem; i *= 6)
        ret = min(ret, solve(rem - i) + 1);
    return ret;
}
int main(){
    memset(dp, -1, sizeof(dp));
    printf("%d", solve(n = D()));
    return 0;
}


Measured memory_bytes: 2560
fun main (args:Array<String>){
    val num = readLine()
    if (num != null) {
        if(num.endsWith("3")){
            print("bon")
        }
        else if(num.endsWith("0")){
            print("pon")
        }else if(num.endsWith("1")){
            print("pon")
        }else if(num.endsWith("6")){
            print("pon")
        }else if(num.endsWith("8")){
            print("pon")
        }
        else{
            print("hon")
        }

    }
}

Measured memory_bytes: 35572
#include<stdio.h>
#include<stdlib.h>
#include<string.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 MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

typedef struct slobj_{
    struct slobj_ *next;
    int v; //uから枝が伸びている節点v
    int d; //枝(u,v)の重み
}* slobj;

//slobj型のリストの定義
typedef struct{
    slobj head;
    slobj tail;
}* slist;

//グラフの構造体の定義
typedef struct{
    int n; //節点数
    slist* E; //枝リストの配列E[0]~E[n-1],未ソート単方向
}* graph;

//vにn,dにxを持つslobj型のリスト要素のメモリ確保+作成する関数
slobj slobj_new(int n,int x){
    slobj p;
    NEW(p,1);
    p->v=n;
    p->d=x;
    p->next=NULL;
    return p;
}

//slist型のメモリを1個確保し、空リスト1つを作る関数
slist slist_new(void){
    slist L;
    NEW(L,1);
    L->head=NULL;
    L->tail=NULL;
    return L;
}

//各slistを空リストにした,節点nのgraph型のメモリを確保する関数(Eは0カウント)
graph graph_new(int n){
    graph G;
    NEW(G,1);
    
    G->n=n;
    
    NEW(G->E,G->n);
    int i;
    for(i=0;i<G->n;i++){
        G->E[i]=slist_new();
    }
    
    return G;
}

//リストLの末尾に要素rを追加する関数
void slist_append_tail(slist L,slobj r){
    if(L->head==NULL){
        L->head=r;
        L->tail=r;
    }
    else{
        L->tail->next=r;
        L->tail=r;
    }
    
    return;
}

//節点i(0~n-1)から節点j(0~n-1)に、重さxの枝を追加する関数
void add_edge(graph G, int i, int j, int x){
    //枝データを追加
    slobj p=slobj_new(j,x);
    slist_append_tail(G->E[i],p);

    return;
}

//根(節点i)からの長さをdfs
void dfs(graph G, int i, int* d){
	slobj p=G->E[i]->head;
	while(p!=NULL){
		if(d[p->v]==-1){ //未探索なら
			d[p->v]=d[i]+p->d;
			dfs(G,p->v,d);
		}
		p=p->next;
	}
	return;
}

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

    graph G=graph_new(N);

    for(int i=0;i<N-1;i++){
        int a,b;
        scanf("%d%d",&a,&b);
        a--;
        b--;
        add_edge(G,a,b,1);
        add_edge(G,b,a,1);
    }

    int* d1;
    int* d2;
    NEW(d1,N);
    NEW(d2,N);
    for(int i=0;i<N;i++){
        d1[i]=-1;
        d2[i]=-1;
    }
    d1[0]=0;
    d2[N-1]=0;
    dfs(G,0,d1);
    dfs(G,N-1,d2);

    int black=0;
    int white=0;
    for(int i=0;i<N;i++){
        if(d1[i]<=d2[i]) black++;
        else white++;
    }

    if(black>white) printf("Fennec\n");
    else printf("Snuke\n");

    return 0;
}

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

int main(){
    int H,W,N;
    cin >> H >> W;
    cin >> N;

    vector<int> a(N);
    for(int i=0;i<N;i++)cin >> a[i];
    
    vector<vector<int>> grid(H,vector<int>(W));
    int k=1;
    int cnt=0;
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(i%2==0){
                grid[i][j]=k;
            }else{
                grid[i][W-1-j]=k;
            }
            cnt++;
            if (cnt>=a[k-1]){
                cnt=0;
                k++;
            }
        }
    }
    for(int i=0; i<H;i++){
        for(int j=0; j<W; j++){
            if(j>0) cout << ' ';
            cout << grid[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 384
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

struct UnionFind {
    par: Vec<usize>,
    rank: Vec<usize>,
}

impl UnionFind {
    fn new(n: usize) -> UnionFind {
        let mut vec = vec![0;n];
        for i in 0..n {
            vec[i] = i;
        }
        UnionFind {
            par : vec,
            rank : vec![0;n],
        }
    }

    fn find(&mut self, x: usize) -> usize {
        if x == self.par[x] {
            x
        }else{
            let par = self.par[x];
            let res = self.find(par);
            self.par[x] = res;
            res
        }
    }

    fn same(&mut self, a: usize, b: usize) -> bool {
        self.find(a) == self.find(b)
    }

    fn unite(&mut self, a: usize, b: usize){
        let apar = self.find(a);
        let bpar = self.find(b);
        if self.rank[apar] > self.rank[bpar] {
            self.par[bpar] = apar;
        }else{
            self.par[apar] = bpar;
            if self.rank[apar] == self.rank[bpar] {
                self.rank[bpar] += 1;
            }
        }
    }
}

use std::collections::HashMap;

fn main() {
    let (n, k, l) = get!(usize, usize, usize);
    let mut kq = UnionFind::new(n);
    let mut lq = UnionFind::new(n);
    for _ in 0..k {
        let (p, q) = get!(usize, usize);
        kq.unite(p-1, q-1);
    }
    for _ in 0..l {
        let (r, s) = get!(usize, usize);
        lq.unite(r-1, s-1);
    }
    let mut map = HashMap::new();
    for i in 0..n {
        let key = (kq.find(i), lq.find(i));
        let x = map.entry(key).or_insert(0);
        *x += 1;
    }
    let mut ans = Vec::new();
    for i in 0..n {
        let key = (kq.find(i), lq.find(i));
        if let Some(x) = map.get(&key) {
            ans.push(x.to_string());
        }
        
    }
    println!("{}", ans.join(" "));
}

Measured memory_bytes: 28320
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int CalcAns(vector<int> V){
    int x=0;
    rep(i,0,V.size()){
        x*=10;
        if(V.at(i)!=-1) x+=V.at(i);
    }
    return x;
}

int main(){
    int N,M; cin>>N>>M;
    vector<pair<int,int>> SC(M);
    rep(m,0,M){
        int s,c; cin>>s>>c;
        SC.at(m)=make_pair(s,c);
    }

    int ini,ans=-1;
    if(N==1) ini=0;
    else ini=pow(10,N-1);
    rep(i,ini,pow(10,N)){
        bool f=true;
        for(auto sc:SC){
            if(to_string(i).at(sc.first-1)-'0'!=sc.second) f=false;
        }
        if(f){ans=i; break;}
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
def main():
    x,y = (int(x) for x in input().split())
    g1 = [1,3,5,7,8,10,12]
    g2 = [4,6,9,11]
    if (x in g1 and y in g1) or (x in g2 and y in g2): print('Yes')
    else: print('No')

if __name__ == '__main__':
    main()

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

int main() {
	int x, a, b, eatDate;
	cin >> x >> a >> b; eatDate = a - b;
	if (eatDate < 0) {  // eat it after best buy adte
		eatDate = -eatDate;
		if (eatDate > x) cout << "dangerous" << endl;
		else cout << "safe" << endl;
	} else {
		cout << "delicious" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    ll N;cin>>N;
    ll A,B;cin>>A>>B;
    if(A%2==B%2){
        cout<<(B-A)/2<<endl;
        return 0;
    }else{
        ll ans=0;
        ll tmp=0;
        tmp+=A;
        tmp+=(B-A-1)/2;
        ans+=N-B+1;
        ans+=(B-A-1)/2;
        cout<<min(ans,tmp)<<endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#define int long long int
#define ldouble long double
#define vin vector<int>
#define rep(a,n) for(int i=(a);i<(n);i++)
#define INF (int)1000000007

//setprecision()<<

using namespace std;

void fin(int n,vin &a){
    rep(0,n){
        cin>>a.at(i);
    }
}

signed main(){
    typedef pair<int,int> P;
    int K,N;
    cin>>N>>K;
    vin p(N);
    fin(N,p);

    vector<ldouble> psum(1001); //和格納
    rep(1,1001){
        psum.at(i)=psum.at(i-1)+(ldouble)i;
        //cout<<psum.at(i)<<endl;
    }
    
    vector<ldouble> ruiseki(N);
    ruiseki.at(0)=psum.at(p.at(0))/(ldouble)p.at(0);
    rep(0,N-1){
        ruiseki.at(i+1)=ruiseki.at(i)+psum.at(p.at(i+1))/(ldouble)p.at(i+1);
        //cout<<ruiseki.at(i+1)<<endl;
    }
    int begin=0; //どこから始めるか
    ldouble max=ruiseki.at(begin+K-1);
    for(begin;begin<N-K;begin++){
        if(max<ruiseki.at(begin+K)-ruiseki.at(begin)){
            max=ruiseki.at(begin+K)-ruiseki.at(begin);
        }
    }
    cout<<fixed<<setprecision(10)<<max<<endl;
    return 0;
}

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

string n;
bool c,f;
int asa;
int main()
{
    cin>>n;
    for(int i=0;i<n.size();i++)
    {
    	if(n[i]=='C')
    	{
    		c=true;
		}
		if(n[i]=='F' && c==true)
    	{
    		f=true;
		}
	}
	if(c==true && f==true)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
   return 0;
}


Measured memory_bytes: 256
import sys
f = sys.stdin

def is_odd(num):
    return num % 2 == 1

intersection = [0 for _ in range(101)]
for line in f:
    a, b = map(int, line.split())
    if a == b == 0:
        if is_odd(intersection[1]) and is_odd(intersection[2]) and 0 == sum(1 for i in range(3, len(intersection)) if is_odd(intersection[i])):
            print('OK')
        else:
            print('NG')
        intersection = [0 for _ in range(101)]
    else:
        intersection[a] += 1
        intersection[b] += 1

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

int compare_string(const void *a, const void *b) {
  return strcmp(a,b);
}


int main(){
	
	int N,L,i;
	scanf("%d%d",&N,&L);
	
	char moji[110][110];
	
	for(i=0;i<N;i++){
	scanf("%s",moji[i]);
	}
	
	
	qsort(moji,N,sizeof(moji[0]),compare_string);
	
	for(i=0;i<N;i++){
	printf("%s",moji[i]);
	}

	
	return 0;
}

Measured memory_bytes: 252
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string.h>
#define N 103
using namespace std;
int  dp(int ,int );
int tmp [2][N];
int ans [2][N];
 int n;
int main ()
{

    while (scanf ("%d",&n)!=EOF)
    {
        for (int i=0;i<n;i++) scanf ("%d",&tmp[0][i]);
        for (int i=0;i<n;i++) scanf ("%d",&tmp[1][i]);
        memset(ans , 0xff ,  sizeof(ans));
  
        printf ("%d\n",dp(0,0));
    }

    return 0;
}

int dp ( int x , int y)
{

    if (ans[x][y]!=-1)  return ans[x][y];
    else if (x==1&&y==n-1) return ans[x][y]=(tmp[x][y]);
    else if (x==1) return ans[x][y]=(tmp[x][y]+ dp(x,y+1));
    else if (x==0 && y==n-1) return ans[x][y] = (tmp[x][y]+dp (x+1,y));
    else  return ans[x][y]=(tmp[x][y] + max (dp(x+1,y) , dp (x,y+1)));
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

ll n, x, d;
map<int, vector<pair<ll, ll>>> mp;
set<int> st;
ll ans;

signed main() {
	cin >> n >> x >> d;
	if (d == 0) {
		if (x != 0)cout << n + 1 << endl;
		else cout << 1 << endl;
		return 0;
	}
	for (ll i = 0; i <= n; i++) {
		ll p = x * i + i * (i - 1) / 2 * d;
		ll q = x * i + (n*(n - 1) / 2 - (n - i)*(n - i - 1) / 2)*d;
		ll mi = min(p, q);
		ll ma = max(p, q);
		mp[(abs(d) + ma % abs(d)) % abs(d)].push_back(make_pair(mi, ma));
		st.insert((abs(d) + ma % abs(d)) % abs(d));
	}
	auto p = st.begin();
	while (p != st.end()) {
		sort(all(mp[*p]));
		ll ma = -9000000000000000000;
		for (int i = 0; i < (int)mp[*p].size(); i++) {
			if (mp[*p][i].second < ma)continue;
			ans += (mp[*p][i].second - max(ma, mp[*p][i].first)) / abs(d) + 1;
			ma = mp[*p][i].second + abs(d);
		}
		p++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 31488