akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int lengthS, lengthT = 0;                         //integer
static const int maxLengthS = 10000;
static const int maxLengthT = 500;
int ArrayS[maxLengthS], ArrayT[maxLengthT];      //Array
 
void NG(void)
{
    cout << "Invalid value!!" << endl;
    return;
}
 
void inputData(int *Array, int length, int maxLength)
{
    if(length > maxLength)
    {
        NG();
        return;
    }
      
    for(int i = 0; i < lengthS; i++)
    {
        cin >> Array[i];
    }
    return;
}
  
bool linearSearch(int *Array, int target, int key)
{
    bool result = false;
    for(int targetS = 0; targetS < target; targetS++)
    {
        if(Array[targetS] == key)
        {
            result = true;      //target found
            break;
        }
    }
    return result;
}
  
int main(void)
{
    //Input Data
    cin >> lengthS;       //Number of enter into ArrayS
    inputData(ArrayS,lengthS,maxLengthS);
      
    cin >> lengthT;       //Number of enter into ArrayT
    inputData(ArrayT,lengthT,maxLengthT);
      
    //Search
    int count = 0;
    for(int targetT = 0; targetT < lengthT; targetT++)
    {
        bool result = linearSearch(ArrayS, lengthS, ArrayT[targetT]);
        if(result == true)
        {
            count++;
        }
    }
      
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3132
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    n = I()
    S = LI()

    def merge_cnt(A, left, mid, right):
        L = A[left:mid]
        R = A[mid:right]
        L.append(INF)
        R.append(INF)
        i = 0
        j = 0
        cnt = 0
        for k in range(left, right):
            if L[i] <= R[j]:
                A[k] = L[i]
                i += 1
            else:
                A[k] = R[j]
                cnt += (mid - left) - i
                j += 1
        return cnt

    def rec(A, left, right):
        if left+1 < right:
            mid = (left+right)//2
            l_cnt = rec(A, left, mid)
            r_cnt = rec(A, mid, right)
            m_cnt = merge_cnt(A, left, mid, right)
            return l_cnt+r_cnt+m_cnt
        else:
            return 0

    print(rec(S, 0, n))

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 28352
/**
 *    author:  itmo1
 *    created: 21.08.2016 15:05:23       
**/
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(),a.end()
#define pw(x) (1LL<<(x))

using namespace std;

typedef long long ll;
typedef double dbl;
typedef vector<int> vi;
typedef pair<int, int> pi;

const int inf = 1.01e9;
const dbl eps = 1e-9;

/* --- main part --- */

const int N = 1e5 + 10;

int a[N];


int main()
{
    #ifdef home
        assert(freopen("1.in", "r", stdin));
        assert(freopen("1.out", "w", stdout));
    #endif
    int n;
    scanf("%d", &n);
    forn(i, n) scanf("%d", a + i);
    ll res = 0;
    forn(i, n)
    {
        int cnt = max(0, (a[i] - 1) / 2);
        res += cnt;
        a[i] -= cnt * 2;
    }
    forn(i, n)
    {
        if (a[i] == 2)
        {
            res++;
            a[i] = 0;
        }
        else if (a[i] == 1 && a[i + 1] >= 1)
        {
            res++;
            a[i] = 0;
            a[i + 1]--;
        }
    }
    printf("%lld\n", res);
    #ifdef home
        eprintf("time = %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
    #endif
    return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		String s =sc.next();
		sc.close();
		int s_length =s.length();
		for (int i=0;i<s_length;i++){
			System.out.print("x");
		}
		//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
}


Measured memory_bytes: 23508
#include <stdio.h>

int main(void)
{
    int a[5];
    int i, j;
    int tmp;
    
    for (i = 0; i < 5; i++){
        scanf("%d", &a[i]);
    }
    
    for (i = 0; i < 4; i++){
        for (j = 4; j > i; j--){
            if (a[j] > a[j - 1]){
                tmp = a[j];
                a[j] = a[j - 1];
                a[j - 1] = tmp;
            }
        }
    }
    
    for (i = 0; i < 4; i++){
        printf("%d ", a[i]);
    }
    
    printf("%d\n", a[i]);
    return (0);
}

Measured memory_bytes: 596
import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {
    static public class pair {
        int u;
        int idx;
        int val;

        public pair(int x, int i) {
            u = x;
            idx = i;
            val = -1;
        }
    }



    static ArrayList<pair>[] adj;
    static int[] Arr, Arry;
    static int inf = (int) 1e9,n;
    static boolean[][] matrix;
    static long[][] memo;
    static long mod = 998244353;

    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        long h=sc.nextLong();
        long w=sc.nextLong();
        long area=h*w;
        if(h==1||w==1){
            pw.println(1);
            
        }else {
            if (area % 2 == 0) {
                area /= 2;
            } else {
                area /= 2;
                area++;
            }
            pw.println(area);
        }
        pw.close();
    }

    public static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(String s) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(s));

        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException, IOException {
            return br.ready();
        }

    }
}


