akhauriyash/Code-Regression huggingface dataset:
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [[0] * 3 for _ in range(3)]
for _ in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == b:
                B[i][j] = 1

# Row
for i in range(3):
    res = 0
    for j in range(3):
        if B[i][j] == 1:
            res += 1
    if res == 3:
        print('Yes')
        exit()
# Col
for j in range(3):
    res = 0
    for i in range(3):
        if B[i][j] == 1:
            res += 1
    if res == 3:
        print('Yes')
        exit()
# diag 1
res = 0
for k in range(3):
    if B[k][k] == 1:
        res += 1
if res == 3:
    print('Yes')
    exit()
# diag 2
res = 0
if B[0][2] + B[1][1] + B[2][0] == 3:
    print('Yes')
    exit()

print('No')


Measured memory_bytes: 38384
#include<stdio.h>

int main(){
  int w=100;
  int gura[w][w];
  int n,count1,a,count2,i,j;
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      gura[i][j]=0;
    }
  }
  
  for(i=0;i<n;i++){
    scanf("%d %d",&count1,&a);
    count1--;
    for(j=0;j<a;j++){
      scanf("%d",&count2);
      count2--;
      gura[count1][count2]=1;
    }
  }
  
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j) {
	printf(" ");
      }
      printf("%d",gura[i][j]);
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2108
/* author   : mpily :-()
title : Competing.cpp
time :Thu Sep 12 20:14:46 2019

*/
#include<bits/stdc++.h>
using namespace std;
int main(){
	int N;
	cin>>N;
	vector<int>arr(N+1);
	for(int i = 0; i < N; i++){
		int temp;
		cin>>temp;
		arr[temp]=i;
		//cout<<"we have added "<<temp<<" , "<<arr[temp]<<"\n";
	}
	multiset<int> myset;
	long long ans = 0;
	for(int i = N; i > 0; i-- ){
		long long  a, b,c,d;
		myset.insert(arr[i]);
		multiset<int>::iterator it = myset.find(arr[i]);
		if (it == myset.begin()){
			a = -1;b = -1;
		}
		else {
			it--;
			a = *it;
			if(it == myset.begin()) b = -1;
			else {
				it--;
				b = *it;
			}
		}
		it = myset.find(arr[i]);
		it++;
		if (it == myset.end()){
			c = N;d = N;
		}
		else {
			//it++;
			c = *it;
			it++;
			if(it == myset.end()) d = N;
			else {
				//it++;
				d = *it;
			}
		}
		//cout<<"When checking at position "<<i<<" we got "<<a<<" "<<b<<" "<<c<< " "<<d<<"\n";
		ans+=i*(a-b)*(c-arr[i]);
		ans+=i*(arr[i]-a)*(d-c);		
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 5376
#include <iostream>

using namespace std;
using ll = long long;

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

int dp[101][4][4][4];
const int MOD = 1000000007;

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

  dp[0][3][3][3] = 1;

  // ACGT 0123
  for (int len = 0; len < n; ++len) {
    for (int c1 = 0; c1 < 4; ++c1) {
      for (int c2 = 0; c2 < 4; ++c2) {
        for (int c3 = 0; c3 < 4; ++c3) {
          for (int c = 0; c < 4; ++c) {
            if (c == 2 && c1 == 1 && c2 == 0) continue;
            if (c == 2 && c1 == 0 && c2 == 1) continue;
            if (c == 1 && c1 == 2 && c2 == 0) continue;
            if (c == 2 && c1 == 1 && c3 == 0) continue;
            if (c == 2 && c2 == 1 && c3 == 0) continue;

            dp[len + 1][c][c1][c2] += dp[len][c1][c2][c3];
            dp[len + 1][c][c1][c2] %= MOD;
          }
        }
      }
    }
  }

  int ans = 0;
  for (int c1 = 0; c1 < 4; ++c1) {
    for (int c2 = 0; c2 < 4; ++c2) {
      for (int c3 = 0; c3 < 4; ++c3) {
        ans += dp[n][c1][c2][c3];
        ans %= MOD;
      }
    }
  }

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


Measured memory_bytes: 256
# わかりやすい参考 https://atcoder.jp/contests/abc113/submissions/3544286#
H,W,K=map(int,input().split())
MOD=(10**9)+7

def fibonatti(N):
  fibonatti_seq=[1,1]
  for i in range(1,N):
    fibonatti_seq.append(fibonatti_seq[i-1]+fibonatti_seq[i])
  return fibonatti_seq

fibonatti_seq=fibonatti(8)

dp=[[0 for i in range(W+1)] for j in range(H+1)]
dp[0][1]=1

for i in range(H):
  for j in range(1,W+1):
    if j>=2:
      dp[i+1][j-1]+=dp[i][j]*fibonatti_seq[j-2]*fibonatti_seq[W-j]
      dp[i+1][j-1]%=MOD
    if j<=W-1:
      dp[i+1][j+1]+=dp[i][j]*fibonatti_seq[j-1]*fibonatti_seq[W-j-1]
      dp[i+1][j+1]%=MOD
    dp[i+1][j]+=dp[i][j]*fibonatti_seq[j-1]*fibonatti_seq[W-j]
    dp[i+1][j]%=MOD
print(dp[H][K])

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

vector<int> graph[2005];

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

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

    vector<int> ans(n, 0);
    for(int i = 0; i < n - 1; ++i){
        vector<int> dist(n, INF);
        priority_queue<P, vector<P>, greater<P>> que;
        dist[i] = 0;
        que.push(P(0, i));
        while(!que.empty()){
            P p = que.top();
            que.pop();
            int d = p.first, from = p.second;
            if(d > dist[from])  continue;
            for(int to : graph[from]){
                if(dist[to] > d + 1){
                    dist[to] = d + 1;
                    que.push(P(dist[to], to));
                }
            }
        }
        for(int j = i + 1; j < n; ++j){
            ++ans[dist[j]];
        }
    }
    for(int i = 1; i < n; ++i)  cout << ans[i] << "\n";
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	ll ans=0;
	ll b[100];
	for(ll i=0;i<n-1;i++){
		cin>>b[i];
	}
	ans+=b[0]+b[n-2];
	for(ll i=0;i<n-2;i++){
		ans+=min(b[i],b[i+1]);
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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

#define Fast           ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO             freopen("in.txt", "r", stdin)
#define FC             freopen("out.txt", "w", stdout)
#define aise           cout<<"aise"<<endl
#define pb             push_back
#define pf             push_front
#define ppb            pop_back
#define ppf            pop_front
#define mp             make_pair
#define ll             long long
#define all(x)         x.begin(), x.end()
#define mset(v, a)     memset(v, a, sizeof(v))
#define pll            pair< ll, ll >
#define pd             pair< double, double >
#define ff             first
#define ss             second
#define pi             acos(-1.0)
#define mxN            2010
#define inf            1e14
#define mod            1000000007
#define tc             ll tc;scanf("%lld",&tc);while(tc--)

//NCR iterative
/*voidcomb_table(intN)
{
    for(inti=0; i<=N; ++i)
    {
        for(intj=0; j<=i; ++j)
        {
            if(j==0or j==i)
            {
                C[i][j]=1LL;
            }
            else
            {
                C[i][j]=(C[i-1][j-1]+C[i-1][j]);
            }
        }
    }
}*/


//NCR recursive
/*ll dp[55][55];

ll NCR(ll n,ll r)
{

    if(n==r)
        return dp[n][r]=1;
    if(r==0)
        return dp[n][r]= 1;
    if(r==1)
        return dp[n][r]=n ;
    if(dp[n][r] != -1)
        return dp[n][r];
    return dp[n][r] = NCR(n-1,r)+NCR(n-1,r-1);
}*/

//Sieve:
/*bool Flag[1000010];
vector<ll> Prime;

void sieve()
{

    ll val=sqrt(1000010);
    for(ll i=4;i<=1000005; i+=2) Flag[i]=1;
    for(ll i=3;i <= val;i+=2)
    {

        if(Flag[i]==0)
        {

            for(ll j=i*i;j<=1000005;j+=i) Flag[j]=1;
        }
    }
    Flag[1]=1;
    for(ll i=1;i<=1000000;i++)
        if(Flag[i]==0) Prime.pb(i);
}*/


//Conversion
/*string bin(ll x)
{

    string ret;
    while(x)
    {

        ll t=x%2;
        char c;
        if(t==1)
            c='1';
        else
            c='0';
        ret.pb(c);
        x/=2;
    }
    reverse(all(ret));
    return ret;
}*/

/*ll lcm(ll x, ll y)
{

    ll ret=__gcd(x,y);
    return (x*y)/ret;
}*/

/*ll dx[]= {0,0,1,-1};
ll dy[]= {1,-1,0,0};*/

int main()
{

    ll n;
    cin >> n;
    vector<ll> a(n,0),b(n-1,0);
    for(ll i=0;i<n-1;i++) cin >> b[i];
    a[0]=b[0];
    a[1]=b[0];
    for(ll i=1;i<n-1;i++)
    {

        if(a[i] > b[i]) a[i]=b[i];
        a[i+1]=b[i];
    }
    ll ans=0;
    for(ll i=0;i<n;i++) ans+=a[i];
    cout << ans;
}


Measured memory_bytes: 3604
#include<iostream>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<cmath>
#include<string>
#include<string.h>
#include<iomanip>
#include<stdlib.h>
#include<algorithm>
typedef long long ll;
using namespace std;

int main()
{
	string s[105];
	int h,w;
	cin >> h >> w;
	
	for(int i = 0;i < h;i++)
	{
		cin >> s[i];
	}
	
	for(int i = 1;i <= w+2;i++)
		cout << "#";
	cout << endl;
	
	for(int i = 0;i < h;i++)
	{
		cout << "#";
		cout << s[i];
		cout << "#" << endl;
	}
	
	for(int i = 1;i <= w+2;i++)
		cout << "#";
	cout << endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

Measured memory_bytes: 256
'use strict'

const main = (INPUT) => {
  const S = INPUT.split('\n')[0]
  let ans = 'Good'
  for (let i = 1; i < S.length; i++) {
    if (S[i] == S[i - 1]) {
      ans = 'Bad'
    }
  }
  console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 22076
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
const long long INF = 1LL << 60;

// --------write my code!!!!!----------//

int main(){
    int H,W,h,w; cin>>H>>W>>h>>w;
    cout << (H-h)*(W-w) << endl;
}


Measured memory_bytes: 256
A,B,C,X,Y=map(int,input().split())
ans=5000*(10**5)*2+1

for i in range(max(X,Y)+1):
  total=0
  total=2*C*i+A*max(X-i,0)+B*max(Y-i,0)
  if ans>=total:
    ans=total
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <cmath>
#define rad(r) (r * M_PI / 180)
int main() {
	int a, b, C;
	scanf("%d %d %d", &a, &b, &C);
	printf("%f\n", a*b*sin(rad(C))/2);
	printf("%f\n", a+b+sqrt(a*a+b*b-2*a*b*cos(rad(C))));
	printf("%f\n", b*sin(rad(C)));
}

Measured memory_bytes: 1112
#include <bits/stdc++.h>
#define maxn 233
using namespace std;
char G[maxn][maxn];
int d[maxn][maxn];
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
int main() {
	int n, m, ans = 0;
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i) scanf("%s", G[i] + 1);
	for(int i = 1; i <= n; ++i) 
		for(int j = 1; j <= m; ++j) 
			if(G[i][j] == '.') ++ans;
	queue<int> Qx, Qy;
	memset(d, -1, sizeof d);
	d[1][1] = 0;
	Qx.push(1), Qy.push(1);
	while(!Qx.empty() && !Qy.empty()) {
		int x = Qx.front(), y = Qy.front();
		Qx.pop(), Qy.pop();
		for(int k = 0; k < 4; ++k) {
			int nx = x + dx[k], ny = y + dy[k];
			if(nx && nx <= n && ny && ny <= m && d[nx][ny] == -1 && G[nx][ny] == '.') d[nx][ny] = d[x][y] + 1, Qx.push(nx), Qy.push(ny);
		}
	} 
	printf("%d\n", d[n][m] == -1 ? -1 : ans - d[n][m] - 1);
	return 0;
}

Measured memory_bytes: 4004
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

int query(int u, int v){
	if(u == v){ return 0; }
	cout << "? " << u << " " << v << endl;
	int x;
	cin >> x;
	return x;
}

int main(){
	int n, s, t;
	cin >> n >> s >> t;
	vector<int> ds(n + 1), dt(n + 1);
	for(int i = 1; i <= n; ++i){
		ds[i] = query(s, i);
		dt[i] = query(i, t);
	}
	vector<pair<int,int>> cands;
	for(int i = 1; i <= n; ++i){
		if(i != s && ds[i] + dt[i] == ds[t]){
			cands.emplace_back(ds[i], i);
		}
	}
	sort(cands.begin(), cands.end());
	vector<int> ans;
	ans.push_back(s);
	for(auto c : cands){
		int u = ans.back();
		int v = c.second;
		int d = query(u, v);
		if(ds[u] + d == ds[v]){
			ans.push_back(v);
		}
	}
	cout << "!";
	for(int x : ans){
		cout << " " << x;
	}
	cout << endl;
}



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

typedef long long ll;
typedef long double ld;
#define int ll
//#define endl '\n'

// use unique(x) - removec consecutive items, returns vec.begin() + number of items
// for vector: sort(all(vec)); vec.erase(unique(all(vec)), vec.end());
// use iota(all(vec), 0) for filling a vector with 0,1,2...
// use fill(all(vec), 1) for filling a vector with 1,1,1...
// use rotate(vec.begin(), vec.begin() + 1, vec.end()) to rotate a vector | middle arg becomes first
// print number in binary -> cout << bitset<20>(n);

int n;
const int N=100100,mod=1e9+7;
vector<int>g[N];
int dp[N][2]; // white, black

main(){
	cin.tie(0);cin.sync_with_stdio(0);
	cin>>n;
	for(int i=0;i<n-1;++i){
		int u,v;cin>>u>>v;--u;--v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	memset(dp,-1,sizeof(dp));
	function<int(int,int,int)> dfs=[&](int u,int c,int p){
		if(~dp[u][c])return dp[u][c];
		dp[u][c]=1;
		for(auto v:g[u])if(v!=p){
			ll dm=dfs(v,0,u)%mod;
			if(!c)dm=(dm+dfs(v,1,u))%mod;
			dp[u][c]=dp[u][c]*dm%mod;
		}
		return dp[u][c];
	};
	cout<<(dfs(0,0,0)+dfs(0,1,0))%mod<<endl;
}


Measured memory_bytes: 25844
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;

using namespace std;


signed main() {
  int N, K;
  cin >> N >> K;

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  vector<int> sum(N+1);
  REP(i, N) sum[i+1] = (sum[i]+A[i]-1+K)%K;

  int ans = 0;
  map<int, int> m;
  REP(i, N+1){
    if(i-K >= 0) m[sum[i-K]]--;
    ans += m[sum[i]];
    m[sum[i]]++;
  }

  cout << ans << endl;

  return 0;
}

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

long long n;
vector<long long> s;

long long solve();

int main(){
    cin >> n;
    s.resize(n);
    for(int i = 0;i < n;++i)cin >> s[i];
    cout << solve() << endl;
    return 0;
}

long long solve(){
    long long ans = 0;
    for(int i = 1;i < n;++i){
        long long nowx = 0,nowy = n -1,nowc = 0;
        while(i < nowy){
            nowc += s[nowx] + s[nowy];
            ans = max(ans,nowc);
            nowx += i;
            nowy -= i;
            if(nowy % i == 0 && nowx >= nowy)break;
        }
    }
    return ans;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア　タイプでふ

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a + b == c + d)
    {
        cout << "Balanced";
    }
    else if (a + b > c + d)
    {
        cout << "Left";
    }
    else
    {
        cout << "Right";
    }
}

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

using namespace std;
#define int long long
const int N = 1e6 + 10, MOD = 1e9 + 7;
int A[10][10];

int first_dig(int x) {return x%10;}
int last_dig(int x) {
    while (x >= 10) x/=10;
    return x;
}

int32_t main()
{
    int n, ans = 0; cin >> n;
    for (int i = 1; i <= n; i++) {
        int F = first_dig(i), L = last_dig(i);
        ans += A[F][L]*2;
        A[L][F]++;
        if (F == L) ans++;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  long double n;
  cin >> n;
  int nn=n;
  if(nn%2==0){
    cout << 0.5 << endl;
  }
  else{
    cout << fixed << setprecision(12) << ceil(n/2)/n << endl;
  }

  
  return 0;
    

}


Measured memory_bytes: 256
s = list(input())
ans = []
for i in s:
    if i == "1":
        ans.append(1)
    elif i == "0":
        ans.append(0)
    else:
        if len(ans) == 0:
            continue
        else:
            del ans[-1]
for i in ans:
    print(i,end = "")

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

int main() {
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    int a[101];
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    sort(a, a + n, greater<>());
    int A = 0, B = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2) B += a[i];
        else A += a[i];
    }
    cout << A - B << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int k,x;
	cin>>k>>x;//已经知道有k块儿黑色板，一块x是
	if(k==1){
		cout<<x<<endl;
	}else{
		//现输出左边
		for(int i=x-k+1;i<x;i++){
			cout<<i<<" ";
		} 
		cout<<x<<" ";
		//输出右边
		for(int i=x+1;i<x+k;i++){
			cout<<i<<" ";
		} 
		cout<<endl;
	}
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A, B, C;
  cin >> A >> B >> C;
  if (A == B){
    cout << C << endl;
  }
  else if (A == C){
    cout << B << endl;
  }
  else{
    cout << A << endl;
  }
  return 0;
}

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

using namespace std;

long long N;

void dfs(long long cur, int use, long long & count) {
	if (cur > N) return;
	if (use == 0b111) count++;

	dfs(cur * 10 + 7, use | 0b100, count);
	dfs(cur * 10 + 5, use | 0b010, count);
	dfs(cur * 10 + 3, use | 0b001, count);

}

int main(void) {
	cin >> N;
	long long res = 0;
	dfs(0, 0, res);
	cout << res << endl;
	
}

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

typedef long long ll;

const int N = 1000 * 1000 + 20;
ll n, m, a[N], sum;

int main() {
	cin >> n >> m;
    for (int i = 0; i < m; i++)
		cin >> a[i];
    for (int i = 0; i < m; i++)
		sum += a[i];
    cout << (sum <= n? n - sum: -1) << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	string s; cin >> s;
	string ans = "";
	for(int i = 0; i < 4; i++)
	{
		ans += s[i];
	}
	ans += " ";
	for(int i = 4; i < 12; i++)
	{
		ans += s[i];
	}
	cout << ans << '\n';
}


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

#pragma region Macros
using ll = long long;
#define int ll
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
#define IOS\
    ios::sync_with_stdio(false);\
    cin.tie(0);\
    cout.tie(0);
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SORT(name) sort(name.begin(), name.end())
#define RSORT(name)\
    SORT(name);\
    reverse(all(name));
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
template <class T> inline void print(T x){ cout << x << '\n';}
template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
#pragma endregion

#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const int MOD = 1000000007;
const int MAX_N = 100010;

signed main() {
    IOS;

    int N, X, T;
    cin >> N >> X >> T;

    if(N % X == 0) {
        print(N / X * T);
    }
    else {
        print(N / X * T + T);
    }

    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#pragma region Macros
typedef long long ll;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};
#define LOCAL

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    cout << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}
#pragma endregion

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<ll> cnt(N+1,0);
    for (int i=1;i<=N;++i){
        for (int j=i;j<=N;j+=i){
            ++cnt[j];
        }
    }
    ll ans=0;
    for (int i=1;i<=N;++i) ans+=cnt[i]*i;
    cout << ans << '\n';
}

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


int main(){
  
  int n,m;
  cin >> n>>m;
  int a[m+1];
  bool flg=0;
  for(int i=0; i<m; i++){
    cin>>a[i];
    if(i) if(a[i]-1==a[i-1]) flg=1;
  }
  a[m]=-1;
  int i=0,j=0;
  long long dp[n+1];
  while(i<=n){
  	if(i==0) dp[i]=1;
    else if(i==1&&a[j]!=1) dp[i]=1;
    else if(i==1&&a[j]==1){ dp[i]=0,j++;}
 
    else if(i>1&&(a[j]==i)) {dp[i]=0,j++;}
    else if(i>1&&a[j]!=i) dp[i]=dp[i-1]+dp[i-2];
    dp[i]%=1000000007;
    i++;
  }
  
  if(flg) cout << 0 << endl;
  else cout << dp[n] << endl;
  
}

Measured memory_bytes: 1408
n,m = map(int,input().split())
a = []
b = []
for i in range(n):
    a_i, b_i = map(int,input().split())
    a.append(a_i)
    b.append(b_i)
c = []
d = []
for i in range(m):
    c_i, d_i = map(int,input().split())
    c.append(c_i)
    d.append(d_i)

for i in range(n):
    z = 1
    l = abs(a[i] - c[0]) + abs(b[i] - d[0])
    for j in range(1,m):
        if abs(a[i] - c[j]) + abs(b[i] - d[j]) < l:
            z = j+1
            l = abs(a[i] - c[j]) + abs(b[i] - d[j])
    print(z)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF 1844674407370955161
typedef long long unsigned int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a * b / g;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}



