akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
//import java.util.stream.Collectors;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		System.out.println("" + s.charAt(0) + (s.length() - 2) + s.charAt(s.length() - 1));
	}
}


Measured memory_bytes: 39184
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define ushi int
#define tapu main
#define nichia (
#define kunn void
#define wara )

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main(){

	string s;
	scans(s);
	printf("%s", s.substr(0, 4).c_str());
	printf(" ");
	prints(s.substr(4, s.length()));
	Please AC;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

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

	void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int[] a = new int[s.length()];
		for (int i = 0; i < s.length(); ++i) {
			a[i] = (int) (s.charAt(i) - '0');
		}
		for (int i = -1; i <= 1; i += 2) {
			for (int j = -1; j <= 1; j += 2) {
				for (int k = -1; k <= 1; k += 2) {
					if (a[0] + i * a[1] + j * a[2] + k * a[3] != 7)
						continue;
					int[] v = new int[] { i, j, k };
					for (int l = 0; l < 4; ++l) {
						System.out.print(a[l]);
						if (l < 3)
							System.out.print(v[l] == 1 ? "+" : "-");
					}
					System.out.println("=7");
					return;

				}
			}
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


Measured memory_bytes: 21716
#!/usr/bin/env python
#-*- coding: utf-8 -*-

import sys

if __name__ == '__main__':
    line = None
    while 1:
        line = raw_input()
        a, op, b = line.split()
        if op == '+':
            print int(a) + int(b)
        elif op == '-':
            print int(a) - int(b)
        elif op == '*':
            print int(a) * int(b)
        elif op == '/':
            print int(a) / int(b)
        elif op == '?':
        	break



Measured memory_bytes: 4656
num1, num2, num3 = [int(i) for i in input().split()]
sum1 = 0

for index1 in range(num1+1):
    d1 = int(index1/ 10000)
    d2 = int(int(index1%10000)/1000)
    d3 = int(int(int(index1%10000)%1000)/100)
    d4 = int( int(int(int(index1%10000)%1000)%100)/10)
    d5 = index1%10

    if (d1+d2+d3+d4+d5) >= num2 and (d1+d2+d3+d4+d5) <= num3:
        sum1 += index1

print(sum1)


Measured memory_bytes: 3064
string = str(input())
N = len(string)
zenhan = string[:int((N-1)/2)]
kouhan = string[int((N-1)/2)+1:]

def IsKaibun(string):
    if string == string[::-1]:
        return True
    else:
        return False
      
if IsKaibun(string) and IsKaibun(zenhan) and IsKaibun(kouhan):
    print("Yes")
else:
    print("No")

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

int main(){
  int n; cin >> n;
  vector<int> p(n);
  vector<int> a(n);
  for(int i = 0; i < n; i++){
     cin >> p[i];
     a[i] = i+1;
   }
  string ans = "NO";
  for(int i = 0; i < n; i++){
    for(int j = i+1; j < n; j++){
      if(a==p){
        ans="YES";
        break;
      }
      swap(p[i],p[j]);
      if(p==a){
        ans="YES";
        break;
      }
      swap(p[i],p[j]);
    }
  }
  cout <<ans << endl;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define ZERO(a) memset(a,0,sizeof(a))

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


ll dp[2020][2020], cum[2020][2020];



int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n,m;
  cin>>n>>m;
  vll s(n), t(m);
  REP(i,n)cin>>s[i];
  REP(i,m)cin>>t[i];

  REP(i,2020)REP(j,2020)dp[i][j]=0;
  REP(i,2020)REP(j,2020)cum[i][j]=0;
  REP(i,2020)cum[0][i]=cum[i][0]=1;

  ll ans = 1;
  REP(i,n){
    REP(j,m){
       if(s[i]==t[j])
        dp[i+1][j+1] = cum[i][j];
       ans = (ans+dp[i+1][j+1])%MOD;

       cum[i+1][j+1] = (cum[i][j+1]+cum[i+1][j]-cum[i][j]+MOD+dp[i+1][j+1])%MOD;
    }

  }

  cout<<ans<<endl;

}


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

typedef long long ll;

/* メモリ食い過ぎ注意 */
#define int ll
#define ALL(v) v.begin(), v.end()
#define _REP(i, n) for (int i = 0; i < n; i++)
#define REP(n) _REP(i, n)

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int n;
    int h[100001] = {};
    ll dp[100001];
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> h[i];
    for (int i = 0; i <= n; i++)
        dp[i] = INF;
    dp[0] = 0;
    dp[1] = 0;
    dp[2] = abs(h[1] - h[2]);
    for (int i = 3; i <= n; i++)
    {
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
    }
    // for (int i = 0; i <= n; i++)
    // cout << dp[i] << " ";
    // cout << endl;

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

Measured memory_bytes: 1792
import static java.util.Comparator.comparing;

import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==========================================================
    int N;
    int[] A;
    long[][] memo;
    long calc(int now, int left) {
    	if(now >= N)				return 0;
    	if(memo[now][left] != -1)	return memo[now][left];
    	long ans = 0;
    	int right = left + N - now - 1;
    	if(now % 2 == 0) {				// 先手
        	ans = calc(now + 1, left + 1) + A[left];
        	ans = Math.max(ans, calc(now + 1, left) + A[right]);
    	} else {						// 後手
        	ans = calc(now + 1, left + 1) - A[left];
        	ans = Math.min(ans, calc(now + 1, left) - A[right]);
    	}
    	return memo[now][left] = ans;
    }
    public void solve() {
    	N = ni();
    	A = ndi(N);
    	memo = new long[N][N];
    	for (int i = 0; i < N; i++) {
			Arrays.fill(memo[i], -1);
		}
    	out.println(calc(0, 0));
    }
    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return sc.nextInt();
    }
    public long nl() {
    	return sc.nextLong();
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] nddi(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
}


Measured memory_bytes: 129764
def primes(n):
  flags = [True] * (n + 1)
  flags[0] = False
  flags[1] = False
  for i in range(2, int(n ** 0.5) + 1):
    if not flags[i]:
      continue
    for j in range(2 * i, n + 1, i):
      if j % i == 0:
        flags[j] = False
  return [i for i in range(n + 1) if flags[i]]

n = int(input())
P = primes(n)
total = 1
counts = [0] * (n + 1)
for i in range(2, n + 1):
  for p in P:
    num = p
    count = 0
    while i % num == 0:
      num *= p
      count += 1
    counts[p] += count
for p in P:
  if counts[p] > 0:
    total = (total * (counts[p] + 1)) % (10 ** 9 + 7)
print(total)

Measured memory_bytes: 3188
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll x;
  cin>>x;
  ll res = x/11*2;
  x %= 11;
  if(x) res++;
  if(x>6) res++;
  cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    /* 変数宣言，ちゃんと初期化しよう */
    int N = 0;
    int M = 0;
    int K = 0;
    
    /* 変数宣言終わり */
    
    /* 入力を受け付ける部分*/
    
    // %dはdecimalの略．つまり，入力を10進数として扱うよという意味．
    scanf("%d %d %d", &N, &M, &K);
    
    /* 入力を受け付ける部分終わり*/
    
    
    /* 何か処理*/
 
    
    if(N + M + K >= 22){
      /* 真の場合の処理 */
      printf("bust");
    }else{
      /* 偽の場合の処理 */
      printf("win");
    }
    
    for(int i = 0; i < 10; i++){ 
      // i = 0,1,2,3,4,5,6,7,8,9のとき処理される
      
    }
    
    /* 何か処理終わり*/
    
    
    /* 出力する部分*/
 // %dの部分にansの値が表示される
    
    /* 出力する部分*/
    
    
    
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (1e+18) + 7;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1<<18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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

void solve() {
	int n; cin >> n;
	vector<int> a(n);
	rep(i, n)cin >> a[i];
	int pre = -1;
	rep(i, n) {
		if (a[i] - 1 >= pre)a[i]--;
		pre = a[i];
	}
	rep(i, n - 1) {
		if (a[i] > a[i + 1]) {
			cout << "No" << endl; return;
		}
	}
	cout << "Yes" << endl;
}



signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init_f();
	//init();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	stop
		return 0;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int sum=0, t[105],N,M,a,b,p[100][100];
    cin>>N;
    for(int i=0 ; i<N ; i++) cin>>t[i];
    cin>>M;
    for(int i=0 ; i<M ; i++){
        cin>>a>>b;
       /// t[a-1]=b;
        for(int j=0 ; j<N ; j++)
       {
          if(j==a-1) sum+=b;
          else sum+=t[j];

       }
       cout<<sum<<endl;
       sum=0;
    }

}