Measured memory_bytes: 21204
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		String S = sc.next();
		sc.close();
		char[] c = new char[N];

		for (int i = 0; i < N; i++) {
			c[i] = S.charAt(i);
		}
		if (c[K - 1] == 'A') {
			c[K - 1] = 'a';
		}
		if (c[K - 1] == 'B') {
			c[K - 1] = 'b';
		}
		if (c[K - 1] == 'C') {
			c[K - 1] = 'c';
		}
		for (int i = 0; i < N; i++) {
			System.out.print(c[i]);
		}
	}
}


Measured memory_bytes: 20820
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
vector<string> board;
ll h,w;

bool isvm(ll r,ll c){
    if(r<0||r>=h||c<0||c>=w){
        return false;
    }
    return true;
}

int main(){
    cin >> h >> w;
    vector<string> board(h);
    rep(i,h) cin >> board.at(i);
    vector<vector<ll>> dp(h,vector<ll>(w,INF));
    dp.at(0).at(0) = 0;

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(i==0 && j==0) continue;
            ll uptodown=INF,lefttoright=INF;
            if(isvm(i-1,j)){
                if(board.at(i-1).at(j) != board.at(i).at(j)){
                    uptodown = dp.at(i-1).at(j) + 1;
                }else{
                    uptodown = dp.at(i-1).at(j);
                }
            }
            if(isvm(i,j-1)){
                if(board.at(i).at(j-1) != board.at(i).at(j)){
                    lefttoright = dp.at(i).at(j-1) + 1;
                }else{
                    lefttoright = dp.at(i).at(j-1);
                }
            }                                    
            dp.at(i).at(j) = min(uptodown,lefttoright);
        }
    }
    if(board.at(0).at(0)=='.'){
        cout << (dp.at(h-1).at(w-1)+1)/2<< endl;
    }else{
        cout << (dp.at(h-1).at(w-1)+2)/2 << endl;
    }

}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    
    int num,accept[100];
    int cnt,max;
    
    max=0;
    
    cin>>num;
    
    for(int i=0;i<num;i++){
        cin>>accept[i];
    }
    
    for(int i=1;i<=100;i++){
        cnt=0;
        for(int j=0;j<num;j++){
            if(i<=accept[j]){
                cnt++;
            }
        }
        if(cnt>=i&&max<i){
            max=i;
        }
    }
    
    cout<<max<<endl;
}



Measured memory_bytes: 3108
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
VI e[SIZE];
int step0[SIZE];
void dfs0(int x,int lt,int v){
    step0[x]=v;
    for(int y:e[x]){
        if(lt==y)continue;
        dfs0(y,x,v+1);
    }
}
int an;
void dfs1(int x,int lt,int v){
    if(v>=step0[x]){
        an=max(an,v);
        return;
    }
    an=max(an,step0[x]);
    for(int y:e[x]){
        if(lt==y)continue;
        dfs1(y,x,v+1);
    }
}
int main(){
    int N,u,v;
    R(N,u,v);
    REPP(i,1,N){
        int x,y;
        R(x,y);
        e[x].PB(y);
        e[y].PB(x);
    }
    dfs0(v,v,0);
    dfs1(u,u,0);
    an--;
    W(an);
    return 0;
}


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

using namespace std;

#define inti long long int

int main()
{
    inti i,j,k,n,m,x,y,z;
    inti animals,legs;
    cin>>animals>>legs;
    for(i=0;i<=animals;i++){
        if(i*2+(animals-i)*4==legs){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    
    

    return 0;
}


Measured memory_bytes: 3616
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
const int MOD = 1e9 + 7;
int main()  {
    int n;
    scanf("%d",&n);
    if(n/100==n%10) printf("Yes\n");
    else printf("No\n");
    return 0;
}

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

using namespace std;

typedef long long ll;
#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const ll MAX_N = 1e5 + 1;

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

  LCIN(N);

  ll ans = 0ll;
  REP(i, MAX_N) {
    if (i * i <= N) ans = i * i;
    else break;
  }
  cout << ans << endl;

  return 0;
}



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

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

    ll a,b,c,k;
    cin >> a >> b >> c >> k;

    ll ca = 0;
    ll cc = 0;

    while(b<=a){
        b *= 2;
        ca++;
    }

    // cout << b << "\n";

    while(c<=b){
        c *= 2;
        cc++;
    }

    // cout << ca << "," << cc;

    if(ca+cc <= k){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}

Measured memory_bytes: 3528
#include <iostream>

int gcd(int a,int b){
 int r=a%b;
 while(r!=0){
  a=b;
  b=r;
  r=a%b;
 }
 return b;
}

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

 long long ans=0;
 for(int i=1;i<=K;i++){
  for(int j=1;j<=K;j++){
   for(int k=1;k<=K;k++){
    ans+=gcd(gcd(i,j),k);
   }
  }
 }

 std::cout<<ans;
 return 0;
}