int main()
{

  int n, m;
  long long xans=0;
  long long yans = 0;
  cin >> n >> m;
  REP(i,1,n+1){
    long long x;
    cin >> x;
    xans += (2 * i - n - 1) * x;
  }
  REP(i,1,m+1){
    long long y;
    cin >> y;
    yans += (2 * i - m - 1) * y;
  }
  xans %= MOD;
  yans %= MOD;
  ll ans = xans * yans % MOD;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
n = int(input())

num1 = 10**n % (10**9 + 7)
num2 = (9**n * 2) % (10**9 + 7)
num3 = 8**n % (10**9 + 7)

print((num1 - num2 + num3) % (10**9 + 7))

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

int main(){
  int x;
  cin >> x;
  vector<int> buc(100001,0);
  queue<int> q;
  q.push(0);
  buc[0] = 1;
  while(!q.empty()){
    int now = q.front();
    q.pop();
    vector<int> d = {100,101,102,103,104,105};
    rep(i,6){
      int next = now + d[i];
      if(next < 0) continue;
      if(next > 100000) continue;
      if(buc[next] == 0){
        buc[next] = 1;
        q.push(next);
      }
    }
  }
  cout << buc[x] << endl;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
int nearest[30005][10];
int d[30005];
int vis[10][10][10];
int main(){
	for(int i=0;i<30005;i++){
		for(int j=0;j<10;j++){
			nearest[i][j]=-1;
		}
	}
	int n;
	cin>>n;
	string s;
	cin>>s;
	for(int i=0;i<n;i++){
		d[i]=s[i]-'0';
	}
	int ans=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<=9;j++){
			for(int k=0;k<=9;k++){
				int was=nearest[i][j];
				if(was!=-1&&nearest[was][k]!=-1&&!vis[k][j][d[i]]){
					ans++;
					vis[k][j][d[i]]=1;
//					cout<<k<<" "<<j<<" "<<d[i]<<endl;
				}
			}
		}
		for(int j=0;j<=9;j++){
			nearest[i+1][j]=nearest[i][j];
		}
		nearest[i+1][d[i]]=i;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1536
#include<stdio.h>
int a, b, c, k;
int main(){
	scanf("%d%d%d%d",&a,&b,&c,&k);
	while(a >= b){
		k--;
		b *= 2;
	}
	while(b >= c){
		k--;
		c *= 2;
	}
	puts(k>=0?"Yes":"No");
	return 0;
}

Measured memory_bytes: 1644
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#include <climits>
#include <functional>
#include <string>
#include <sstream>

#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;

    int upper = (int)(M/N);
    int ans;
    for(int i = upper; i >= 0; i--){
        if(M%i == 0){
            ans = i;
            break;
        }
    }
        
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

struct Combination {
	vector<long long> inv,finv,fac;
	Combination(int n, int kmax) : inv(kmax+1),finv(kmax+1),fac(kmax){
		if(kmax>=1){
			inv.at(1)=1;
			finv.at(1)=1;
			fac.at(0) = n;
		}
	for(int i=2; i<=kmax; i++) inv.at(i) = MOD - inv.at(MOD%i) * (MOD/i) %MOD;
	for(int i=2; i<=kmax; i++) finv.at(i) = finv.at(i-1) * inv.at(i) % MOD;
	for(int i=1; i<kmax; i++) fac.at(i) = fac.at(i-1) * (n-i) % MOD;
	}
	ll comb(int k) {return (k ? fac.at(k-1) * finv.at(k) % MOD : 1 );}
};

int main(){
	
	int n,k; cin>>n>>k;
	Combination c(k-1,k-1),d(n-k+1,k);
	for(int i=k-1; i>=0; i--){
		cout << (c.comb(i) * d.comb(k-i))%MOD << endl;
	}
	
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int dp[5001][5001];

int main() {
    int N;
    string S;
    cin >> N >> S;
    RREP(i, N) RREP(j, N) if (S[i] == S[j]) dp[i][j] = dp[i + 1][j + 1] + 1;
    int ans = 0;
    REP(i, N) FOR(j, i + 1, N) ans = max(ans, min(dp[i][j], j - i));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 97920
/**
   Solution by Abil
**/
# include <bits/stdc++.h>

# define fr first
# define sc second
# define pb push_back
# define mk make_pair
# define sz(s) s.size()
# define all(s) s.begin(),s.end()
# define int long long

using namespace std;

const long long N = (1e6 + 10);
const long long mod = (1e9 + 7);
const long long inf = (1e9 + 7);

int dp[N],arr[N];
main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);

    int n, k;
    cin >> n >> k;
    for(int i = 1;i <= n; i++){
        cin >> arr[i];
    }

    for(int i = 0;i <= k; i++){
        for(int j = 1;j <= n && i - arr[j] >= 0; j++){
            if(!dp[i - arr[j]]){
                dp[i] = 1;
            }
        }
    }

    cout << ((dp[k] == 1)?"First":"Second");

}


Measured memory_bytes: 4352
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)




int main()
{
	char s[100][10];
	char t[100][10];
	int n;
	cin >> n;
	int i;
	int j;
	int Ans = 1;

	rep(i, 0, n) cin >> s[i];
	int max=-100;
	int m;
	cin >> m;
	rep(i, 0, m) cin >> t[i];

	rep(i, 0, n-1) {
		rep(j, 1, n) {
			if (strcmp(s[i], s[i + j]) == 0) {
				Ans++;
			}
		}
		rep(j, 0, m) {

			if (strcmp(s[i], t[j]) == 0) {
				Ans--;
			}
		}
		if (max < Ans) max = Ans;
		Ans = 1;
	}
	if (max <= 0) cout << 0;
	else cout << max<<endl;

	




	


}

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

int main()
{
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    vector<bool> water(30, false);
    water[0] = true;
    for (int i = 1; i <= F/100; i++) {
        if (i >= A && water[i-A] == true) water[i] = true;
        if (i >= B && water[i-B] == true) water[i] = true;
    }
    vector<bool> sugar(3000, false);
    sugar[0] = true;
    vector<int> able_sugar;
    able_sugar = {0};
    for (int i = 1; i <= 3000; i++) {
        if (i >= C && sugar[i-C] == true) sugar[i] = true;
        if (i >= D && sugar[i-D] == true) sugar[i] = true;
        if (sugar[i]) able_sugar.push_back(i);
    }
    pair<int, int> ans;
    ans = {100*A, 0};
    for (int i = 1; i <= F/100; i++) {
        if (!water[i]) continue;
        auto l = upper_bound(able_sugar.begin(), able_sugar.end(), min(i*E, F-i*100));
        int s = able_sugar[l - able_sugar.begin() - 1];
        int w = s + 100 * i;
        if (ans.second * w < s * ans.first) ans = {w, s};
    }
    printf("%d %d\n", ans.first, ans.second);
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;

long long GCD(long long a, long long b) {
    if(b == 0)
        return a;
    else
        return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
    long long g = GCD(a, b);
    return a / g * b;
}
int main() {
    int N;
    cin >> N;
    vector<double> v(N);
    rep(i, 0, N) { cin >> v[i]; }
    sort(v.begin(), v.end());
    double res = v[0];
    rep(i, 1, N) { res = (res + v[i]) / 2.0; }
    cout << setprecision(16) << res << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;

int b_row,b_col,memo[16][3][3];

char b[2];

bool rangeCheck(int row,int col){
	if(row >= 0 && row <= 2 && col >= 0 && col <= 2)return true;
	else{
		return false;
	}
}

int translate(char ch){
	switch(ch){
	case 'A':return 0;
	case 'B':return 1;
	case 'C':return 2;
	case 'D':return 10;
	case 'E':return 11;
	case 'F':return 12;
	case 'G':return 20;
	case 'H':return 21;
	case 'I':return 22;
	}

	return -1; //must not reach here.
}

int main(){

	int n,tmp,energy_row,energy_col,row,col,div_row[4] = {-1,0,0,1},div_col[4] = {0,-1,1,0};
	char start[2],energy[2];

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		for(int i = 0; i < 16; i++){
			for(int p = 0; p < 3; p++){
				for(int k = 0; k < 3; k++)memo[i][p][k] = 0;
			}

		}

		scanf("%s %s %s",start,energy,b);

		tmp = translate(b[0]);
		b_row = tmp/10;
		b_col = tmp%10;

		tmp = translate(energy[0]);
		energy_row = tmp/10;
		energy_col = tmp%10;

		tmp = translate(start[0]);

		row = tmp/10,col = tmp%10;

		memo[0][row][col] = 1;

		for(int loop = 0; loop <= n-1; loop++){
			for(int i = 0; i < 3; i++){
				for(int k = 0; k < 3; k++){
					if(i != b_row || k != b_col){ //????????§????????´???
						for(int p = 0; p < 4; p++){
							if(rangeCheck(i+div_row[p],k+div_col[p]) == true && (i+div_row[p] != b_row || k + div_col[p] != b_col)){ //?§????????????§??????????????????????????§??????
								memo[loop+1][i+div_row[p]][k+div_col[p]] += memo[loop][i][k];
							}else{ //?°?????????¨???1????????????????????????????????´?????????????????´??????????????¨????????´????????°???????????????
								memo[loop+1][i][k] += memo[loop][i][k];
							}
						}
					}
				}
			}
		}

		printf("%.8lf\n",((double)memo[n][energy_row][energy_col])/((double)pow(4,n)));
	}

	return 0;
}

Measured memory_bytes: 2812
import java.util.Scanner;

class Main{
        public static void main(String args[]){
                Scanner scan = new Scanner(System.in);
                int val1=scan.nextInt();
                int val2=scan.nextInt();
                int val3=scan.nextInt();
                if(val1<val2&&val2<val3){
                        System.out.println("Yes");
                }else{
                        System.out.println("No");
                }
        }
}

Measured memory_bytes: 26184
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	Scanner sc = new Scanner(System.in);
	public void run() {
		while(sc.hasNext()){
			int w = sc.nextInt();
			int h = sc.nextInt();
			if(w == 0 && h == 0) break;
			else calc(w, h);
		}
	}
	public void calc(int w, int h){
		int[][] kabeMigi = new int[h][w-1];
		int[][] kabeShita = new int[h-1][w];
		for(int i = 0; i < w-1; i++){
			int k = sc.nextInt();
			kabeMigi[0][i] = k;
		}
		for(int t = 0; t < h - 1; t++){
			for(int i = 0; i < w; i++){
				int k = sc.nextInt();
				kabeShita[t][i] = k;;
			}
			for(int i = 0; i < w - 1; i++){
				int k = sc.nextInt();
				kabeMigi[t+1][i] = k;
			}
		}
		int[][] pass = new int[h][w];
		LinkedList<int[]> list = new LinkedList<int[]>();
		list.add(new int[]{0,0});
		pass[0][0] = 1;
		
		boolean ans = false;
		
		while(!list.isEmpty()){
			int[] now = list.pollFirst();
			int nowH = now[0];
			int nowW = now[1];
			if(nowH == h-1 && nowW == w-1){
				System.out.println(pass[nowH][nowW]);
				ans = true;
				break;
			}
			else{
				if(nowW < w-1 && kabeMigi[nowH][nowW] == 0 && pass[nowH][nowW+1] == 0){
					pass[nowH][nowW+1] = pass[nowH][nowW] + 1;
					list.add(new int[]{nowH, nowW+1});
				}
				if(nowH < h-1 && kabeShita[nowH][nowW] == 0 && pass[nowH+1][nowW] == 0){
					pass[nowH+1][nowW] = pass[nowH][nowW] + 1;
					list.add(new int[]{nowH+1, nowW});
				}
				if(nowW > 0 && kabeMigi[nowH][nowW-1] == 0 && pass[nowH][nowW-1] == 0){
					pass[nowH][nowW-1] = pass[nowH][nowW] + 1;
					list.add(new int[]{nowH, nowW-1});
				}
				if(nowH > 0 && kabeShita[nowH-1][nowW] == 0 && pass[nowH-1][nowW] == 0){
					pass[nowH-1][nowW] = pass[nowH][nowW] + 1;
					list.add(new int[]{nowH-1, nowW});
				}
			}
		}
		if(!ans) System.out.println(0); 
		
	}
	

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

Measured memory_bytes: 66732
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
L = [(10 - A%10)%10,(10 - B%10)%10,(10 - C%10)%10,(10 - D%10)%10,(10 - E%10)%10]
L.sort()
print(A+B+C+D+E+L[0]+L[1]+L[2]+L[3])

Measured memory_bytes: 9092
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>
#include <unordered_map>
#include <set>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

template<class In>
void print_array(In begin, In end) {
  cout << (*begin);
  begin++;
  for (; begin != end; begin++)
  {
    cout << " " << (*begin);
  }
  cout << endl;
}

int main()
{
  ll N;
  cin >> N;

  vector<pair<ll, ll>> points(N);
  for (auto i = 0; i < N; i++) {
    ll x, y;
    cin >> x >> y;
    points[i] = make_pair(x, y);
  }

  vector<pair<ll, ll>> candidates;
  for (auto i = 0; i < N; i++) {
    for (auto j = 0; j < N; j++) {
      if (i == j)
        continue;

      candidates.push_back(
          make_pair(
              points[i].first - points[j].first,
              points[i].second - points[j].second));
    }
  }

  sort(points.begin(), points.end());
  ll min_cost = N;
  for (auto pq : candidates)
  {
    if(pq.first < 0)
      continue;
    ll cost = 1;
    vector<bool> used(N, false);
    used[0] = true;
    auto prev = points[0];

    for (auto i = 1; i < N; i++) {
      ll choice_idx = -1;
      for (auto j = 0; j < N; j++)
      {
        if (used[j])
          continue;
        if (
          (prev.first + pq.first) == points[j].first &&
          (prev.second + pq.second) == points[j].second) {
          choice_idx = j;
          break;
        }
      }
      if (choice_idx == -1) {
        cost++;
        for (choice_idx = 0; choice_idx < N && used[choice_idx]; choice_idx++)
          ;
      }
      used[choice_idx] = true;
      prev = points[choice_idx];
    }
    // cout << "p=" << pq.first << " q=" << pq.second << " cost="  << cost << endl;
    min_cost = min(min_cost, cost);
  }

  cout << min_cost << endl;

  return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(100010, 0);
    for(int i = 0; i < n; i++)
    {
        int b;
        cin >> b;
        a[b]++;
    }
    int ans=0;
    for(int i = 0; i <= 99998; i++)
    {
        ans = max(ans, a[i]+a[i+1]+a[i+2]);
    }

    cout << ans << endl;   

    
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int dp[105][105];

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w; cin>>h>>w;
    vector<string> c(h);
    rep(i,h) cin>>c[i];
    rep(i,h)rep(j,w) dp[i][j]=1000;
    if (c[0][0]=='.') dp[0][0] = 0;
    else dp[0][0] = 1;
    rep(i,h)rep(j,w){
        if (i+1<h && c[i][j]=='.' && c[i+1][j]=='#') chmin(dp[i+1][j],dp[i][j]+1);
        else chmin(dp[i+1][j],dp[i][j]);
        if (j+1<w && c[i][j]=='.' && c[i][j+1]=='#') chmin(dp[i][j+1],dp[i][j]+1);
        else chmin(dp[i][j+1],dp[i][j]);
    }
    cout<<dp[h-1][w-1]<<"\n";
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;
int main(void){

    std::vector<unsigned int> v;
    unsigned int tmp, k;
    
    for(int i=0; i<5; i++) {
        std::cin >> tmp;
        v.push_back(tmp);
    }
    std::cin >> k;
    

    for(int i=0; i<v.size(); i++) {
        for(int j=i+1; j<v.size(); j++) {
            if(v[j] - v[i] > k) {
                std::cout << ":(" << std::endl;
                return 0;
            }
        }
    }
    
    std::cout << "Yay!" << std::endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int i = 0;
        for(int x = a; x <= b; x++){
          if(c % x <= 0){
          i = i + 1;
          }
        }
        System.out.println(i);
}

}


Measured memory_bytes: 26288
s = input()
K = int(input())

D = []
if len(s) >= 5:
    for i in range(len(s)):
        if s[i] not in D:
            D.append(s[i])
    for i in range(len(s)-1):
        if s[i]+s[i+1] not in D:
            D.append(s[i]+s[i+1])
    for i in range(len(s)-2):
        if s[i]+s[i+1]+s[i+2] not in D:
            D.append(s[i]+s[i+1]+s[i+2])
    for i in range(len(s)-3):
        if s[i]+s[i+1]+s[i+2]+s[i+3] not in D:
            D.append(s[i]+s[i+1]+s[i+2]+s[i+3])
    for i in range(len(s)-4):
        if s[i]+s[i+1]+s[i+2]+s[i+3]+s[i+4] not in D:
            D.append(s[i]+s[i+1]+s[i+2]+s[i+3]+s[i+4])
elif len(s) == 4:
    for i in range(len(s)):
        if s[i] not in D:
            D.append(s[i])
    for i in range(len(s)-1):
        if s[i]+s[i+1] not in D:
            D.append(s[i]+s[i+1])
    for i in range(len(s)-2):
        if s[i]+s[i+1]+s[i+2] not in D:
            D.append(s[i]+s[i+1]+s[i+2])
    for i in range(len(s)-3):
        if s[i]+s[i+1]+s[i+2]+s[i+3] not in D:
            D.append(s[i]+s[i+1]+s[i+2]+s[i+3])
elif len(s) == 3:
    for i in range(len(s)):
        if s[i] not in D:
            D.append(s[i])
    for i in range(len(s)-1):
        if s[i]+s[i+1] not in D:
            D.append(s[i]+s[i+1])
    for i in range(len(s)-2):
        if s[i]+s[i+1]+s[i+2] not in D:
            D.append(s[i]+s[i+1]+s[i+2])
elif len(s) == 2:
    for i in range(len(s)):
        if s[i] not in D:
            D.append(s[i])
    for i in range(len(s)-1):
        if s[i]+s[i+1] not in D:
            D.append(s[i]+s[i+1])
else:
    for i in range(len(s)):
        D.append(s[i])
D.sort()
print(D[K-1])

Measured memory_bytes: 4052
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
#include <math.h>
#include <map>
#define ll long long
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vvvl vector<vector<vector<ll> > >
#define vd vector<double>
#define vvd vector<vector<double> >
#define vvvd vector<vector<vector<double> > >
#define rep(i,a) for(ll i = 0;i<a;++i)
#define mod 1000000007
#define inf 10010010010
using namespace std;

//O(logB)
ll mpow(ll a, ll b, ll m){
	if (!b) return 1 % m;
	if (b == 1) return a % m;
	if (b % 2) return (a*mpow(a, b - 1, m)) % m;
	else return mpow((a*a) % m, b / 2, m) % m;
}

//O(N)
ll mfact(ll a, ll m){
	ll ret = 1;
	for (ll i = 1; i <= a; ++i) ret = (i*ret) % m;
	return ret;
}

//O(N+logN)
//前処理しとけばO(1)
//前処理はO(N+logN)

ll fact[200001], factinv[200001];

ll mcomb(ll n, ll k, ll m){
	if (!n && !k) return 1;
	if (n < k || n < 0) return 0;
	return (((mfact(n, m)*mpow(mfact(k, m), m - 2, m)) % m)*mpow(mfact(n - k, m), m - 2, m)) % m;
}

int main(){
	for (ll i = 1; i <= 200000; ++i) fact[i] = (fact[i - 1] * i) % mod;
	for (ll i = 0; i <= 200000; ++i) factinv[i] = mpow(fact[i], mod - 2, mod);
	ll n; cin >> n;
	vl a(n);
	rep(i, n) cin >> a[i];
	if (n == 1){
		cout << (2 * a[0]) % mod << endl;
		return 0;
	}
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	ll ans = 0;
	rep(i, n){ 
		ll t1 = (a[i] * i) % mod;
		t1 = (t1*mpow(2, n - 2, mod)) % mod;
		ll t2 = (a[i] * mpow(2, n - 1, mod)) % mod;
		ans = (ans + t1 + t2) % mod;
	}cout << (ans*mpow(2,n,mod))%mod << endl;
	return 0;
}

Measured memory_bytes: 4992