Measured memory_bytes: 256
using System;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            int n = int.Parse(Console.ReadLine());
            string[] a_list_tmp = Console.ReadLine().Split(' ');
            long[] a_list = a_list_tmp.Select(s => long.Parse(s)).ToArray();
            long sum = 0;

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

            Console.WriteLine(sum);
        }

        static ulong Gcd(ulong a, ulong b)//最大公約数
        {
            return (a < b) ? Gcd(b, a) : (b > 0) ? Gcd(b, a % b) : a;
        }

        static ulong Lcm(ulong a, ulong b)//最小公倍数
        {
            return a / Gcd(a, b) * b;
        }
    }
}


Measured memory_bytes: 13408
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    vector<pair<int, int> > ps;
    for (int i = 0; i < n; i++) {
        int x, y; cin >> x >> y;
        if (x != 0 || y != 0) ps.push_back({x, y});
    }
    sort(ps.begin(), ps.end(), [&](auto &p, auto &q) {
            return atan2(p.second, p.first) < atan2(q.second, q.first);
        });
    n = ps.size();
    ps.insert(ps.end(), ps.begin(), ps.end());
    long long ans2 = 0;
    for (int i = 0; i < n; i++) {
        long long x = 0, y = 0;
        for (int j = i; j < i+n; j++) {
            x += ps[j].first, y += ps[j].second;
            ans2 = max(ans2, x*x + y*y);
        }
    }
    cout << setprecision(16) << sqrt(ans2) << endl;
}


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