Measured memory_bytes: 3620
import sys
input = sys.stdin.readline

n = int(input())
h = list(map(int, input().split()))

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

print(dp[n-1])

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

int main(){
  string s;
  cin >> s;
  if(s=="Sunny") cout << "Cloudy" << endl;
  else if(s=="Cloudy") cout << "Rainy" << endl;
  else cout << "Sunny" << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s = readline().rstrip().decode()
mod = 10 ** 9 + 7
ans = [0] * 13
ans[0] = 1
for check in s:
    dp = [0] * 13
    for i in range(13):
        dp[(i * 10) % 13] = ans[i] % mod
    dp += dp
    for i in range(13):
        if check == '?':
            ans[i] = sum(dp[i + 4:i + 14])
        else:
            ans[i] = dp[i - int(check)]
print(ans[5] % mod)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define INF 10000000000000
#define MOD 1000000007LL
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
// input vector
template<typename T>
void invec(vector<T> &A){for(T& a : A) cin >> a;}


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

int N; cin >> N;
VP red(N), blue(N);
rep(i, 0, N) cin>> red[i].second >> red[i].first;
rep(i, 0, N) cin>> blue[i].first >> blue[i].second;
sort(ALL(red), greater<PII>());
sort(ALL(blue));

vector<bool> usedred(N, false);
rep(i, 0, N){
    rep(j, 0, N){
        if (red[j].first < blue[i].second && red[j].second < blue[i].first){
            if (!usedred[j]) {
                usedred[j] = true;
                break;
            }
        }
    }
}
cout << accumulate(ALL(usedred), 0) << endl;
}
// 書いて考える．場合分け
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 256
n,m = map(int,input().split())
m = min(m,5)
Sum = 0

x = 1900*m + 100*(n-m) #一回の実行にかかる時間
p = 1/(2**m) #すべてのケースに正解する確率

#確率ｐで成功する事象を成功するまで続けたとき、続けることになる回数の期待値は1/pである
#この問題の期待値＝（提出1回目の時間の総和）×　期待値より、y = x * (1/p)がなりたつ
print(int(x//p))

Measured memory_bytes: 2940
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans;
    bool flag=true;
    char a,b;//,c
    string s;
    cin >>s;
    a=s.back();
    cin >>s;
    flag=(a==s[0]);
    b=s.back();
    cin >>s;
    flag=flag&&(b==s[0]);
    

    {
        if(flag)cout <<"YES"<<endl;
        else cout <<"NO"<<endl;
    }

    dbg cout <<ans<<endl;

    return 0;

}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args){
	BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
	try {
	    String st;
	    while((st=sc.readLine())!=null){
		String[] sp = st.split(" ");
		int p = Math.max(Integer.valueOf(sp[0]),Integer.valueOf(sp[1]));
		int q = Math.min(Integer.valueOf(sp[0]),Integer.valueOf(sp[1]));
		while(q!=0){
		    int a = p;
		    p = q;
		    q = a%q;
		}
		System.out.println(p);
	    }
	}catch(Exception e){
	    System.out.println("Error");
	}
    }
}

Measured memory_bytes: 16984
def main():
    args = input().rstrip().split(' ')
    N = [val for val in args[0]]
    flag = False
    for val in N:
        if(val == '7'):
            flag = True
            break
    if(flag):
        print('Yes')
    else:
        print('No')
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 9116
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
a = [0]*4
for i in range(n):
    a[0] += abs(x[i]-y[i])
    a[1] += abs(x[i]-y[i])**2
    a[2] += abs(x[i]-y[i])**3
    a[3] = max(a[3],abs(x[i]-y[i]))
a[1] = a[1]**(1/2)
a[2] = a[2]**(1/3)
for i in range(4):
    print('%f' % a[i])


Measured memory_bytes: 5644
#include<iostream>
#include<stdio.h>

