akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
template<typename T, typename V = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, V, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>; // find_by_order(), order_of_key()
using ll = long long int;
using i64 = long long int;
#define SZ(v) (int((v).size()))
#define ALL(vec) (vec).begin(),(vec).end()
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " =: " << a << endl;
    err(++it, args...);
}
template <typename T1, typename T2>
inline std::ostream& operator << (std::ostream& os, const std::pair<T1, T2>& buf) {
    return os << "(" << buf.first << ": " << buf.second << ")";
}
template<typename T>
inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v) {
    bool first = true;
    os << "[";
    for(unsigned int i = 0; i < v.size(); i++) {
        if(!first) os << ", ";
        os << v[i];
        first = false;
    }
    return os << "]";
}
template<typename T>
inline std::ostream &operator << (std::ostream & os,const set<T>& v) {
    bool first = true;
    os << "{";
    for (auto ii = v.begin(); ii != v.end(); ++ii) {
        if(!first) os << ", ";
        os << *ii;
        first = false;
    }
    return os << "}";
}
inline std::ostream &operator << (std::ostream & os,const std::multiset<pair<int,int>,greater<pair<int,int>>>& v) {
    bool first = true;
    os << "{";
    for (auto x: v) {
        if(!first) os << ", ";
        os << x;
        first = false;
    }
    return os << "}";
}
template<typename T1, typename T2>
inline std::ostream &operator << (std::ostream & os,const std::map<T1, T2>& v) {
    bool first = true;
    os << "{";
    for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end(); ++ii) {
        if(!first) os << ", ";
        os << *ii ;
        first = false;
        return os << "}";
    }
}
template<typename T>
inline std::ostream &operator << (std::ostream & os,const vector<vector<T>>& v) {
    for (auto &u: v) os << '\n' << u;
    return os;
}
template<typename T>
void finish(T ans) {cout << ans << '\n'; exit(0);}
const int MOD = 1e9 + 7;
const long long INF = 1e18;
const double EPS = 1e-6;
#define PI 3.14159265358979323846
/***********************************************************************/

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout << fixed; cout.precision(10);
    
    int n, k;
    cin >> n >> k;
    cout << (((n + 1) / 2 >= k) ? "YES" : "NO") << '\n'; 
    
    return 0;
}


Measured memory_bytes: 256
n = int(input())
d1,d2 = [],[]
for _ in range(n):
    a,b = map(int,input().split())
    d1.append(a)
    d2.append(b)
check = True
for i in range(2,n):
    if d1[i-2] == d2[i-2] and d1[i-1] == d2[i-1] and d1[i] == d2[i]:
        print("Yes")
        check = False
        break
if check:
    print("No")

Measured memory_bytes: 9196
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
	int a,b,c[4],n,m;
	cin>>a>>b;
	memset(c,0,sizeof(c));
	c[a]=1;c[b]=1;

	for(int i=1;i<=3;i++)
	{
		if(c[i]==0)
		cout<<i<<endl; 
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    double[] d = new double[6];
    while (s.hasNext()) {
      for (int i = 0; i < 6; i++)
        d[i] = s.nextDouble();
      double a = d[0] * d[4] - d[1] * d[3];
      double x = (d[4] * d[2] - d[1] * d[5]) / a;
      double y = (d[0] * d[5] - d[2] * d[3]) / a;
      if (x == 0) x = 0;
      if (y == 0) y = 0;
      System.out.printf("%.3f %.3f\n", x, y);
    }
  }
}

Measured memory_bytes: 12000
/*Lucky_Glass*/
#include<map>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long ll;
const int N=1e5+10;
const ll INF=1e10;

template<class T>void Read(T &x){
	x=0;int c=getchar();
	while(c<'0' || '9'<c) c=getchar();
	while('0'<=c && c<='9') x=(x<<1)+(x<<3)+c-'0',c=getchar();
}

int n;
map<ll,int> cnt;
map<ll,ll> mat;
ll num[N];