int main(){
    int maxcounter=0;
    int N;
    cin >> N;
    map<string, int> s;
    for (int i =0;i<N;i++){
        string tmp;
        cin >> tmp;
        if(s.count(tmp)){
            s[tmp]++;
            maxcounter=max(maxcounter,s[tmp]);
        }else{
            s[tmp]=0;
        }
    }
    vector<string> res;
    for (auto x:s){
        if(x.second==maxcounter){
            res.push_back(x.first);
        }
    }
    sort(res.begin(),res.end());

    for (string x:res){
        cout << x << endl;
    }
}

Measured memory_bytes: 26868
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const int INF = 1000000000; // 10^9
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    string N;
    cin >> N;
    int x = N.length()-1;
    if(N[x] == '2' || N[x] == '4' || N[x] == '5' || N[x] == '7' ||
       N[x] == '9') {
        cout << "hon" << endl;
    } else if(N[x] == '0' || N[x] == '1' || N[x] == '6' || N[x] == '8') {
        cout << "pon" << endl;
    } else {
        cout << "bon" << endl;
    }
}


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

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

    vector<string> w(n);

    cin >> w[0];
    for (int i = 1; i < n; i++) {
        string wi;
        cin >> wi;
        if (wi[0] != w[i - 1].back() || find(w.begin(), w.end(), wi) != w.end()) {
            cout << "No" << endl;
            return 0;
        }
        w[i] = wi;
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 888
(defn read-int [x]
  (Integer/parseInt x))

(defn read-vec [x]
  (mapv (fn [a] (read-int a)) (clojure.string/split x #" ")))

(defn is-doublet? [[a b]]
  (= a b))

(defn read-lines [lines]
  (loop [line 0
         result []]
    (if (= line lines)
      result
      (recur (inc line) (conj result (read-vec (read-line)))))))

(defn find-doublet-possible [rolls]
  (loop [idx 0
         end (count rolls)
         doublets-cnt 0]
    (if (or (= idx end) (= doublets-cnt 3))
      doublets-cnt
      (if (is-doublet? (nth rolls idx))
        (recur (inc idx) end (inc doublets-cnt))
        (recur (inc idx) end 0)))))

(defn main []
  (let [n (read-int (read-line))
        rolls (read-lines n)
        doublets (find-doublet-possible rolls)]
    (if (> doublets 2)
      (println "Yes")
      (println "No"))))

(main)
    

Measured memory_bytes: 86524
#include<bits/stdc++.h>
using namespace std;
#define bolt ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
typedef long long ll;
typedef long double ld;
const ll mod = 100000000000000;
bool isprime(ll n){for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll factorial(ll n){return (n==1 || n==0) ? 1:n*factorial(n-1);}
ll power(ll x,ll y){ll res=1;x=x%mod;while(y>0){if(y&1)res=((res%mod)*(x%mod))%mod;y=y>>1;x=((x%mod)*(x%mod))%mod;}return res;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res=((res%mod)*((n-i)%mod))%mod;res=((res%mod)*(power(i+1,mod-2))%mod)%mod;}return res;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (a/gcd(a,b)*b);}
ll max(ll a,ll b){ll sol=a>b?a:b;return sol;}
ll min(ll a,ll b){ll sol=a<b?a:b;return sol;}
int main()
{
   bolt;
   ll n;
   cin>>n;
   ll k=0;
   while (n!=1)
   {
       n/=2;
       k++;
   }
   cout<<power(2,k+1)-1;
}


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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(i,n)cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int n,m;
vi a;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>n>>m;
    a.resize(n);

    double sum=0;
    REP(i,n){
        cin>>a[i];
        sum += a[i];
    }
    string ans = "No";

    sum = sum/(4*m);
    //DEBUG(sum);
    int cnt=0;
    REP(i,n){
        if(a[i] >= sum) cnt++;
    }
    if(cnt>=m) ans = "Yes";


    cout << ans << endl;
    return 0;
}

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

typedef long long int ll;
typedef vector<int> vi;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define pvec(v) for(auto e: v) cout << e << " ";
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i, a, b) for(int i = (a); i<(b); ++i)
#define pb push_back
#define INF 10000000000000005
#define MOD 1000000007
#define all(v) v.begin(), v.end()

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

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

ll dp[3005][3005][4];
int r, c, k;

bool valid(int x, int y) {
	if(x < 0 || y < 0 || x >=r || y >=c) 	
		return false;
	return true;
}

int main(){
	// IO

	cin >> r >> c >> k;

	ll arr[r][c];

	memset(arr, 0LL, sizeof(arr));

	int x, y;
	ll v;
	bool p = false;
	for(int i = 0; i < k; ++i) {
		cin >> x >> y >> v;
		--x; --y;
		if(x == 0 && y == 0) {
			p = true;
		}
		arr[x][y] = v;
	}

	for(int i = 0; i<r; ++i) {
		for(int j = 0; j<c; ++j) {
			for(int k = 0; k<4; ++k) {
				dp[i][j][k] = -INF;
			}
		}
	}

	dp[0][0][0] = 0;

	for(int i = 0; i<r; ++i) {
		for(int j = 0; j<c; ++j) {
			if(arr[i][j]) {
				for(int k = 2; k>=0; --k) {
					dp[i][j][k + 1] = max(dp[i][j][k + 1], dp[i][j][k] + arr[i][j]);
				}
			}

			for(int k = 0; k<4; ++k) {
				dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][k]);
				dp[i][j + 1][k] = max(dp[i][j + 1][k], dp[i][j][k]);
			}
		}
	}

	ll mx = 0;
	for(int i = 0; i<4; ++i) {
		mx = max(mx, dp[r - 1][c - 1][i]);
	}

	cout << mx << endl;

	return 0;
}