using namespace std;
int main() {
	int n, i=1, x=0;
	cin >> n;
	while(i <= n) {
		x = i;
		if (x % 3 == 0) {
			cout << " " << i;
		}
		else{
			while (x) {
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}
					x /= 10;
			}
		}
		i++;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

vector<vector<int>> dp(11, vector<int>(1e6, 1e8));

int main() {
    int d, g;
    cin >> d >> g;
    g /= 100;
    vector<int> p(d);
    vector<int> c(d);
    rep(i, d) cin >> p[i] >> c[i];
    dp[0][0] = 0;
    rep(i, d) {
        rep(j, 1e6) {
            rep(k, p[i]) {
                if ( dp[i][j] == 1e8 ) continue;
                dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
                if ( k == p[i] - 1 ) {
                    if ( j + (k+1) * (i+1) + c[i] / 100 < 1e6 ) {
                        dp[i+1][j+(k+1)*(i+1)+c[i]/100] = min(dp[i+1][j+(k+1)*(i+1)+c[i]/100], dp[i][j] + k+1);
                    }
                }
                else if ( k < p[i] - 1 ) {
                    if ( j + (k+1) * (i+1) < 1e6 ) {
                        dp[i+1][j+(k+1)*(i+1)] = min(dp[i+1][j+(k+1)*(i+1)], dp[i][j] + k+1 );
                    }
                }
            }
        }
//        cout << i << endl;
    }   
//    rep(i, d+1) {
//        for ( int j = 10; j < 30; j++ ) {
//            if ( dp[i][j] == 1e8 ) printf("%3d ", -1);
//            else                   printf("%3d ", dp[i][j]);
//        }
//        cout << endl;
//    }
    int ans = 1e8;
    for ( int i = g; i < 1e6; i++ ) {
        if ( dp[d][i] == 1e8 ) continue;
        ans = min(ans, dp[d][i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 47104
N = int(input())
currentTime = 0
current = [0, 0]
for i in range(N):
    timeStamp = list(map(int, input().split()))
    reqLen = abs(timeStamp[1] - current[0]) + abs(timeStamp[2] - current[1])
    timeLen = timeStamp[0] - currentTime
    if reqLen > timeLen:
        print("No")
        exit()
    if reqLen % 2 != timeLen % 2:
        print("No")
        exit()
    currentTime = timeStamp[0]
    current = timeStamp[1:]
print("Yes")


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define INF 10000000

//🔴

int prim(int v, vector<vector<pair<int, int> > > adjlist){

    priority_queue<pair<int, int> >  wait;    // first := 候補辺のコスト   second　:= 行先ノード
    vector<int> result(v, INF);               // 頂点iと木の間の最小コスト
    int ans = 0, size = 0;                    // 木のコスト　頂点数

    //初期条件
    result[0] = 0;
    wait.push(make_pair(0, 0));

    while(!wait.empty() && size < v){

        //候補辺のうち最小のものを取り出す
        int newpoint = wait.top().second;
        int newcost = -wait.top().first;
        wait.pop();

        if(result[newpoint] < newcost) continue;

        //出てきた頂点を木に追加
        ans += newcost;
        result[newpoint] = -INF;
        size++;

        // 新しい点から出ている辺をすべてなめる
        for(int i = 0; i < adjlist[newpoint].size(); i++){
            int nextpoint = adjlist[newpoint][i].second;
            int nextcost = adjlist[newpoint][i].first;
            //より木に近くなった頂点があれば,　そこへの枝をqueueに追加
            if(result[nextpoint] > nextcost){
                result[nextpoint] = nextcost;
                wait.push(make_pair(-nextcost, nextpoint));
            }
        }
    }

    return ans;
}


int main(){

    int V, E; cin >> V >> E;                          // V:= 頂点の数    E:= 辺の数 
    vector<vector<pair<int, int> > > adjlist(V);      //first := コスト　second := 行先

    //入力
    for(int i = 0; i < E; i++){
        int a, b, c; cin >> a >> b >> c;              // a ,b 間に コスト c の辺がある
        adjlist[a].push_back(make_pair(c, b));
        adjlist[b].push_back(make_pair(c, a));      
    }

    int ans = prim(V, adjlist);

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


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

using namespace std;

int main() {
	
	string t1, t2;

	while (cin >> t1 >> t2 && t1 != "0" && t2 != "0") {

		int h = 0, b = 0;

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {

				if (t1[i] == t2[j] && i == j)
					h++;

				else if (t1[i] == t2[j] && i != j)
					b++;
			}
		}

		cout << h << " " << b << "\n";
		
	}

	return 0;

}







Measured memory_bytes: 3160
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>
#include <map>
#include <set>
#include <stack>
#include <deque>

#define INF 1000000000;
#define MOD 1000000007;
#define LIMIT 1000000000000000000;
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

int main()
{
    int n; cin >> n;
    cout << 24 + (24 - n) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static boolean isOk(long n, long k) {
        while (n % k == 0) {
            n = n / k;
        }
        return n % k == 1;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        // nがkで割り切れるとき
        int ans = 1;  // n = k の場合のぶん
        for (long k = 2; k * k <= n; k++) {
            if(n % k == 0){
                if (isOk(n, k)) {
                    ans++;
                }
                // n/kもnの約数なので同時に計算
                if (n/k != k && isOk(n, n/k)){
                    ans++;
                }
            }
        }
        // nがkでわり切れない時
        if (n > 2){
            ans++;  // k = n - 1の場合のぶん
            for (long k = 2; k * k <= n-1; k++) {
                if ((n - 1) % k == 0) {
                    ans ++;
                    // (n-1)/kもn-1の約数なので同時に計算
                    if ((n - 1) / k != k){
                        ans++;
                    }
                }
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35640
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ss second
#define ff first
vector<ll> adj[100001];ll visited[100001];
ll dp[100001];
void dfs(ll r)
{
    visited[r]=1;
    for(ll i=0;i<adj[r].size();i++)
    {
        if(!visited[adj[r][i]])
        {
            dfs(adj[r][i]);
            
        }
        dp[r]=max(dp[r],1+dp[adj[r][i]]);
    }
}
int main() 
{
    ll n,i,j,k,x,y,w,flag=0,m;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>x>>y;
        adj[x].pb(y);
    }
    memset(visited,0,sizeof(visited));
    memset(dp,0,sizeof(dp));
    for(i=1;i<=n;i++)
    {
        if(!visited[i])
        dfs(i);
    }
    for(i=1;i<=n;i++)
    flag=max(flag,dp[i]);
    cout<<flag;
    return 0;
}


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


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

    int h, w;
    cin >> h >> w;
    ll mod = 1e9 + 7;

    ll ans[1010][1010] = {0};
    ans[1][1] = 1;

    rep(i,h)rep(j,w){
        char t;
        cin >> t;
        if(t=='.'){
            ans[i + 1][j + 2] += ans[i + 1][j + 1];
            ans[i + 2][j + 1] += ans[i + 1][j + 1];
            ans[i + 1][j + 2] %= mod;
            ans[i + 2][j + 1] %= mod;
        }   
    }

    cout << ans[h][w] << endl;

    return 0;
    }


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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <=9; i++) {
    if(n % i == 0 && n / i <= 9 && 1 <= n / i) {
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
  return 0;
}


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

#define rep(ver,n) rep2(ver,0,n)
#define rep2(ver,m,n) for(int ver=m;ver<(n);ver++)
#define loop while(true)
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(v) (v).begin(), (v).end()
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

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

int main(){
  int a;
  
  cin>>a;
  
  
  if(a>=30)cout<<"Yes";
  else cout<<"No";
  
  return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  
	int n, a, b, c, i;
    cin >> n;
  
  	a = n%10;
  	n = n/10;
  	b = n%10;
  	n = n/10;
  	c = n%10;
  
  	if(a==7||b==7||c==7)
      cout << "Yes";
  
  	else
      cout << "No";
  
  	return 0;
}

Measured memory_bytes: 3100
#include <iostream>

using namespace std;

int main() {
	int b[3];
	for (int i = 0; i < 3; ++i) cin >> b[i];
	if ((b[0] & b[1]) || b[2]) cout << "Open" << endl;
	else cout << "Close" <<endl;
	
	return 0;
}


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

int main(){
	string S;
	cin >> S;
	
	if (S[0] == S[1]){
		if (S[2] != S[0]){
			if (S[2] == S[3]){
				cout << "Yes" << endl;
				return 0;
			}else{
				cout << "No" << endl;
				return 0;
			}
		}else{
			cout << "No" << endl;
			return 0;
		}
	}
	
	if (S[0] == S[2]){
		if (S[1] != S[0]){
			if (S[1] == S[3]){
				cout << "Yes" << endl;
				return 0;
			}else{
				cout << "No" << endl;
				return 0;
			}
		}else{
			cout << "No" << endl;
			return 0;
		}
	}
	
	
	if (S[0] == S[3]){
		if (S[1] != S[0]){
			if (S[1] == S[2]){
				cout << "Yes" << endl;
				return 0;
			}else{
				cout << "No" << endl;
				return 0;
			}
		}else{
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "No" << endl;
	
	
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
const ll MAX_N = 2e5+10;
int par[MAX_N];//親
int pank[MAX_N];//木の深さ

//n要素で初期化
void init(int n){
    for(int i=0;i<n;i++){
        par[i]=i;
        pank[i]=0;
    }
}

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

//xとyの属する集合を併合
void unite(int x,int y){
    x = find(x);
    y = find(y);
    if(x==y)return;
    if(pank[x]<pank[y]){
        par[x]=y;
    }else{
        par[y]=x;
        if(pank[x]==pank[y])pank[x]++;
    }
}

//xとyが同じ集合に属するか否か
bool same(int x,int y){
    return find(x)==find(y);
}
int main(void){
    ll n,m;cin>>n>>m;
    init(n);
    rep(i,m){
        ll a,b;cin>>a>>b;a--;b--;
        unite(a,b);
    }
    ll res=0;
    map<ll,ll> mp;
    rep(i,n){
        ll buf=find(i);
        mp[buf]++;
    }
    for(auto& p:mp){
        chmax(res,p.second);
    }
    cout<<res<<endl;
}

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

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

ll ans;
ll D, A;
int N;
vector<pair<ll, ll> > v;
ll S[200005];

int main(void) {
    scanf("%d %lld %lld", &N, &D, &A);
    rep(i, 0, N) {
        ll x, h;
        scanf("%lld %lld", &x, &h);
        v.pb(mp(x, h));
    }

    sort(v.bg, v.en);

    int t = 0;
    for (int s = 0; s < N; s++) {
        if (s == 0) S[s] = 0;
        else S[s] += S[s-1];
        ll x = v[s].first, h = v[s].second;
        h -= S[s];
        if (h <= 0) continue;

        ll c = (h+A-1)/A;
        ans += c;
        S[s] += c*A;

        while (t < N && v[t].first <= 2*D+x) t++;
        if (t < N) S[t] -= c*A;
 
    }

   

    printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 6384
#include<iostream>
#include<string>
using namespace std;
string str;
int main(){
	cin>>str;
	int cur=0;
	int num1=0; int num2=0;
	int len=str.size();
	int ans=0;
	while(cur<len){
		if(str[cur]=='S') num1++;
		if(str[cur]=='T'){
			if(num1>0){
				num1--;
				ans++;
			}
		}
		cur++;
	}
	cout<<len-2*ans<<endl;
	return 0;
} 

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set> 
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <iomanip>
#include <complex>
#define assem99 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ull unsigned long long
#define ld long double
#define ii pair<int, int>
#define pll pair<ll, ll>
#define vii vector<ii>
#define point complex<double>
#define rep(i,a,b) for(int i=a; i<b; i++)
#define F first
#define S second
#define endline '\n'
#define sz(a) (int)(a).size()
#define ReadFile freopen("input.txt","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
int dx[] = { 0, -1, 0, 1, -1, 1, -1, 1 };
int dy[] = { -1, 0, 1, 0, 1, -1, -1, 1 };
const int MOD = 998244353, N = 2e5 + 5;
const double pi = acos(-1);
using namespace std;

int main()
{
	assem99;
	string s, t; cin >> s >> t;
	int ans = 0;
	rep(i, 0, sz(s)) ans += (s[i] != t[i]);
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 3888
#include<iostream>
#include<stdio.h>


using namespace std;

int main(){
    int num,dig,cal,sum = 0;
    scanf("%d",&num);
    cal = num;
    while(cal > 0){
        dig = cal % 10;
        sum = sum + dig;
        cal = (cal - dig) / 10;
    }
    if(num % sum == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
import numpy as np

N, K = map(int, input().split())

d = []
ai = []
count = 0

for i in range(K):
    d.append(int(input()))
    ai.extend(list(map(int, input().split())))

for i in range(N):
    if i + 1 not in ai:
        count += 1

print(count)


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

int main(){
    uint64_t K, A, B;
    uint64_t Answer = 1;

    cin >> K >> A >> B;
    uint64_t counter = 0;
    uint64_t leftK = K; 
    if(A + 2 >= B){
        Answer = K + 1;
        while(true){
        goto label;
        }
    }
    /*while(Answer < B - A){
        Answer += B - 1;
        leftK -= A + 1;
    }
    */
    while(Answer != A){
        Answer++;
      leftK--;
     // cout << "Answer++" << endl;
    }
  //cout << Answer << endl;
    if(leftK % 2 == 1){
        leftK--;
     // cout << "ODD" << endl;
        while(leftK != 0){
            Answer += B - A;
            leftK -= 2;
        }
        Answer++;
    }else{
        while(leftK != 0){
            Answer += B - A;
            leftK -= 2;
        }
    }
    /*for(int i = 0;i < TimestoChangeCookies;i++){
        Answer += B - 1;
        counter++;
    }
    Answer += K - NeedtoChangeCookies * counter;
    */
    label:;
    cout << Answer << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;

    int ans=0;
    if(a+b>2*c){
        if(x>y){
            ans+=y*2*c;
            if(a<2*c){
                ans+=(x-y)*a;
            }else{
                ans+=(x-y)*2*c;
            }
        }else{
            ans+=x*2*c;
            if(b<2*c){
                ans+=(y-x)*b;
            }else{
                ans+=(y-x)*2*c;
            }
        }
    }else{
        ans+=a*x+b*y;
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
    int N;
    cin>>N;
    int d[N];
    for(int i=0;i<N;i++){
        cin>>d[i];
    }
    sort(d,d+N);
    int x=1;
    for(int j=0;j<N-1;j++){
        if(d[j]<d[j+1]){
            x++;
        }
    }
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256
open System

// prelude
let readStr () = stdin.ReadLine()

let readInt () = stdin.ReadLine() |> int
let readInts () = stdin.ReadLine().Split() |> Array.map int

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

let inline memo size f =
  let dp = Array.create size None
  let rec g x =
    match dp.[x] with
    | None ->
      let v = f g x
      dp.[x] <- Some v
      v
    | Some v -> v
  g

// start
let (H, N) = readInts() |> pair
let AB =
  let ab = Array.zeroCreate N
  for i in 0..(N-1) do
    ab.[i] <- readInts() |> pair
  ab

let cost = memo 10009 <| fun cost h ->
  AB 
  |> Array.toSeq
  |> Seq.map (fun (a, b) -> b + if h<=a then 0 else cost (h-a))
  |> Seq.min 

cost H |> printfn "%d"

Measured memory_bytes: 19676
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		System.out.print(S.substring(0,1));
		System.out.print(S.length()-2);
		System.out.print(S.substring(S.length()-1,S.length()));
	}
	public static int sample() {
		return 1;
	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;
vector<string> s(11);

int num1(int ue, int sita, int yoko) {
    int ans = 0;
    for (int i = ue; i <= sita; i++) {
        if (s[i][yoko] == '1') ans++;
    }
    return ans;
}

int main(void) {
    int h, w, k;
    cin >> h >> w >> k;
    rep (i, h) cin >> s[i];

    int ans = 100000000;
    for (int bit = 0; bit < (1 << (h - 1)); bit++) {
        vector<int> Hsakai(1, -1);
        for (int i = 0; i < h - 1; i++) {
            if (bit & (1 << i)) {
                Hsakai.pb(i);
            }
        }
        Hsakai.pb(h - 1);
        
        int yokoAns = 0;
        int szHsakai = Hsakai.size();
        vector<int> menseki(szHsakai - 1, 0);

        //TLE防ぐ
        bool stop = false;
        rep (i, szHsakai - 1) rep (j, w) {
            if (num1(Hsakai[i] + 1, Hsakai[i + 1], j) > k) stop = true;
        }
        if (stop) continue;
        
        for (int sta = 0; sta < w; sta++) {
            rep (i, szHsakai - 1) {
                menseki[i] += num1(Hsakai[i] + 1, Hsakai[i + 1], sta); 
            }
            if (*max_element(rng(menseki)) > k) {
                rep (i, menseki.size()) menseki[i] = 0;
                yokoAns++;
                sta--;
            }
        }
        chmin(ans, szHsakai + yokoAns - 2);
    }

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


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

template<typename F>
struct FixPoint : F{
  FixPoint(F&& f):F(forward<F>(f)){}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const{
    return F::operator()(*this,forward<Args>(args)...);
  }
};
template<typename F>
inline decltype(auto) MFP(F&& f){
  return FixPoint<F>{forward<F>(f)};
}

//INSERT ABOVE HERE
signed main(){
  int n,m;
  cin>>n>>m;
  int h=(1<<n)-1;
  int w=(1<<m)-1;

  int flg=0;
  if(h<w) flg=1,swap(h,w);

  vector<string> st(h,string(w,'0'));

  MFP([&](auto dfs,int L,int R,int k)->void{
        int M=(L+R)>>1;
        for(int i=k;i<=h;i+=k) st[i-1][M]='1';
        if(L+1==R) return;
        dfs(L,M,k*2);
        dfs(M+1,R,k*2);
      })(0,w,1);


  if(flg){
    vector<string> nx(w,string(h,'0'));
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)
        nx[j][i]=st[i][j];
    st=nx;
    swap(h,w);
  }

  for(int i=0;i<h;i++) cout<<st[i]<<endl;
  return 0;
}


Measured memory_bytes: 2304
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();
        System.out.println((A < B && A < C && C < B) || (B < A && B < C && C < A) ? "Yes" : "No");
    }
}


Measured memory_bytes: 21844
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define MAXN 2019
#define LL long long
using namespace std;
int a[MAXN],n;
LL ans;
int cnt[MAXN],b[MAXN];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        cnt[a[i]]++;
    }
    
    for(int i=1;i<=2000;i++)
    {
        b[i]=cnt[i]+b[i-1];
    }
    
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            ans+=b[a[i]+a[j]-1]-b[abs(a[i]-a[j])];
            if(abs(a[i]-a[j])<a[i])ans--;
            if(abs(a[i]-a[j])<a[j])ans--;
        }
    }
    cout<<ans/3<<endl;
    
    return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,m,a,b,z;
    cin>>n>>m;

    vector<int>cost(m+1);
    vector<int>unl[n+1];
    vector<int>mask(m+1);
    for(int i=1; i<=m; i++)
    {
        cin>>a>>b;
        cost[i] = a;
        z = 0;
        for(int j=0;j<b; j++)
        {
            cin>>a;
            z |= (1<<a);
            unl[a].push_back(i);
        }
        mask[i] = z;
    }

    bool f = false;
    for(int i=1; i<=n; i++) if(unl[i].size() == 0) f=1;
    if(f)
    {
        cout<<"-1";
        exit(0);
    }

    map< int , int >dp[n+1];
    for(int x:unl[1])
    {
        if(dp[1].count(mask[x]) == 0) dp[1][mask[x]] = 1000000000;
        dp[1][mask[x]] = min(cost[x], dp[1][mask[x]]);
    }

    for(int i=2; i<=n; i++)
    {
        for(auto x:dp[i-1])
        {
            if((x.first&(1<<i)) == 0)
            {
                for(auto y:unl[i])
                {
                    if(dp[i].count(x.first|mask[y])==0) dp[i][x.first|mask[y]]=100000000;
                    dp[i][x.first|mask[y]] = min(dp[i][x.first|mask[y]], x.second+cost[y]);
                }
            }
            else
            {
                if(dp[i].count(x.first)==0) dp[i][x.first]=100000000;
                dp[i][x.first] = min(dp[i][x.first], x.second);
            }
        }
    }
    int ans = 1e8;
    for(auto x: dp[n])
    {
        ans = min(ans,x.second);
    }
    cout<<ans;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <numeric>
#include <iomanip>

int main(void) {
	int n, m;

	std::cin >> n >> m;

	std::vector<int> x(m);

	for (size_t i = 0; i < m; i++) {
		std::cin >> x[i];
	}

	if (n >= m) {
		std::cout << 0 << std::endl;
		return 0;
	}

	std::sort(x.begin(), x.end());

	std::vector<int> diff;

	for (size_t i = 0; i < m - 1; i++) {
		diff.push_back(x[i + 1] - x[i]);
	}

	std::sort(diff.begin(), diff.end());
	std::reverse(diff.begin(), diff.end());

	long long sum = 0;

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

	std::cout << std::accumulate(diff.begin(), diff.end(), 0LL) - sum << std::endl;


	return 0;
}

Measured memory_bytes: 1276
from collections import defaultdict
def choose2(n):
    return n * (n-1) // 2

n = int(input())
counts = defaultdict(int)

for i in range(n):
    norm = ''.join(sorted(input()))
    counts[norm] += 1

pairs = 0
for c in counts.values():
    if c >= 2:
        pairs += choose2(c)
print(pairs)

Measured memory_bytes: 18236
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  int N;
  while(cin >> N){
    vector<string> s(N);
    vector<int> t(N);
    REP(i,N) cin >> s[i] >> t[i];
    string x; cin >> x;

    int k = find(ALL(s), x) - s.begin();

    int ans = 0;

    FOR(i,k+1,N) ans += t[i];


    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a[3][200];
	for(int i=0;i<=2;i++)
		for(int j=0;j<=199;j++)
			a[i][j]=0;
	int n;
	cin>>n;
	for(int i=1;i<=2;i++)
		for(int j=1;j<=n;j++)
			cin>>a[i][j];
	for(int i=1;i<=n;i++)
		a[1][i]+=a[1][i-1];
	for(int i=1;i<=n;i++)
	{
		a[2][i]=max(a[2][i],max(a[1][i]+a[2][i],a[2][i-1]+a[2][i]));
	}
	cout<<a[2][n]<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm> 

using namespace std;

int main()
{
	int n,k,a = 1;
	while(~scanf("%d %d",&n,&k))
	{
		for(int i = 0; i < n; i++)
		{
			if(2 * a > a + k)
			{ 
				a = a + k;
			}
			else 
			{
				a = 2 * a;
			}
		}
		printf("%d",a);	
	}
	return 0;
}


Measured memory_bytes: 128