inline ll Mul(ll a,ll b){return a*b>INF? 0:a*b;}
int main(){
	Read(n);
	for(int t=1;t<=n;t++){
		ll thi=1,ops=1,now;
		Read(now);
		for(int i=2;i<=3000;i++){
			if(now%i==0){
				int tcnt=0;
				while(now%i==0) now/=i,tcnt++;
				tcnt%=3;
				if(tcnt==1) thi*=i*i,ops=Mul(ops,i);
				else if(tcnt==2) thi*=i,ops=Mul(Mul(ops,i),i);
			}
		}
		ll sqit=(ll)sqrt(now);
		if(sqit*sqit==now) ops*=sqit,thi*=now;
		else ops=Mul(Mul(ops,now),now),thi*=now;
		mat[thi]=ops;
		cnt[thi]++;
	}
	int ans=0;
	for(map<ll,int>::iterator it=cnt.begin();it!=cnt.end();it++)
		if(it->second){
			if(it->first==1) ans++;
			else{
				ans+=max(it->second,cnt[mat[it->first]]);
				cnt[it->first]=cnt[mat[it->first]]=0;
			}
		}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 18448
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
l=list(map(int,input().split()))

r=[i for i in range(n)]
if n<3:
    print(0)
    exit()
ans=0
for res in itertools.combinations(r,3):
    a,b,c=res
    if l[a]!=l[b] and l[b]!=l[c] and l[c]!=l[a]:
        la=l[a]
        lb=l[b]
        lc=l[c]
        if la<lb+lc and lb<la+lc and lc<la+lb:
            ans+=1
print(ans)

Measured memory_bytes: 73028
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
  static long putty=0;
  static long eat=0;
  static void Main(string[] args)
  {
    var split = Console.ReadLine().Split(' ');
    int level = int.Parse(split[0]);
    eat = long.Parse(split[1]);
    
    eatBurger(level);
        
    Console.WriteLine(putty);
  }
  
  static void eatBurger(int level){
    if(level == 0){      
      putty++;
      eat--;
      return;
    }
    
    var puttyL = Math.Pow(2, level+1)-1;
    var eatL = (Math.Pow(2, level+1)-1)*2-1;
    if(eatL<eat){
      putty += (long)puttyL;
      eat -= (long)eatL;
      return;
    }
    
    eat--;
    if(eat<=0) return;

    eatBurger(level-1);
    if(eat<=0) return;
  
    putty++;
    eat--;
    if(eat<=0) return;

    eatBurger(level-1);
    if(eat<=0) return;

    eat--;
    if(eat<=0) return;
  }
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define stl_repr(itr, x) for (auto itr = x.rbegin(); itr != x.rend(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

using llong = long long int;

const static int MOD = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = 1LL << 31;
const static int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k, ans = 0;
    cin >> n >> k;

    rep(i, n) {
      int h;
      cin >> h;
      if (h >= k) ++ans;
    }

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

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)








int main() {
    ll n, m;
    scanf("%lld %lld", &n, &m);
    unordered_map<ll, bool> a, b;
    REP(i, n){
        ll t;
        scanf("%lld", &t);
        if(a[t]){
            printf("0\n");
            return 0;
        }
        a[t] = true;
    }
    REP(i, m){
        ll t;
        scanf("%lld", &t);
        if(b[t]){
            printf("0\n");
            return 0;
        }
        b[t] = true;
    }
    
    ll ans = 1, a_cnt = 0, b_cnt = 0;
    for(ll i = n * m; i >= 1; i--){
        if(a[i] && b[i]){
            a_cnt++;
            b_cnt++;
            continue;
        }
        else if(a[i]){
            ans *= b_cnt;
            ans %= MOD;
            a_cnt++;
        }
        else if(b[i]){
            ans *= a_cnt;
            ans %= MOD;
            b_cnt++;
        }
        else{
            ans *= (a_cnt * b_cnt - (n * m - i)) % MOD;
            ans %= MOD;
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 79264
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
ll n,k,ans=0;
bool Main(){
    cin>>n>>k;
    vector<int> d(k);
    For(i,0,k){
        cin>>d.at(i);
    }
    ans=n;
    while(true){
        ll i=ans;
        vector<int> a;
        while(i){
            a.push_back(i%10);
            i/=10;
        }
        bool flag=true;
        for(auto x:d){
            for(auto y:a){
                if(x==y){
                    flag=false;
                    break;
                }
            }
            if(!flag){
                break;
            }
        }
        if(flag){
            break;
        }
        ans++;
    }
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}

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

int main(){
  
  int  a, b, c, d;
  
  cin >> a; 
  b = a / 100;
  c = (a - 100*b) / 10;
  d = a - 100*b - c * 10;
  cout << b + c + d;
}

Measured memory_bytes: 256
#include <stdio.h>

long a,b;
int r,c[1000],d[1000];
int count1 = 0;
int count2 = 0;
int main(void)
{
   while(scanf("%d %d",&a,&b)!= EOF){
     if(a == 0 && b == 0){
       break;
      }
      
      count1 = 0;
   if(a >= b){
     do{
       r=a%b;
       a=b;
       b=r;
       count1++;
     }while(r!= 0);
     c[count2] = a;
    d[count2] = count1;
    }
    if(a < b){
     do{
       r=b%a;
       b=a;
       a=r;
       count1++;
     }while(r!= 0);
    c[count2] = b;
    d[count2] = count1;
    }
    count2++;

  }
  for (int i = 0; i < count2; i++) {
   printf("%d %d\n",c[i],d[i]);
  }

   exit(0);
}




Measured memory_bytes: 1976
#include <bits/stdc++.h>
#define ll long long
#define pq priority_queue
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
const ll MAX=510000;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};
template<class T> inline bool chmax(T& a, T b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a>b) { a=b; return 1; } return 0; }
ll rep(ll N,ll P){
    if(P==0) return 1;
    if(P%2==0){
      ll t=rep(N,P/2);
      return t*t%MOD;
    }
    return N*rep(N,P-1);
  }


int main(){
    ll N,ans;
    bool f=true;
    cin>>N;
    vector<ll> A(N+1,0);
    for(ll i=0;i<N;i++){
        ll a;
        cin>>a;
        A[a]++;
    }
    for(ll i=0;i<N;i++){
        if(N%2==0){
            if(i%2==0&&A[i]!=0) f=false;
            if(i%2==1&&A[i]!=2) f=false;
        }else{
            if(i==0&&A[i]!=1) f=false;
            if(i!=0&&i%2==0&&A[i]!=2) f=false;
            if(i%2==1&&A[i]!=0) f=false;
        }
    }
    ans=rep(2,N/2);
    ans%=MOD;
    if(f) cout<<ans<<endl;
    else cout<<"0"<<endl;
}

Measured memory_bytes: 1024
import java.io.*;

class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br
		= new BufferedReader(new InputStreamReader(System.in));
		double x=0.0,y=0.0;
		int b=90;
		while(true){
			String buf=br.readLine();
			String[] buf2=buf.split(",");
			int[] data=new int[2];
			for(int i=0;i<data.length;i++)
				data[i]=Integer.parseInt(buf2[i]);
			if(data[0]==0&&data[1]==0)break;
			x+=(double)data[0]*Math.cos(((double)b*Math.PI)/180.0);
			y+=(double)data[0]*Math.sin(((double)b*Math.PI)/180.0);
			b-=data[1];
		}
		System.out.println((int)x);
		System.out.println((int)y);
	}
}

Measured memory_bytes: 9236
N, M = map(int, input().split())

nodes = {}
for n in range(N):
    nodes[n] = []

for m in range(M):
    i,j = map(int, input().split())
    nodes[i-1].append(j-1)
    nodes[j-1].append(i-1)


def dfs(v):
    global reached
    global ans
    if False not in reached:
        ans += 1
        return
    for i in range(N):
        if i in nodes[v] and not reached[i]:
            reached[i] = True
            dfs(i)
            reached[i] = False
    return

ans = 0
for v in range(1):
    reached = [False for i in range(N)]
    reached[v] = True
    dfs(v)
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

int main( void ) {
	int i, n, a[ 10 ], bTop, cTop;

	for ( scanf( "%d", &n ); n--; puts( i != -2 ? "YES" : "NO" ) ) {
		for ( i = 10; i--; scanf( "%d", a + i ) );

		bTop = cTop = 0;
		for ( i = 10; i-- > 0; a[ i ] > bTop ? ( bTop = a[ i ] ) : a[ i ] > cTop ? ( cTop = a[ i ] ) : ( i = -1 ) ) ;
	}

	return 0;
}

Measured memory_bytes: 580
using System;
using System.Collections.Generic;
using System.Linq;
 
class Program {
    static void Main(string[] args) {
        string S;
        Input(out S);
        int count = 0;
        for(int i = 0; i < S.Length / 2; i++){
            if(S[i] != S[S.Length - 1 - i]){
                count++;
            }
        }
        Console.WriteLine(count);
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void InputArray<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
}

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

class UnionFind {
    vector<ll> parents;
    public:
    UnionFind(ll N) {
        parents.assign(N, -1);
    }
    ll root(ll x) {
        ll current = x;
        while(true) {
            ll temp = parents[current];
            if(temp < 0) break;
            current = temp;
        }
        return current;
    }
    bool same(ll x, ll y) {
        return root(x) == root(y);
    }
    void unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(parents[x] > parents[y]) swap(x, y);
        parents[x] += parents[y];
        parents[y] = x;
    }
    ll size(ll x) {
        return -parents[root(x)];
    }
};

int main() {
    ll a, b;
    ll N, M, K;
    cin >> N >> M >> K;
    UnionFind aaaa(N);
    vector<set<ll>> hab(N);
    for(ll i = 0;i < M;i++) {
        cin >> a >> b;
        a--; b--;
        aaaa.unite(a, b);
        hab[a].insert(b);
        hab[b].insert(a);
    }
    for(ll i = 0;i < K;i++) {
        cin >> a >> b;
        a--; b--;
        if(!aaaa.same(a, b)) continue;
        hab[a].insert(b);
        hab[b].insert(a);
    }
    for(ll i = 0;i < N;i++) {
        ll count = aaaa.size(i) - 1 - hab[i].size();
        cout << count << ' ';
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 25088
#include<bits/stdc++.h>
#define ll long long

#define infty 10000000

using namespace std;

int rec(int a, int b, int c, vector<int> l, int A ,int B, int C);

int main()
{
  int i;
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> l(N);
  for(i=0;i<N;i++) cin >> l[i];
  cout << rec(0,0,0,l,A,B,C) << endl;
}

int rec(int a, int b, int c, vector<int> l, int A ,int B, int C)
{
  int tmp;
  if(l.size()==0){
    if(min({a,b,c}) == 0) return infty;
    else return abs(A-a) + abs(B-b) + abs(C-c) - 30;
  } else {
    tmp = l[0];
    l.erase(l.begin());
    return min({rec(a+tmp, b, c, l, A, B, C) + 10,
      			rec(a, b+tmp, c, l, A, B, C) + 10,
      			rec(a, b, c+tmp, l, A, B, C) + 10,
      			rec(a, b, c, l, A, B, C)
    			});
  }
}

Measured memory_bytes: 256
from collections import deque

N, M = [int(x) for x in input().split()]

conn = [[] for _ in range(N + 1)]

for i in range(M):
    A, B = [int(x) for x in input().split()]
    conn[A].append(B)
    conn[B].append(A)

q = deque([1])
signpost = [0] * (N + 1)

while q:
    v = q.popleft()
    for w in conn[v]:
        if signpost[w] == 0:
            signpost[w] = v
            q.append(w)

print('Yes')
for i in range(2, N + 1):
    print(signpost[i])

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

namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
	string[] str=Console.ReadLine().Split(' ');
     int N=int.Parse(str[0]);
     int K=int.Parse(str[1]);
      string[] str2=Console.ReadLine().Split(' ');     
      int[] score=str2.Select(int.Parse).ToArray();
      for(int i=0;i<(N-K);i++){
      if(score[K+i]>score[i]){
        Console.WriteLine("Yes");
      }else{
        Console.WriteLine("No");
      }
      }
     
      
    }
    
  }

}