Measured memory_bytes: 355616
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <map>      // map
#include <math.h>
#include <numeric>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
const int INF = 1001001001;
const int BG = 1000000007;

int main()
{
    int a, b;
    cin >> a >> b;
    if ((a + b) % 2 == 0)
    {
        cout << (a + b) / 2 << endl;
    }
    else
    {
        cout << ((a + b) / 2) + 1 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define D(x) cout << #x << "=" << x << " "
#define E puts("")
using namespace std;
typedef long long LL;
inline int getint() {
	int a = 0, f = 1; char c = getchar();
	while (c > '9' || c < '0') { if (c == '-') f = -1; c = getchar();}
	while (c <= '9' && c >= '0') { a = a * 10 + c - '0'; c = getchar();}
	return a * f;
}

const int MAXN = 1000 + 3;
struct name{
	int val, num;
	double temp;
	bool operator < (const name &rhs) const {
		return temp < rhs.temp;
	}
}H[MAXN];

int main(int argc, char const *argv[]) {
	//freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
	int N = getint(), T = getint(), A = getint();
	for (int i = 1; i <= N; i++) {
		H[i].val = getint(); H[i].num = i;
		H[i].temp = T - 0.006 * H[i].val;
	}
	sort(H + 1, H + 1 + N);
	name M;
	M.temp = A;
	int p = lower_bound(H + 1, H + 1 + N, M) - H;
	int ans; double mn = 200000000;
	for (int i = p - 2; i <= p + 2 && i <= N; i++) {
		if (fabs(H[i].temp - A) < mn) {
			mn = fabs(H[i].temp - A);
			ans = H[i].num;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
/*Author: Gautam*/


#include<bits/stdc++.h>
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
#define MOD 1000000007
#define INF 1e10
#define ull unsigned long long int

/* TYPE DEFINITIONS */
typedef		long long int	ll;
typedef		vector<ll>		vi;
typedef		pair<ll,ll>	    pi;



/* Prime Checker!!! */
bool isPrime(ull n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ull i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 

/* MACROS */

#define  all(A)			(A).begin() , (A).end()
#define  rall(A)		(A).rbegin() , (A).rend()
#define  sz(A)			(int)(A).size()
#define  pb				push_back
#define  ppb			pop_back
#define  mp				make_pair
#define  ln(X)			(int)(X).length()
#define  square(X)		((X)*(X))
#define  cube(X)		((X)*(X)*(X))
#define  forn(i, n)  for (int i = 0; i < int(n); i++)
#define  forr(i, n)  for (int i = int(n - 1); i >= 0; i--)
#define  fora(i, a, b)  for (int i = int(a); i <= int(b); i++)
#define  forb(i, a, b)  for (int i = int(a); i >= int(b); i--)
#define  fore(it, a)	for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++) 
void solve()
{
    
    ll a,b;
    cin>>a>>b;
    cout<<max(a+b,max(a-b,a*b));
}   


int main()
{
	FastIO;
	ll t=1;
    //cin>>t;
    //double start_time = clock();
	while(t--)
    {
        solve();
    }
    //double end_time = clock();
   // printf( "\nTime = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);
}

Measured memory_bytes: 256
import java.util.*
import java.math.*
import java.lang.Math.*

private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = { readLine()!!.toInt() }
private val readLong: ()->Long = { readLine()!!.toLong() }
private val readListInt: ()->List<Int> = { readLine()!!.split(' ').map(String::toInt) }
private val readListLong: ()->List<Long> = { readLine()!!.split(' ').map(String::toLong) }
private val errPrintln: (String)->Unit = { msg -> System.err.println(msg) }
private val MOD = 1e9.toLong()+7
private val INF = Int.MAX_VALUE/2
private val LINF = Long.MAX_VALUE/2


fun solveD(H: Int, W: Int, G: List<String>): Int {
    val que = LinkedList<Pair<Int, Int>>()
    que.addLast(Pair(0,0))
    val dx = intArrayOf(0,1,0,-1)
    val dy = intArrayOf(1,0,-1,0)
    val step = Array(H){Array<Int>(W){INF}}
    step[0][0] = 0
    while(que.isNotEmpty()) {
        val (x, y) = que.removeFirst()

        for (i in dx.indices) {
            val nx = x + dx[i]; val ny = y + dy[i]
            if (nx<0 || H<=nx || ny<0 || W<=ny) {
                continue
            }
            if (G[nx][ny] == '#') {
                continue
            }

            assert(G[nx][ny] == '.'){"(nx,ny) is white"}

            if (step[nx][ny] == INF) {
                que.addLast(Pair(nx,ny))
            }
            if (step[x][y] + 1 < step[nx][ny]) {
                step[nx][ny] = step[x][y] + 1
            }
        }
    }

    if (step[H-1][W-1] == INF) {
        return -1
    }

    val white = G.map{it.toCharArray().toList()}.flatten().count{it == '.'}

    val path = step[H-1][W-1] + 1

    return white - path
}


fun main(args: Array<String>) {
    val (H, W) = readListInt()

    val S = Array<String>(H){""}
    for (i in 0 until H) {
        S[i] = readString()
    }

    val ans = solveD(H, W, S.toList())

    println(ans)
}


Measured memory_bytes: 38328
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        for (int i=0;i<S.length();i++) {
            if (i%2==0) {
                if (S.charAt(i)=='L') {
                    System.out.println("No");
                    break;
                }
            } else {
                if (S.charAt(i)=='R') {
                    System.out.println("No");
                    break;
                }
            }
            if (i==S.length()-1) {
                System.out.println("Yes");
                break;
            }
        }
    }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
const int N=6060;
int f[N][N*2],mod,n,m,ans;
int main(){
	scanf("%d%d",&n,&mod);m=n;n*=3;f[n][N]=1;
	for(int i=n;i;i--){
		for(int j=-(n-i);j<=(n-i);j++){
			int x=max(-j,0),y=max(j,0);
			int z=i-x*2-y;
			if(i>=3){
				if(z>0)f[i-3][j+N]=(f[i-3][j+N]+1ll*f[i][j+N]*(i-1)%mod*(i-2))%mod;
				else if(x>=2)f[i-3][j+3+N]=(f[i-3][j+3+N]+1ll*f[i][j+N]*(i-1)%mod*(i-2))%mod;
			}
			if(i>=2)f[i-2][j+1+N]=(f[i-2][j+1+N]+1ll*f[i][j+N]*(i-1))%mod;
			f[i-1][j-1+N]=(f[i-1][j-1+N]+f[i][j+N])%mod;
		}
	}
	for(int i=-n;i<=0;i++)if(i%3==0)(ans+=f[0][i+N])%=mod;
	cout<<ans;
	return 0;
}

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

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

const int maxn=2e5+5;
int a[maxn];

map <int,int> mp;

int main()
{


    //High Speed cin
    cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;

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

    ll count = 0;

    rep(i,n){
        count += mp[i-a[i]];
        mp[i+a[i]]++;
    }

    cout << count << '\n';

}


Measured memory_bytes: 21440
def factorize2(n):
    """
    nの値を素因数分解し、素因数とその指数をtupleにまとめたリストを返す
    e.g.
    >>> factorize(20)
    [(2, 2), (5, 1)]
    """
    b = 2
    fct = []
    while b == 2:
        cnt = 0
        while n % b == 0:
            cnt += 1
            n //= b
        if cnt > 0:
            fct.append((b, cnt))
        b += 1
    if n > 1:
        fct.append((n, 1))
    return fct


N = int(input())
A = list(map(int, input().split()))

cnt = 0
for a in A:
    res = factorize2(a)
    if len(res) > 0:
        fct, num = res[0]
        if fct == 2:
            cnt += num
print(cnt)

Measured memory_bytes: 4148
#include<bits/stdc++.h>
#define pb push_back
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<double,double> PAIR;
const int N = 2e3+5;
const int INF = 0x3f3f3f3f;

int ans[N];

int main(){
	int n,x,y;
	cin >> n >> x >> y;
	
	for(int i = 1;i <= n;++i){
		for(int j = i+1;j <= n;++j){
			int len = min(j-i,abs(x-i)+abs(y-j)+1);
			//printf("%d %d %d %d %d\n",i,j,j-i,x-i+y-j+1,len);
			ans[len]++;
		}
	}
	
	for(int i = 1;i < n;++i) printf("%d\n",ans[i]);
    return 0;
}


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

#define INF 1e9
#define PI 3.141592653589793238
#define N 1000000010
#define mod 1000000007
#define REP(inc, bgn, end) for(int inc=bgn; inc<end; inc++)
typedef long long ll;

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

    if(A==1)cout<<0<<endl;
    else cout<<1<<endl;

    return 0;
}

Measured memory_bytes: 3628
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

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

	final long MOD = 998244353;
	long[] fac = new long[300001];
	long[] ifac = new long[300001];
	long[] inv = new long[300001];
	{
		fac[0] = fac[1] = ifac[0] = ifac[1] = 1;
		inv[0] = inv[1] = 1;
		for (int i = 2; i < fac.length; ++i) {
			fac[i] = fac[i - 1] * i % MOD;
		}
		for (int i = 2; i < inv.length; ++i) {
			inv[i] = MOD - (MOD / i) * inv[(int) (MOD % i)] % MOD;
		}
		for (int i = 2; i < inv.length; ++i) {
			ifac[i] = ifac[i - 1] * inv[i] % MOD;
		}
	}

	void run() throws FileNotFoundException {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		long K = sc.nextLong();
		if (K == 0) {
			System.out.println(1);
			return;
		}
		if (gcd(gcd(B, K), gcd(A, K)) != 1) {
			long g = gcd(gcd(B, K), gcd(A, K));
			A /= g;
			B /= g;
			K /= g;
		}
		if (gcd(A, B) != 1) {
			System.out.println(0);
			return;
		}
		if (gcd(K, B) != 1) {
			A ^= B;
			B ^= A;
			A ^= B;
		}
		solve(N, A, B, K);
	}

	void solve(int N, long A, long B, long K) {
		long ans = 0;
		int a = (int) ((K % B) * inv(A % B, B) % B);
		int b = (int) ((K - a * A) / B);
		for (; a <= N && b >= 0; a += B, b -= A) {
			if (b > N)
				continue;
			ans = (ans + comb(N, a) * comb(N, b) % MOD) % MOD;
		}
		System.out.println(ans);
	}

	long comb(int n, int k) {
		return fac[n] * ifac[k] % MOD * ifac[n - k] % MOD;
	}

	// long inv(long a, long mod) {
	// a = a % mod;
	// long u = 1;
	// // return pow(a, mod - 2, mod);
	// }
	public static long inv(long a, long mod) {
		long b = mod;
		long p = 1, q = 0;
		while (b > 0) {
			long c = a / b;
			long d;
			d = a;
			a = b;
			b = d % b;
			d = p;
			p = q;
			q = d - c * q;
		}
		return p < 0 ? p + mod : p;
	}

	long pow(long a, long n, long mod) {
		long ret = 1;
		for (; n > 0; n >>= 1, a = a * a % mod) {
			if (n % 2 == 1)
				ret = ret * a % mod;
		}
		return ret;
	}

	long gcd(long a, long b) {
		if (a > b) {
			a ^= b;
			b ^= a;
			a ^= b;
		}
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


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

int main() {
    // 入力の受け取り
    int n;
    cin >> n;

    vector<int> A(n);
    for (int i=0; i<n; i++) {
        cin >> A.at(i);
    }

    // 演算の実行
    double numerator=0, denominator=1;

    // 分子の計算
    for (int i=0; i<n; i++) {
        denominator *= A.at(i);
    }

    // 分母の計算
    for (int i=0; i<n; i++) {
        numerator += denominator / A.at(i);
    }

    // 答えを出力
    cout << denominator / numerator << endl;
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll n, ai = 0, aj = 0, a[100001];
  cin >> n;
  rep(i, n) cin >> a[i];
  sort(a, a + n);
  ai = a[n - 1];
  ll med = ai / 2;
  aj = a[0];
  rep(i, n - 1) {
  if (abs(med - a[i]) >= abs(med - a[i + 1]) && ai > a[i + 1]) aj = a[i + 1];
  }
  cout << ai << " " << aj << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream> 
#include <stdlib.h> 
#include <string.h> 
using namespace std;
int main() {
    string x; 
    cin >> x;
    for (int j = 97; j <= 122; j++) {
        bool a = 0;
        for (int i = 0; i < x.size(); i++) {
            if (char(j) == x[i]) {
                a = 1;
                continue;
            }
        }
        if (a == 0) {
            cout << char(j);
            return 0;
        }
    }
    cout << "None";
    return 0;
}

Measured memory_bytes: 3724
n = int(input())
s = input()
color = {"R":0, "G":0, "B":0}
for i in range(n):
    color[s[i]] += 1
temp = color["R"] * color["G"] * color["B"]
count = 0
for i in range((n - 1) // 2):
    for j in range(n - (i + 1) * 2):
        if s[j] != s[j + i + 1] and s[j] != s[j + i * 2 + 2] and s[j + i + 1] != s[j + i * 2 + 2]:
            count += 1
print(temp - count)

Measured memory_bytes: 9212
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int total = 0;

		for (int i = 1; i <= n; i++) {
			int t = 0;
			int sum = 0;
			int c = i;
			while (c != 0) {
				t = c % 10;
				sum += t;
				c /= 10;
			}

			if(sum >= a && sum <= b) {
				total+=i;
			}

		}

		System.out.println(total);
	}

}

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

int main(){
    int a,b,c;

    cin >> a >> b >> c;

    if(a < b) swap(a,b);
    if(a < c) swap(a,c);
    if(b < c) swap(b,c);

    int ans = 0;

    for(int i = 0; i < 1000; ++i){
        if(b < a){
            b += 2;
            ans++;
        }

        if(c < a){
            c += 2;
            ans++;
        }

        if(a <= b && a <= c) break;
    }

    if(a == b){
        if(a == c){
            cout << ans << endl;
        }else{
            cout << ans + 1 << endl;
        }
    }else if(a == c){
        cout << ans + 1 << endl;
    }else{
        cout << ans - 1 << endl;
    }
    
}

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

//隣接行列to[]
vector<int> to[100005];
const int INF =1001001001;

int main(){
    int n,m;
    cin >> n >> m;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        --a; --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    //一時的に
    queue<int> q;
    //distはBFS木の層を保持する配列
    vector<int> dist(n, INF);
    //preはBFS木の親を保持する配列
    vector<int> pre(n,-1);
    dist[0]=0;
    q.push(0);

    while(!q.empty()){
        //qの先頭要素をvに代入  qの要素をpopして消去
        int v=q.front(); q.pop();
        //隣接行列to[]をひとつずつ見ていく
        for(int u : to[v]){
            //dist[u]!=INFが真ならすでにチェック済みなのでcontinue
            if(dist[u]!=INF) continue;
            //階層を+１して更新
            dist[u]=dist[v]+1;
            //どの洞窟から来たかを記録
            pre[u]=v;
            //uと接続している次にみる洞窟をqにpusu
            q.push(u);
        }
    }

    cout << "Yes" << endl;
    rep(i,n){
        if(i==0) continue;
        int ans = pre[i];
        ++ans;
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define inn(x, y) int x,y;cin>>x>>y
#define innn(x, y, z) int x,y,z;cin>>x>>y>>z
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)
#define reppp(j, i, n) for (int j=i+1; j<n; j++)

#define lim5 100002
#define lim9 1000000002

#define deg(rad) (((rad)/2/M_PI)*360)
#define mid(min, max) ((min + max) / 2)

int main() {
	innn(h, w, n);
	int x = (h > w ? h : w), y = (h > w ? w : h);
	int xc = 0, yc = 0;

	out(n / x + (n % x ? 1 : 0));
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main
{
    static class Pair{
        int l, r;
        public Pair(int l, int r){
            this.l = l;
            this.r = r;
        }
    }

    public static void process(int test_number)throws IOException
    {
        int n = ni(), k = ni(), l, r;
        Pair arr[] = new Pair[k];

        for(int i = 1; i <= k; i++){
            l = ni(); r = ni();
            arr[i - 1] = new Pair(l, r);
        }

        long dp[] = new long[n + 1], pref[] = new long[n + 1];
        dp[1] = 1l; pref[1] = 1l;

        for(int i = 2; i <= n; i++){
            
            for(int j = 0; j < k; j++){
                r = i - arr[j].l;
                l = i - arr[j].r;

                if(r >= 1){
                    l = Math.max(1, l);
                    dp[i] = (dp[i] + (pref[r] - pref[l - 1] + mod)% mod)% mod;
                }
            } 

            pref[i] = (pref[i - 1] + dp[i]) % mod; 
        }

        pn(dp[n]);
    }
 
    static final long mod = 998244353l;
    
    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc = new FastReader();
 
        long s = System.currentTimeMillis();
        int t = 1;
        //t = ni();
        for(int i = 1; i <= t; i++)
            process(i);
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }

    static void trace(Object... o){ System.err.println(Arrays.deepToString(o)); };
    static void pn(Object o){ out.println(o); }
    static void p(Object o){ out.print(o); }
    static int ni()throws IOException{ return Integer.parseInt(sc.next()); }
    static long nl()throws IOException{ return Long.parseLong(sc.next()); }
    static double nd()throws IOException{ return Double.parseDouble(sc.next()); }
    static String nln()throws IOException{ return sc.nextLine(); }
    static long gcd(long a, long b)throws IOException{ return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{ return (b==0)?a:gcd(b,a%b); }
    static int bit(long n)throws IOException{ return (n==0)?0:(1+bit(n&(n-1))); }
    
    static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } 
}


Measured memory_bytes: 40240
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll h;
    cin >> h;
    ll num = 1;
    ll count = 0;
    while (h > 0) {
        count += num;
        num *= 2;
        h /= 2;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,b=0;
    cin>>n;
    int t[100];
    for(int i=0;i<n;i++) {cin>>t[i]; b+=t[i];}
    int m;
    cin>>m;
    int p[100],x[100];
    for(int i=0;i<m;i++) {cin>>p[i]>>x[i]; cout<<b-t[p[i]-1]+x[i]<<endl;}
  return 0;
}


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

const ll INF = 1LL << 60;

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

    ll n;
    cin >> n;

    if (n == 1){
        cout << 0 << endl;
    }
    else if (n <= 10){
        ll ans = pow(10,n) - 2*pow(9,n) + pow(8,n);
        cout << ans << endl;
    }
    else{
        ll t = 1;
        ll w = 1;
        ll e = 1;
        for (ll i = 0; i < n; i++){
            t *= 10;
            t %= 1000000007;
        }
        for (ll i = 0; i < n; i++){
            w *= 9;
            w %= 1000000007;
        }
        for (ll i = 0; i < n; i++){
            e *= 8;
            e %= 1000000007;
        }

        ll ans = t - 2*w + e;
        ans %= 1000000007;

        if (ans < 0){
            ans += 1000000007;
        }

        cout << ans << endl;
    }

        

}

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

#define HOUSE_NUM 4
#define FLOOR_NUM 3
#define ROOM_NUM 10 
#define INPUT_NUM 4

/*
typedef struct{
	int room_num[10];
	int people_num[10];
}residence;
*/

void print(int residence[][ROOM_NUM]){
	int i,j;
	
	for(i=0 ; i < FLOOR_NUM ; i++){
		printf(" ");
		for(j=0 ; j < ROOM_NUM ; j++){
			printf("%d", residence[i][j]);
			if(j == ROOM_NUM -1){
				printf("\n");
			}
			else{
				printf(" ");
			}
		}
	}
}

int main(void){
	int i,j;
	int data_num;
	int residence_1[FLOOR_NUM][ROOM_NUM] = {0};
	int residence_2[FLOOR_NUM][ROOM_NUM] = {0};
	int residence_3[FLOOR_NUM][ROOM_NUM] = {0};
	int residence_4[FLOOR_NUM][ROOM_NUM] = {0};

	int data[INPUT_NUM];

	scanf("%d", &data_num);
	for(j=0 ; j < data_num ; j++){
		for(i=0  ; i < INPUT_NUM ; i++){
			scanf("%d", &data[i]);   //?£????????????¨?±???????????????°
		}
		
		if( data[0] == 1 ){
			residence_1[data[1]-1][data[2]-1] += data[3];
		}
		else if( data[0] == 2){
			residence_2[data[1]-1][data[2]-1] += data[3];
		}
		else if( data[0] == 3){
			residence_3[data[1]-1][data[2]-1] += data[3];
		}
		else{
			residence_4[data[1]-1][data[2]-1] += data[3];					
		}
	}
	
	print(residence_1);
	for(j=0 ; j < 20 ; j++){
		printf("#");
	}
	printf("\n");
	print(residence_2);
	for(j=0 ; j < 20 ; j++){
		printf("#");
	}
	printf("\n");
	print(residence_3);
	for(j=0 ; j < 20 ; j++){
		printf("#");
	}
	printf("\n");
	print(residence_4);
	
	return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int M = scanner.nextInt();
    int[] freq = new int[M];
    for (int i = 0; i < N; i++) {
      int K = scanner.nextInt();
      for (int j = 0; j < K; j++) {
        int a = scanner.nextInt() - 1;
        freq[a]++;
      }
    }
    int tot = 0;
    for (int f : freq) if (f == N) tot++;
    System.out.println(tot);
  }
}


Measured memory_bytes: 22996
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long ll;

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

  int odd = 0;
  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    if(a % 2 == 1)++odd;
  }

  cout << ((odd % 2 == 0) ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 256