Measured memory_bytes: 46224
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int K, S;
    cin >> K >> S;
    int ans = 0;
    rep(X, 0, K + 1)
    {
        rep(Y, 0, K + 1)
        {
            const int Z = S - X - Y;
            if (Z >= 0 && Z <= K)
            {
                ++ans;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(void){
	string s;
	while(cin >> s){
		string out;
		for(int i = 0; i < s.length() ;i++){
			if(s[i] == '@'){
				for(int j=0;j<(s[i+1]-'0');j++){
					out += s[i+2];
				}
				i+=2;
			}else{
				out += s[i];
			}
		}
		cout << out << "\n";
	}
	
	return 0;
}

Measured memory_bytes: 0
//imports for BufferedReader
import java.io.BufferedReader;
import java.io.InputStreamReader;

//import for Scanner and other utility classes
import java.util.*;


// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

class Main {
    public static void main(String args[] ) throws Exception {
        Scanner s = new Scanner(System.in);
      
      int a=s.nextInt();
      int b=s.nextInt();
      int c=s.nextInt();
      
      if(a+b+c>=22)
        System.out.println("bust");
      else
        System.out.println("win");
    }
  
}

Measured memory_bytes: 23760
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>
#include <regex>
#include <numeric>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 998244353

int main() {
	LL n, k;
	scanf("%lld%lld", &n, &k);
	LL ret = 0;
	ret += (n / k)*(n / k)*(n / k);
	if (k % 2 == 0) {
		auto r = (n + k / 2) / k;
		ret += r* r*r;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))

dp = [float("inf")] * n
dp[0] = 0

for i in range(n-1):
    if i == 0:
        dp[i+1] = abs(h[i]-h[i+1])
    else:
        dp[i+1] = min(dp[i] + abs(h[i]-h[i+1]), dp[i-1] + abs(h[i+1]-h[i-1]))
print(dp[-1])

Measured memory_bytes: 13980
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pi acos(-1.0)
#define is_palindrome(str) equal(str.begin(),str.begin() + str.size()/2, str.rbegin())



int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


    long long n,k,r,p,s,i;
    string str,ans;
    map<char,char> point;
    map<char,int> value;

    cin>>n>>k>>r>>s>>p>>str;

    point['r']='p';
    point['p']='s';
    point['s']='r';

    value['r']=r;
    value['p']=p;
    value['s']=s;


    for(i=0; i<k; i++)
        {
            ans+=point[str[i]];
        }

    for(i=k; str[i]; i++)
        {
            if(str[i-k]!=str[i])
                ans+=point[str[i]];
            else if(ans[i-k]!=point[str[i]])
                ans+=point[str[i]];
            else
                ans+='x';
        }

    //cout<<ans<<endl;
    long long sum=0;
    for(i=0; ans[i]; i++)
        {
            sum+=value[ans[i]];
        }
    cout<<sum<<endl;

    return  0;
}



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

int main() {
    int n, m;
    cin >> n >> m;
    int v[m][2];
    rep(i,m) {
        cin >> v[i][0] >> v[i][1];
    }
    int ans = -1;
    for (int i = pow(10, n-1) - (n == 1); i < pow(10, n); i++) {
        string t = to_string(i);
        bool ok = true;
        rep(j,m) {
            int s = v[j][0] - 1;
            char c = v[j][1] + '0';
            if (t[s] != c) ok = false;
        }
        if (ok) {
            ans = i; 
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
a_arr = gets.chomp.split(" ").map(&:to_i).sort_by{|x| x}
b_arr = gets.chomp.split(" ").map(&:to_i)
c_arr = gets.chomp.split(" ").map(&:to_i).sort_by{|x| -x}

result = 0
b_arr.each do |b|
  a_num = a_arr.bsearch_index {|a| a >= b} || n
  c_num = c_arr.bsearch_index {|c| c <= b} || n
  result += a_num * c_num
end

puts result


Measured memory_bytes: 29000
main(a,b,c,x,y,z,t){for(;~scanf("%d%d%d%d%d%d",&a,&b,&c,&x,&y,&z);printf("%d %d %d\n",t/60/60,(t%3600)/60,t%60))t=(x-a)*3600+(y-b)*60+z-c;}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define sz 100002
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define pi pair<int,int>
#define PQ priority_queue<double, vector<double>, greater<double> >q
#define _sort(v) sort(v.begin(),v.end())
#define MP map<ll int,ll int>mp
#define MEM(x) memset(x,0,sizeof(x))
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define vec() vector<ll int>v1,v2
#define VEC(n) ll int x; vector<ll int>v;for(int i=0;i<n;i++){cin>>x;v.pb(x);}
#define TEST() int test;cin>>test; while(test--)
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
//Upper_bound   auto x=upper_bound(v[a].begin(),v[a].end(),les);les=*x; if(x==v[a].end())break;
//ll int LCM(ll int a,ll int b) { ll int gcd=__gcd(a,b);ll int lcm=a*b/gcd;return lcm;}
//ll int bigmod(ll int b, ll int p, ll int m){if(p==0)return 1;if(p%2!=0) return b%m*fun(b,p-1,m)%m;if(p%2==0){ ll int res=fun(b,p/2,m);return (res%m*res%m)%m;}}
//ll mod_inverse(ll a, ll mod){return bigmod(a,mod-2,mod);}
//void seive() { prime[np++]=2;for(i=3; i<=sz; i+=2){if(mark[i]==0){ prime[np++]=i;for(j=i*i; j<=sz; j+=i) mark[j]=1; } }}
//string add(string s1,string s2) {string s;int j=s1.size()-1,c=0,m; for(int i=s2.size()-1; i>=0; i--) {if(j>=0)m=s2[i]-'0'+s1[j]-'0'+c;else m=s2[i]-'0'+c; if(m>9) { s+=m%10+'0';c=m/10; } else {  c=0;s+=m+'0'; }j--; } if(c!=0) {s+=c+'0'; }reverse(s.begin(),s.end());return s;}
//int pos;string mul(int n) {string s;for(int i=0; i<pos; i++) { s+="0"; }pos++;int c=0,m; for(int i=s1.size()-1; i>=0; i--) { m=(s1[i]-'0')*n+c;if(m>9) { s+=m%10+'0';c=m/10;} else { c=0; s+=m+'0';} }while(c!=0) { s+=c%10+'0';c=c/10;}    reverse(s.begin(),s.end());return s;}


int main()
{
   ll int n,m,res=0;
   cin>>n;
   while(n--)
   {
       cout<<"ACL";
   }

    return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; cin >> n;
    VI a(n); cin >> a;
    int odd = 0;
    FOR(i, 0, n)if (a[i] % 2 == 1)++odd;
    cout << (odd % 2 == 0 ? "YES" : "NO") << "\n";
}

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>

main(){
  double d;
  double px, py, vx, vy, ans, lp, lv, naiseki, kyori;

  while(1){
    scanf("%lf", &d);
    if(d==0.0) break;

    scanf("%lf %lf %lf %lf", &px, &py, &vx, &vy);
    px*=-1;
    py*=-1;
    naiseki=px*vx+py*vy;
    lp=sqrt(px*px+py*py);
    lv=sqrt(vx*vx+vy*vy);

    ans=naiseki/(lp*lv);

    if(ans<=-0.9999999){
      kyori=2.0-lp;
      if(kyori<=d) printf("%.8f\n", 2.0-lp);
      else printf("impossible\n");
    }
    else if(ans>=0.9999999){
      kyori=lp;
      if(kyori<=d) printf("%.8f\n", lp);
      else printf("impossible\n");
    }
    else printf("impossible\n");
  }
  return 0;
}

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

int main(){

    int N, M;
    cin >> N >> M;
    vector<int>vec(M + 1, 0);
    for(int i = 0; i < N; i++){
        int k;
        cin >> k;
        for(int j = 0; j < k; j++){
            int t;
            cin >> t;
            vec[t]++;
        }
    }
    int ans = 0;
    for(int i = 1; i <= M; i++){
        if(vec[i] == N)ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb       push_back
#define mp       make_pair
#define mod      1000000007
#define first    ff
#define second   ss
#define pi       acos(-1.0)
typedef long long ll;
using namespace std;
vector<int>node[10001];

int main()
{      


     ios::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     
     string s;
      string ans="";
     for(int i=0;i<3;i++)
     {
        cin>>s;
        ans+=s[i];
     }
     cout<<ans<<endl;


      return 0;
    
 }       


Measured memory_bytes: 3812
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
int main(){
  unsigned long long int N,a,b;
  cin >> N >> a >> b;
  unsigned long long int ans;
  if((N % (a + b)) > a){
  	ans = (N / (a + b)) * a + a;
  }
  else{
    ans = (N / (a + b)) * a + (N % (a + b));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int n;
    std::cin>>n;
    std::vector<int> a(n);
    for(auto i = a.begin();i != a.end();i++){
        std::cin>>*i;
    }

    int cnt = 0;
    while(std::count_if(a.begin(), a.end(),
                [](int x) -> bool {
                    return x % 2 == 1;
                    }) == 0){
        ++cnt;
        std::transform(a.begin(), a.end(), a.begin(),
                [](int x) -> int {
                    return x / 2;
                });
    }

    std::cout<<cnt<<std::endl;
    return 0;
}

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

int main(){
	int n;
	int a[100];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=n-1;i>=0;i--){
		if(i==0){
			cout<<a[i];
		}else{
			cout<<a[i]<<" ";
		}
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 1160
H,W,A,B = tuple(map(int,input().split()))
if  B<=H//2 and A <= W//2:
    for i in range(B):
        print("0"*A + "1"*(W-A))
    for i in range(H-B):
        print("1"*A + "0"*(W-A))
else:
    print("No")

Measured memory_bytes: 40176
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    int n;
    cin >> n;
    int C[n-1],S[n-1],F[n-1];
    rep(i,n-1){
        cin >> C[i] >> S[i] >> F[i];
    }
    rep(i,n){
        int res=0;
        for(int j=i;j<n-1;j++){
            if(S[j]>res)res=S[j]+C[j];
            else if(res%F[j]==0)res+=C[j];
            else res+= F[j]-res%F[j]+C[j];
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <math.h>

using namespace std;

int prime_judge(int value);

int main() {
    int i, n, cnt;
    int a;
    
    scanf("%d", &n);
    
    cnt = 0;
    
    for (i = 0; i < n; i++) {
        scanf("%d", &a);
        cnt += prime_judge(a);
    }
    
    printf("%d\n", cnt);
    
    return 0;
}

//?´???°??????
int prime_judge(int value) {
    int i;
    int flag = 1;
    for (i = 2; i <= sqrt(value); i++) {
        if ((value % i) == 0) {
            flag = 0;
            break;
        }
    }
    return flag;
}

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

#define io ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ll long long
#define ld long double
#define EPS (1e-9)
#define OO (1ll << 50)
#define mod 1000000007
#define pii pair<int , int>

using namespace std;
const int N = 500005;
int n, k;

int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	io;
	cin >> n >> k;
	ll s = 1;
	for (int i = 0; i < n; ++i) {
        s = min(2 * s, s + k);
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define ld long double
#define tc() ll t;cin>>t;while(t--)
#define inp(n) ll n;cin>>(n)
#define inp2(n,m) ll n,m;cin>>(n);cin>>(m)
#define inp3(n,m,g) ll n,m,g;cin>>(n);cin>>(m);cin>>(g)
#define inps(s) string s;cin>>(s)
#define fr(i,n) for(ll i=0;i<n;i++)
#define rf(n,i) for(ll i=n-1;i>=0;i--)
#define vi vector<int >
#define vl vector<ll>
#define vd vector<ld>
#define vs vector<string >
#define pii pair<int,int>
#define pci pair<char ,int>
#define pic pair<int ,char>
#define psi pair<string ,int>
#define mii map<int ,int >
#define mci map<char ,int>
#define msi map<string ,int>
#define si set<int >
#define ss set<string>
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define mem(a,b) memset(a,b,sizeof(a))
ll mod = 1000000007;

int power(int x,  int y, int p)  
{  
    int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  

int main() {
    fast
    
    int n;
    cin>>n;
    
 
    ll ans10=1,ans9=1,ans8=1;
    for(int i=0;i<n;i++)
    {
        ans10 = (ans10%mod  * 10)%mod; 
        if(ans10<0)
        {
            ans10 = (ans10%mod + mod)%mod;
        }
        ans10 = ans10%mod;
    }
    for(int i=0;i<n;i++)
    {
        ans9 = (ans9%mod  * 9)%mod; 
        if(ans9<0)
        {
            ans9 = (ans9%mod + mod)%mod;
        }
        ans9 = ans9%mod;
    }
    ans9 = (ans9*2)%mod;
    if(ans9<0)
    {
        ans9 = (ans9%mod + mod)%mod;
    }
    for(int i=0;i<n;i++)
    {
        ans8 = (ans8%mod  * 8)%mod; 
        if(ans8<0)
        {
            ans8 = (ans8%mod + mod)%mod;
        }
        ans8 = ans8%mod;
    }
    
    ll ans = (ans10%mod + ans8%mod)%mod;
    
    if(ans<0)
    {
        ans = (ans%mod + mod)%mod;
    }
    ans = (ans%mod - ans9%mod)%mod;
    if(ans<0)
    {
        ans = (ans%mod + mod)%mod;
    }
    cout<<ans;
	return 0;
}


Measured memory_bytes: 3640
from collections import deque
import sys
H, W = list(map(int, input().split()))

city = []

for _ in range(H):
    city.append(list(input()))

dist = [[float("inf") for _ in range(W)] for _ in range(H)]

dist_count = [0 for _ in range(H*W)]

queue = deque()
queue.append((0, 0))
dist[0][0] = 0

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

while len(queue) > 0:
    now_x, now_y = queue.popleft()

    for dx_, dy_ in zip(dx, dy):

        adj_x = now_x + dx_
        adj_y = now_y + dy_

        if (not 0 <= adj_x < W) or (not 0 <= adj_y < H):
            continue

        if city[adj_y][adj_x] == "#":
            continue

        if dist[adj_y][adj_x] > H*W:
            dist[adj_y][adj_x] = dist[now_y][now_x] + 1
            queue.append((adj_x, adj_y))
            dist_count[dist[adj_y][adj_x]] += 1

#すぬけ君がどうやってもたどり着けない場合
if dist[H-1][W-1] > H**W:
    print(-1)
    sys.exit()

#すぬけ君がたどり着ける場合
route_grids = dist[H-1][W-1] + 1

white_all = 0
for i in range(H):
    for j in range(W):
        if city[i][j] == ".":
            white_all += 1
ans = white_all - route_grids
print(ans)


Measured memory_bytes: 74932
n,m,k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a,b = [0], [0]

for i in range(n):
    a.append(a[i]+A[i])
for j in range(m):
    b.append(b[j]+B[j])
    
ans, j = 0, m
for i in range(n+1):
    if a[i] > k:
        break
    while a[i] + b[j] > k:
        j -= 1
    ans = max(ans, i+j)
print(ans)

Measured memory_bytes: 47372
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;


public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
}

class Task {

    public void solve(InputReader in, PrintWriter out) {
        int H = in.nextInt();
        int W = in.nextInt();
        int h = in.nextInt();
        int w = in.nextInt();
        if (H % h == 0 && W % w == 0) {
            out.println("No");
            return;
        }
        int cnt = H / h * (W / w);
        out.println("Yes");
        for (int i = 1; i <= H; i++) {
            for (int j = 1; j <= W; j++) {
                if (j > 1) out.print(" ");
                if (i % h == 0 && j % w == 0) {
                    out.print(-1000 * w * h + 999);
                } else {
                    out.print(1000);
                }
            }
            out.println();
        }
    }
}


class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

}


Measured memory_bytes: 39676
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

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

    char C[H][W];
    for (int i = 0; i < H; i++)
    {
        string S;
        for (int j = 0; j < W; j++)
        {
            cin >> C[i][j];
            S += C[i][j];
        }
        cout << S << endl;
        cout << S << endl;
    }

}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(void){
	int i,t=0,flg=0;
	char e[64],b[256],c[5000];
	do{
		memset(b,0,sizeof(b));
		for(i=0;i<8;i++){
			if(scanf("%s",e)!=EOF){
				if(i==0){
					strcpy(b,e);
				}
				else{
					strcat(b,e);
				}
			}
			else{
				flg=1;
				break;
			}
		}
		if(!flg){
			for(i=0;i<80;i++){
				if(b[i]=='1'){
					if(b[i]=='1' && b[i+1]=='1' && b[i+8]=='1' && b[i+9]=='1' && (i+1)%8!=0){
						c[t]='A';
						//     printf("A");
						t++;
					}
					else if(b[i]=='1' && b[i+8]=='1' && b[i+16]=='1' && b[i+24]=='1'){
						c[t]='B';
						//     printf("B");
						t++;
					}
					else if(b[i]=='1' && b[i+1]=='1' && b[i+2]=='1' && b[i+3]=='1' && (i+1)%8!=0 && (i+2)%8!=0 && (i+3)%8!=0){
						c[t]='C';
						//   printf("C");
						t++;
					}
					else if(b[i]=='1' && b[i+7]=='1' && b[i+8]=='1' && b[i+15]=='1' && i%8!=0){
						c[t]='D';
						//  printf("D");
						t++;
					}
					else if(b[i]=='1' && b[i+1]=='1' && b[i+9]=='1' && b[i+10]=='1' && (i+2)%8!=0 && (i+1)%8!=0){
						c[t]='E';
						//   printf("E");
						t++;
					}
					else if(b[i]=='1' && b[i+8]=='1' && b[i+9]=='1' && b[i+17]=='1' && (i+1)%8!=0){
						c[t]='F';
						//   printf("F");
						t++;
					}
					else if(b[i]=='1' && b[i+1]=='1' && b[i+8]=='1' && b[i+7]=='1' && i%8!=0 && (i+1)%8!=0){
						c[t]='G';
						//   printf("G");
						t++;
					}
					//printf("\n");
					break;
				}
			}	
		}
	}while(!flg);
	for(i=0;i<t;i++){
		printf("%c\n",c[i]);
	}
	return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"

using namespace std;

double dp[334][334][334];

void solve()
{
	int N;
	cin >> N;
	vector<int> as(3);
	for (int i = 0; i < N; i++)
	{
		int a;
		cin >> a;
		as[a-1]++;
	}

	int M = 0, S = 0;

	for (int i = 0; i < 3; i++)
	{
		M = max(as[i], M);
		S += as[i];
	}

	for (int k = 0; k <= S; k++)
		for (int j = 0; j <= S; j++)
			for (int i = 0; i <= S; i++)
			{
				int l = N-i-j-k;
				if (l == N) continue;
				dp[i][j][k] += 1;
				if (i) dp[i][j][k] += dp[i-1][j][k] * i / N;
				if (j) dp[i][j][k] += dp[i+1][j-1][k] * j / N;
				if (k) dp[i][j][k] += dp[i][j+1][k-1] * k / N;
				dp[i][j][k] /= 1-((double)l/N);
				//cout << i << ' ' << j << ' ' << k << ' ' << dp[i][j][k] << endl;
			}

	cout << fixed << setprecision(12) << dp[as[0]][as[1]][as[2]] << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 264320
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cctype>
#include <cstdio>
#include <math.h>
using f32 = float;
using f64 = double;
using f80 = __float80;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<LL>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
#define REP(i, n) for (LL i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
int main()
{
    LL n,a,b,c;
      cin >>n ;
    vector<LL>aa(n);
    REP(i, n) cin >> aa[i];
    REP(i,n-1){
        if(aa[i]>aa[i+1]){
            aa[i + 1] += 1;
             if(aa[i]>aa[i+1]){
                 cout << "No";
                 return 0;
        }
    }
}
cout << "Yes";
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front

using ll = long long;
using namespace std;

ll M = 1000000007;

void solve(){
    int n;
    cin>>n;

    string s,t;
    cin>>s>>t;
    string ans;
    rep(i,n){
        ans.push_back(s[i]);
        ans.push_back(t[i]);
    }
    cout<<ans<<endl;
}


int main()
{
  solve();
}

Measured memory_bytes: 256
-- Atcoder https://atcoder.jp/contests/abc177/tasks/abc177_b

local bigString = io.read()
local smallString = io.read()

local function differenceCount(strA, strB)
    local c = 0
    for i = 1, #strA do
        if string.sub(strA, i, i) ~= string.sub(strB, i, i) then
            c = c + 1
        end
    end
    return c
end

local min = #smallString
for i = 1, #bigString - #smallString + 1 do
    local d = differenceCount(string.sub(bigString, i, i + #smallString - 1), smallString)
    if d < min then
        min = d
    end
end

print(min)

Measured memory_bytes: 2712
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();
        if (a < b) { 
            if(b < c){
                System.out.printf("%d %d %d\n", a, b, c);
            }else if(b > c){
                if(a < c){
                    System.out.printf("%d %d %d\n", a, c, b);
                }else{
                    System.out.printf("%d %d %d\n", c, a, b);
                }
            }else{
                System.out.printf("%d %d %d\n", a, b, c);
            }
        } else if (a == b){
            if(a < c){
                System.out.printf("%d %d %d\n", a, b, c);
            }else if(a > c){
                System.out.printf("%d %d %d\n", c, a, b);
            }else{
                System.out.printf("%d %d %d\n", a, b, c);
            }
        } else {
            if(a < c){
                System.out.printf("%d %d %d\n", b, a, c);
            }else if(a > c){
                if(b < c){
                    System.out.printf("%d %d %d\n", b, c, a);
                }else{
                    System.out.printf("%d %d %d\n", c, b, a);
                }
            }else{
                System.out.printf("%d %d %d\n", b, a, c);
            }
        }
        sc.close();
    }
}


Measured memory_bytes: 26384