akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define DBG(x) cout<<"# # #     "<<x<<'\n';
#define fri(i,s,n) for(long long i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define infy 2e18
#define five 100005;
#define six 1000005;
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//___________________________________________________________________________________________________________________________________________________________
/*
x = kx + y + z + o;
x = ky+kz+k2x;
x = y(1+k+k2+k3+k4.......)+z(1+k+k2+k3+k4+k5.........)+o(1+k+k2+k3+k4+k5.........)
x = (y+z+o)*(1/(1-k));
*/
int n;
ld dp[301][301][301];
ld f(int i,int j,int k)
{
       if(j<0 || i<0 || k<0){return 0;}
       if(i==0 && j==0 && k==0){return 0;}
       if(dp[i][j][k] >= 0){return dp[i][j][k];}
       dp[i][j][k] = (ld)n/(ld)(i+j+k);
       dp[i][j][k] += (ld)i/(ld)(i+j+k)*f(i-1,j,k);
       dp[i][j][k] += ((ld)j/(ld)(i+j+k))*f(i+1,j-1,k);
       dp[i][j][k] += (ld)k/(ld)(i+j+k)*f(i,j+1,k-1);
       return dp[i][j][k];
}
int main(){
       memset(dp,-1,sizeof dp);
       cin>>n;
       map<int,int> mp;
       fri(i,0,n){
              int xx;
              cin>>xx;
              mp[xx]++;
       }
       cout<<setprecision(20)<<f(mp[1],mp[2],mp[3])<<endl;
}


Measured memory_bytes: 426496
#!/usr/bin/env python3
import sys

def main():
    input = sys.stdin.readline
    s = input().rstrip()
    t = input().rstrip()
    
    ans = float("INF")
    for start in range(len(s) - len(t) + 1):
        cnt = 0
        for char in range(len(t)):
            if s[start + char] != t[char]:
                cnt += 1
        ans = min(ans, cnt)
    
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 73288
#include <climits>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <vector>

template<typename T>
using max_heap = std::priority_queue<T, std::vector<T>, std::less<T>>;

template<typename T>
using min_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;


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

   int arr[3 * n];
   for (int i = 0; i < 3 * n; ++i) {
      std::cin >> arr[i];
   }

   min_heap<int> izq;
   long long actual_izq = 0, suma_izq[3 * n];
   for (int i = 0; i < 3 * n; ++i) {
      if (izq.size( ) == n && arr[i - 1] > izq.top( )) {
         actual_izq -= izq.top( );
         izq.pop( );
      }
      if (izq.size( ) != n && i != 0) {
         izq.push(arr[i - 1]);
         actual_izq += arr[i - 1];
      }
      suma_izq[i] = (izq.size( ) == n ? actual_izq : -1);
   }

   max_heap<int> der;
   long long actual_der = 0, suma_der[3 * n];
   for (int i = 3 * n - 1; i >= 0; --i) {
      if (der.size( ) == n && arr[i] < der.top( )) {
         actual_der -= der.top( );
         der.pop( );
      }
      if (der.size( ) != n) {
         der.push(arr[i]);
         actual_der += arr[i];
      }
      suma_der[i] = (der.size( ) == n ? actual_der : -1);
   }

   long long res = LLONG_MIN;
   for (int i = 0; i < 3 * n; ++i) {
      if (suma_izq[i] != -1 && suma_der[i] != -1) {
         res = std::max(res, suma_izq[i] - suma_der[i]);
      }
   }

   std::cout << res << "\n";
}


Measured memory_bytes: 7160
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <regex>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template

signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cini(N);
    int a = N%10;
    if(a==2||a==4||a==5||a==7||a==9){
        cout << "hon" << nn;
    }else if(a==0 || a==1 || a==6|| a==8){
        cout << "pon" << nn;
    }else{
        cout << "bon" << nn;
    }
    return 0;
}

Measured memory_bytes: 3092
/*input

*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define ld long double
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


ll power(ll a,ll m,ll mod){
    ll ans=1;
    while(m){
        if(m%2){
            ans*=a;
            ans%=(mod);
        }
        a=(a*a)%(mod);
        m>>=1;
    }
    return ans;
}


void init(ll* a,ll n,ll val){
    for(ll i=0;i<n;i++)
        a[i]=val;
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL); 
    ll t=1,i,j,i1,j1,k1;
    ll h,w,k;
    cin>>h>>w>>k;
    char ch;
    ll a[h][w];
    rep(i,0,h)rep(j,0,w)cin>>ch,a[i][j]=ch-'0';
    ll ans=(w-1)+(h-1);
   // cout<<ans<<endl;
    ll b[12]={0},c[12];
    rep(i,0,(1<<(h-1))){
        t=0,k1=0;
        ll bl=1;
        init(b,11,0);
        rep(i1,0,w){
            k1=0;
            init(c,12,0);
            rep(j1,0,h){
                b[k1]+=a[j1][i1];
                c[k1]+=a[j1][i1];
                if(c[k1]>k){bl=0;break;}
                if((1<<j1)&i)k1++;
            }
            if(!bl)break;
            rep(k1,0,11){
                if(b[k1]>k){
               //     cout<<i<<" "<<k1<<" "<<endl;
                    t++;
                    break;
                }
            }
            if(k1!=11){
                rep(k1,0,11)b[k1]=c[k1];
            }
        }
        if(!bl)continue;
        rep(i1,0,h){
            if(i&(1<<i1))t++;
        }
        
        if(t<ans){
            ans=min(t,ans);
           // cout<<t<<i<<endl;
        }
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 384
import java.awt.Point;
import java.util.ArrayDeque;
import java.util.Scanner;
import java.util.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.util.Collection;


 
public class Main{
	
        static final Scanner sc=new Scanner(System.in);
        
        
        
        
        
        
        public static void main(String[]args){
                int N=sc.nextInt();
                int[]A=new int[N];
                for(int i=0;i<N;i++){
                        A[i]=sc.nextInt();
                }
                int max=0;
                Arrays.sort(A);
                max=Math.abs(A[0]-A[N-1]);
                System.out.println(max);

        }
        
        
        

		
	
}


Measured memory_bytes: 21844
#include <stdio.h>

int main(void){
  int a[6];
  
  for(int i = 0;i < 6;i++) scanf("%d",&a[i]);

  int counter[4] = {0,0,0,0};

  for(int i = 0;i < 6;i++){
    counter[a[i]-1]++;
  }

  for(int i = 0;i < 4;i++){
    if(counter[i] >= 3){
      printf("NO\n");
      return 0;
    }
  }

  printf("YES\n");

  return 0;
}

Measured memory_bytes: 128
from itertools import permutations
a = [int(input()) for i in range(5)]
p = permutations(a,5)
ans = 10**9
for l in p:
    now = 0
    for i,item in enumerate(l):
        if i == 4:
            now += item
        else:
            now += item + int(bool(item%10))*10 - item%10
    ans = min(ans,now)
print(ans)


Measured memory_bytes: 9124
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

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

	private void solve() {
		// 入力
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		sc.close();

		// 計算
		int max = 0;
		for (int i = 1; i < N; i++) {
			int count = countDuplicationCharacterTypes(S, i);
			if (count > max) {
				max = count;
			}
		}

		// 出力
		System.out.println(max);

		return;
	}

	private int countDuplicationCharacterTypes(String S, int i) {
		String X = S.substring(0, i);
		String Y = S.substring(i);
		HashSet<String> mapX = new HashSet<String>(Arrays.asList(X.split("")));
		mapX.addAll(Arrays.asList(X.split("")));
		mapX.remove("");
		int count = 0;
		for (String charX : mapX) {
			if (Y.contains(charX)) {
				count++;
			}
		}
		return count;
	}
}


Measured memory_bytes: 23636
/*
 * ITP1_5A.c
 *
 *  Created on: 2016/05/28
 *      Author: TakaakiShogaki
 */

#include<stdio.h>

int main(){
	int H,W,i,j;

	while(1){
		scanf("%d %d",&H,&W);
		if(H==0 &&W==0)
			break;
		for(i=0;i<H;i++){
            if(i==0 ||i==H-1){
                for(j=0;j<W;j++)
                    printf("#");
            }
            else{
                printf("#");
                for(j=1;j<W-1;j++)
                    printf(".");
                printf("#");
            }
			printf("\n");
		}
		printf("\n");
	}
return 0;
}

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

using namespace std;

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

#define rep(i,n) for(int i=0; i<(int)(n); i++)
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; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  vector<int> d(n);
  rep(i, n) cin >> d[i];
  sort(d.begin(), d.end());
  int p = d[n/2-1];
  int q = d[n/2];
  cout << q-p << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
long long g[20][20];
long long a[500][500];
int main()
{     long long n,m,i,j,k,sum=0;
      cin>>n>>m;
      for(i=0;i<=9;i++)
         for(j=0;j<=9;j++){
         	long long x;
         	cin>>x;
         	g[i][j]=x;
         }
      for(k=0;k<=9;k++)
         for(i=0;i<=9;i++)
            for(j=0;j<=9;j++)
              g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
      for(i=1;i<=n;i++)
         for(j=1;j<=m;j++){
         	long long x;
         	cin>>x;
         	//cout<<g[x][1]<<endl;
         	if(x!=1||x!=0)sum+=g[x][1];
         }
      cout<<sum<<endl;
	  return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N = int(input())
ans = 0
L = list(map(int,input().split()))
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            l1 = L[i]
            l2 = L[j]
            l3 = L[k]
            if l1 == l2 or l2 == l3 or l3 == l1:
                continue
            if abs(l1-l2) < l3 and l3 < l1+l2:
                ans += 1
print(ans)
        


Measured memory_bytes: 10584
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n)         for(int i=0; i<(n); i++)
#define P pair<int, int>
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"

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

int main(){
    string s; cin >> s;
    char c = s[s.size()-1];
    if(c == '2' || c == '4' || c == '5' || c == '7' || c == '9'){
        cout << "hon" << endl;
    }else if(c == '3'){
        cout << "bon" << endl;
    }else{
        cout << "pon" << endl;
    }
    
}

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

vector<int> dist;
vector<int> pre;
queue<int> que;
bool can = false;

void bfs(vector<vector<int>> &g) {
    while (!que.empty()) {
        int v = que.front();
        que.pop();

        for(auto nv : g[v]) {
            if(dist[nv] != 0) continue;
            dist[nv] = dist[v] + 1;
            pre[nv] = v;
            que.push(nv);
        }
    }
}

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n, vector<int>(0));
    vector<int> d;
    rep(i,m) {
        int a, b;
        cin >> a >> b;
        g[a-1].push_back(b-1);
        g[b-1].push_back(a-1);
    }

    dist.assign(n,0);
    pre.assign(n,0);
    que.push(0);

    bfs(g);

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


Measured memory_bytes: 10600
def sum_dig(num):
    nsum = 0
    while(num):
        dig = num % 10
        nsum = nsum + dig
        num = num // 10
#        print (dig,sum,num)
    return nsum


lim, nmin, nmax = map(int, input().split(" "))
chk_sum = 0
for i in range(1,lim+1) :
    chk = sum_dig(i)
#    print(chk,type(chk))
    if (chk >= nmin and chk <= nmax) :
        chk_sum += i

print (chk_sum)


Measured memory_bytes: 3060
#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
using namespace std;
typedef long long LL;
LL A,B,C,a,b,c,ans;
int main()
{
	scanf("%lld %lld %lld",&A,&B,&C);
	if ((A & 1)||(B & 1)||(C & 1))
		{
			puts("0");
			return 0;
		}
	if (A == B||B == C||C == A)
		{
			puts("-1");
			return 0;
		}
	ans = 0;
	while (!(A & 1)&&!(B & 1)&&!(C & 1))
	{
		LL a = (B + C) >> 1,b = (A + C) >> 1,c = (B + A) >> 1;
		//cout<<a<<" "<<b<<" "<<c<<endl;
		A = a; B = b; C = c;
		++ans;
		
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Data.List
import Data.Maybe
import Data.Function (fix)
import Data.Array (Array, array, (!))
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8

modular :: Integer
modular = 1000000007
 
getInts :: IO [Int]
getInts = (map parseInt . BS8.words) <$> BS.getLine 
    where parseInt = fst . fromJust . BS8.readInt

getIntegers :: IO [Integer]
getIntegers = (map parseInteger . BS8.words) <$> BS.getLine 
    where parseInteger = fst . fromJust . BS8.readInteger

solve :: Integer -> Integer -> Integer
solve 0 m = m `div` 4
solve n m
    | m >= n * 2 = n + solve 0 (m - n*2)
    | otherwise = m `div` 2

main :: IO ()
main = do
    [n, m] <- getIntegers
    print $ solve n m

Measured memory_bytes: 380
package main

import (
	"fmt"
	"strings"
)

func main() {
	var H, W int
	fmt.Scan(&H, &W)
	var a string
	fmt.Println(strings.Repeat("#", W+2))
	for i := 0; i < H; i++ {
		fmt.Scan(&a)
		fmt.Println("#" + a + "#")
	}
	fmt.Println(strings.Repeat("#", W+2))
}


Measured memory_bytes: 640
from collections import Counter

if __name__ == '__main__':
    N = int(input())
    a = list(map(int, input().split()))

    counter = Counter(a)
    ans = 0
    for ele, count in counter.items():
        if ele < count:
            ans += count - ele
        elif count < ele:
            ans += count

    print(ans)


Measured memory_bytes: 18672
import java.util.Scanner;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {

        int r = sc.nextInt();
        int d = sc.nextInt();
        int x = sc.nextInt();

        for (int i =0; i < 10; i++) {
            x = r * x - d;
            System.out.println(x);
        }

    }
}


Measured memory_bytes: 24020
S = input()

num = 0
for i in range(2**(len(S)-1)):
  plus = list(" " * (len(S)-1))
  indx = bin(i)[2:].zfill(len(S)-1)
  for ind in range(len(indx)):
    if indx[ind] == "1": plus[ind] = "+"
  formula = S[0]
  for j in range(len(S)-1):
    if plus[j] == " ":
      formula += S[j+1]
    else:
      formula += "+" + S[j+1]
  num += eval(formula)
print(num)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

int main() {

	char S[6];

	cin >> S;

	if (S[2] == S[3] && S[4] == S[5]) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int main()
{
    int N;
    cin >> N;
    vll A(N);
    cin >> A;
    sort(A.begin(),A.end(),greater<ll>());
    map<ll,ll> cnt;
    for(auto a:A){
        cnt[a]++;
    }
    vll ans;
    for(auto p:cnt){
        if(p.second >= 2){
            ans.pb(p.first);
            if(p.second >= 4){
                ans.pb(p.first);
            }
        }
    }
    sort(ans.begin(),ans.end(),greater<ll>());
    if(ans.size() < 2){
        cout << 0 << endl;
    }else{
        cout << (ans[0]*ans[1]) << endl;
    }
}

Measured memory_bytes: 10200
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define rFORq(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int x; SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long x; SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
////////////////////////////////////////////////////////////////////
int main(){
    int N,M; SCD2(N,M);
    vector<PII> ab;
    REP(i,M){
        int a,b;
        SCD2(a,b);
        if (a>b) swap(a,b);
        if (a != 1){
            ab.PB(MP(1,a));
            ab.PB(MP(1,b));
        }else{
            ab.PB(MP(1,b));
        }
    }
    
    sort(ab.begin(),ab.end());

    vector<int> U;	
    int count = 1;
    REP(i,ab.size()-1){
        if (ab[i] == ab[i+1]){
            count++;
        }else{
            U.PB(count);
            count = 1;
        }
    }

    U.PB(count);

    bool ans = true;
    REP(i,U.size()){
        if (U[i] % 2 == 1) ans = false;

    }

    if (ans) printf("YES\n");
    else printf("NO\n");
}

Measured memory_bytes: 2672
from collections import Counter
N, K = map(int, input().split())
c = Counter()
for _ in range(N):
    a, b = map(int, input().split())
    c[a] += b
for item in sorted(c.items(), key=lambda x: x[0]):
    if item[1] >= K:
        print(item[0])
        break
    else:
        K -= item[1]


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

int main() {
    int N;
    cin >> N;
    string S;
    vector<int> ans(4);

    for (int i = 0; i < N; i++)
    {
        cin >> S;
        if (S == "AC"){
            ans.at(0) += 1;
        }
        else if (S == "WA"){
            ans.at(1) += 1;
        }
        else if (S == "TLE"){
            ans.at(2) += 1;
        }
        else if (S == "RE"){
            ans.at(3) += 1;
        }
    }
    
    cout << "AC x " << ans.at(0) << endl;
    cout << "WA x " << ans.at(1) << endl;
    cout << "TLE x " << ans.at(2) << endl;
    cout << "RE x " << ans.at(3) << endl;

    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int L, R, d; std::cin >> L >> R >> d;
  int ans = 0;
  for(int i = L; i <= R; ++i) if(i%d==0) ++ans;
  fin(ans);
  return 0;
}


Measured memory_bytes: 3608
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include<bits/stdc++.h>
#include<chrono>
#include<unordered_map>
#include<random>
#include<complex> 
using namespace std;
typedef complex<long double> point;
#define EPS 1e-9 
#define OO 1e9
#define X real()
#define Y imag()
#define vec(a,b) ((b)-(a)) 
#define polar(r,t) ((r)*exp(point(0,(t)))) 
#define angle(v) (atan2((v).Y,(v).X)) 
#define length(v) ((long double)hypot((v).Y,(v).X)) 
#define lengthSqr(v) (dot(v,v)) 
#define dot(a,b) ((conj(a)*(b)).real()) 
#define cross(a,b) ((conj(a)*(b)).imag()) 
#define rotate(v,t) (polar(v,t)) 
#define rotateabout(v,t,a)  (rotate(vec(a,v),t)+(a)) 
#define reflect(p,m) ((conj((p)/(m)))*(m)) 
#define normalize(p) ((p)/length(p)) 
#define same(a,b) (lengthSqr(vec(a,b))<EPS) 
#define mid(a,b) (((a)+(b))/point(2,0)) 
#define perp(a) (point(-(a).Y,(a).X)) 
#define colliner pointOnLine 
enum STATE { IN, OUT, BOUNDRY };

#define ll long long
#define ld long double
#define ull unsigned ll 
#define endl '\n'
#define mk make_pair
#define PI acos(-1.)
void fast_in_out() {
	std::ios_base::sync_with_stdio(NULL);
	cin.tie(NULL); cout.tie(NULL);
}
int dx[] = { 0,0,-1,1,-1,1,-1,1,0 };
int dy[] = { -1,1,0,0,-1,-1,1,1,0 };
int lx[] = { 2, 2, -1, 1, -2, -2, -1, 1 };
int ly[] = { -1, 1, 2, 2, 1, -1, -2, -2 };
const ld eps = 1e-3;
const int N = 5e5 + 50, M = 4e4 + 10, mod = 1e9 + 7;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll t = gcd(a, b); return t ? (a / t * b) : 0; }
int main() {
	fast_in_out();
	//cout << fixed << setprecision(3);
	//R=r-100*(10-k)
	//r=R+100*(10-k)
	int n, R;
	cin >> n >> R;
	if (n >= 10)
		cout << R << endl;
	else cout << R + 100 * (10 - n);
	
	return 0;


}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;


    void solve()
    {
        var s = cin.next;
        WriteLine(s.Count(i => i == '1'));
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  int n;
  cin >> n;

  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (0 < i && i < 10) ans++;
    if (100 <= i && i < 1000) ans++;
    if (10000 <= i && i < 100000) ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
readline = input().split()
monsters = input().split()
n = int(readline[0])
k = int(readline[1])
ans = 0

for i in range (n):
    monsters[i] = int(monsters[i])

monsters.sort()

if (k < n):
    for i in range (n - k):
        ans += monsters[i]

print(ans)

Measured memory_bytes: 20240
#include<stdio.h>
int main(void) {
    int i, j, k, n, m, count=0;
    scanf("%d %d", &n, &m);
    int a[n][m], check[m];
    for(i=0; i<m; i++)
        check[i]=0;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i][0]);
        for(j=1; j<=a[i][0]; j++) {
            scanf("%d", &a[i][j]);
            for(k=0; k<m; k++) {
                if((k+1)==a[i][j]) {
                    check[k]+=1;
                    break;
                }
            }
        }
    }
    for(i=0; i<m; i++) {
        if(check[i]==n)
            count+=1;
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<stack>
using namespace std;
static const int N = 100;
static const int WHITE = 0; 
static const int GRAY = 1; 
static const int BLACK = 2; 

int n,M[N][N];
int color[N], d[N],f[N],tt;
int nt[N];

//用编号顺序获取与U相邻的v 
int next(int u){
	for(int v = nt[u];v < n;v++){
		nt[u] = v + 1;
		if( M[u][v] ){
			return v;
		}
	}
	return -1;
}
//用栈实现的深度优先搜索 
void dfs_visit(int r){
	for(int i = 0;i < n;i++){
		nt[i] = 0;
	}
	stack<int> S;
	S.push(r);
	color[r] = GRAY;
	d[r] = ++tt;
	
	while( !S.empty() ){
		int u = S.top();
		int v = next(u);
		if(v != -1){
			if(color[v] == WHITE){
				color[v] = GRAY;
				d[v] = ++tt;
				S.push(v);
			}
		}else{
			S.pop();
			color[u] = BLACK;
			f[u] = ++tt;
		}
	}
}

void dfs(){
	//初始化 
	for(int i = 0;i < n;i++){
		color[i] = WHITE;
		nt[i] = 0;
	}
	tt = 0;
	
	//以未访问的u为起点进行深度优先搜索 
	for(int u = 0;u < n;u++){
		if(color[u] == WHITE){
			dfs_visit(u);
		}
	}
	for(int i = 0;i < n;i++){
		cout << i+1 << " " << d[i] << " " << f[i] << endl;
	}
}
int main(){
	int u,v,k;
	cin >> n;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			M[i][j] = 0;
		}
	}
	
	for(int i = 0;i < n;i++){
		cin >> u >> k;
		u--;
		for(int j = 0;j < k;j++){
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}
	
	dfs();
	
	
	
	return 0;
}

 


Measured memory_bytes: 3132
N = int(input())
A = list(map(int,input().split()))

dict = {}
for a in A:
  if(a in dict): dict[a] += 1
  else: dict[a] = 1

ans = 0
for k, v in dict.items():
  if(k <= v): ans += v-k
  else: ans += v
print(ans)

Measured memory_bytes: 18172
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
#define pp pair<ll,pair<int,int> >
const int M=52;
bool ed[M][M],vis[M][M*M];
int cst[M][M];ll c[M];
ll w[M][M],d[M];
ll dp[M][M*M],ans[M];
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n,m,s;
	cin>>n>>m>>s;
	for(int i=1;i<=m;i++)
	{
		int u,v,a,b;
		cin>>u>>v>>a>>b;
		ed[u][v]=1;cst[u][v]=a;w[u][v]=b;
		swap(u,v);
		ed[u][v]=1;cst[u][v]=a;w[u][v]=b;	
	}
	for(int i=1;i<=n;i++)
		cin>>c[i]>>d[i];
	// cout<<c[2]<<" "<<d[2]<<endl;
	for(int i=1;i<=n;i++)
	{
		ans[i] = 1e18;
		for(int j=0;j<=2500;j++)
		{
			dp[i][j] = 1e18;
		}
	}
	if(s>2500)
		s=2500;
	dp[1][s] = 0;
	priority_queue<pp,vector<pp>,greater<pp> > pq;
	pq.push({dp[1][s],{1,s}});
	int ct = 0;
	while(!pq.empty())
	{
		auto P = pq.top();
		pq.pop();
		int x = P.ss.ff;
		ll y = P.ss.ss;
		if(vis[x][y])
			continue;
		vis[x][y]=1;
		ans[x] = min(ans[x],P.ff);
		ll p=c[x]+y;
		p=min(p,(ll)2500);
		if(dp[x][p]>dp[x][y]+d[x])
		{
			dp[x][p]=dp[x][y]+d[x];
			pq.push({dp[x][p],{x,p}});
		}
		for(int u=1;u<=n;u++)
		{
			if(ed[x][u]==0)
				continue;
			if(cst[x][u]<=y)
			{
				if(dp[u][y-cst[x][u]]>dp[x][y]+w[x][u])
				{
					dp[u][y-cst[x][u]]=dp[x][y]+w[x][u];
					pq.push({dp[u][y-cst[x][u]],{u,y-cst[x][u]}});
				}
			}
		}
	}
	for(int i=2;i<=n;i++)
		cout<<ans[i]<<"\n";
	return 0;
}

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

int main(){
    int A, B;
    cin >> A >> B;
    if (A == 1){
        cout << B << endl;
        return 0;
    }
    int cnt1(B-(A-1)), cnt2(B+1);
    while (cnt1 < B){
        cout << cnt1 << " ";
        cnt1++;
    }
    cout << B << " ";
    while (cnt2 < B+A-1){
        cout << cnt2 << " ";
        cnt2++;
    }
    cout << cnt2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> a(n);
  
  for(int i=0;i<m;i++){
    int k;
    cin>>k;
    for(int j=0;j<k;j++){
      int s;
      cin>>s;
      s--;
      a.at(s)|=1<<i;
    }
  }
  int p=0;
  for(int i=0;i<m;i++){
    int x;
    cin>>x;
    p|=x<<i;
  }
  int ans=0;
  for(int s=0;s<(1<<n);s++){
    int t=0;
    for(int i=0;i<n;i++){
        if(s>>i&1){
          t^=a.at(i);
        }
    }
    if(t==p){
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#define D(x) std::cout << __LINE__ << ' ' << #x << " = " << x << std::endl;

const int MAX_N = 100000 + 2;
bool type[MAX_N][2];

std::vector<int> graph[MAX_N];

void cyc(int start) {
	std::stack<std::pair<int, bool>> next;
	type[start][1] = true;
	next.push({start, true});
	while(!next.empty()) {
		auto curr = next.top();
		next.pop();
		for(auto nei : graph[curr.first]) {
			if(!type[nei][!curr.second]) {
				type[nei][!curr.second] = true;
				next.push({nei, !curr.second});
			}
		}
	}
}

int main() {
#ifndef LOCAL_STJO
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif
	long long n, m;
	std::cin >> n >> m;
	for(int i = 0;i < m;++ i) {
		int a, b;
		std::cin >> a >> b;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}

	cyc(1);

	long long c0 = 0, c1 = 0;
	for(int i = 1;i <= n;++ i) {
		c0 += type[i][0];
		c1 += type[i][1];
		//std::cout << i << '.' << type[i][0] << ' ' << type[i][1] << std::endl;
	}

	if(c0 != n) {
		std::cout << (c0 * c1) - m << std::endl;
	} else {
		std::cout << (n * (n-1ll)) / 2ll - m << std::endl;
	}
    return 0;
}



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


int main(){
  string ans[60],res[60];
  int c;
  char str[10];

  c = 0;
  while(1){
    ans[c] = "?";
    if(!c)ans[c] += 'a';
    else ans[c] += res[c-1][(int)res[c-1].size()-1];
    if(c<26){
      ans[c] += 'a';
      ans[c] += 'a'+c;
    }else{
      ans[c] += 'b';
      ans[c] += 'a' + c%26;
    }
    ans[c] += 'z';
    
    printf("%s\n",ans[c].c_str());
    fflush(stdout);
    
    scanf("%s",str);
    int len = 0;
    while(str[len]!='\0')res[c] += str[len++];
    if(res[c][0] != 'z'){
      printf("!OUT\n");
      return 0;
    }else{
      bool f = true;
      for(int i=0;i<c;i++){
	if(res[c] == res[i])f = false;
      }
      if(!f){
	printf("!OUT\n");
	return 0;
      }
    }
    c++;
  }
}

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

int  main()
{
	int n;
	cin >> n;
	queue<int> q;
	vector<int> a(n);
	rep(i, n)
	{
		cin >> a[i];
		q.push(a[i]);
	}
	int i = 1;
	int cnt = 0;
	while (!q.empty())
	{
		if(q.front() == i)
		{
			i++;
			q.pop();
		}
		else
		{
			q.pop();
			cnt++;
		}
	}
	if(n == cnt)
		cout << -1 << endl;
	else
		cout << cnt << endl;
	return (0);
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
  int i,h[100010],sum=0,ans=0;
  int n;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> h[i];
  }
  for(i=1;i<n;i++){
    if(h[i-1]>=h[i]){
      sum++;
    }
    else{
      ans=max(ans,sum);
      sum=0;
    }
  }
  ans=max(ans,sum);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4016
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#define pb push_back
using namespace std;
typedef pair<int,int> pii;

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

  vector<int> p;
  for(int i=0;i<n;i++){
    cin>>t;
    p.pb(t);
  }
  sort(p.begin(),p.end());
  t=p[n-1]/2;
  for(int i=0;i<n-1;i++){
    t+=p[i];
  }
  cout<<t<<endl;
  return 0;
}


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

int main(){
    
    std::string s, t;

    std::cin >> s >> t;

    std::sort(s.begin(), s.end());
    std::sort(t.begin(), t.end(), std::greater<char>());

    if(s < t){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)

    if   op == "?":
        break
    elif op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a // b)
    else:
        raise ValueError(a, op, b)



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

int main() {
  int n;
  cin >> n;
  using pis = pair<int, string>;
  map<string, int> m;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    m[s]++;
  }

  int val_max = 0;
  for (auto i: m) {
    val_max = max(val_max, i.second);
  }

  for (auto it = m.begin(); it != m.end(); it++) {
    if ((it->second) == val_max) {
      cout << it->first << endl;
    }
  }
}


Measured memory_bytes: 25216
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>

int testcase_ends() {
  size_t N;
  scanf("%zu", &N);
  if (N == 0) return 1;

  size_t H, W;
  scanf("%zu %zu", &W, &H);
  std::vector<std::vector<int>> a(H+1, std::vector<int>(W+1));
  for (size_t i = 0; i < N; ++i) {
    size_t x, y;
    scanf("%zu %zu", &x, &y);
    ++a[y][x];
  }

  for (size_t i = 0; i <= H; ++i)
    for (size_t j = 1; j <= W; ++j)
      a[i][j] += a[i][j-1];

  for (size_t j = 0; j <= W; ++j)
    for (size_t i = 1; i <= H; ++i)
      a[i][j] += a[i-1][j];

  size_t S, T;
  scanf("%zu %zu", &S, &T);

  int res = 0;
  for (size_t i = T; i <= H; ++i)
    for (size_t j = S; j <= W; ++j) {
      int cur = 0;
      cur += a[i][j];
      cur -= a[i-T][j];
      cur -= a[i][j-S];
      cur += a[i-T][j-S];
      res = std::max(res, cur);
    }
  printf("%d\n", res);
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 2684
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> a(4);
    REP(i,4) cin >> a[i];

    vector<int> idx(4);
    idx[2] = idx[3] = 1;
    int ans = INF;
    do{
        int sum1 = 0, sum2 = 0;
        REP(i,4){
            if(idx[i]) sum1 += a[i];
            else sum2 += a[i];
        }
        chmin(ans, abs(sum1-sum2));
    }while(next_permutation(idx.begin(), idx.end()));
    cout << ans << endl;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int K = 38, N = K * K - K + 1, P = K - 1;

void solve() {
	cout << N << " " << K << "\n";
	rep(i, 0, P + 1) {
		cout << N << " ";
		rep(j, 0, P) cout << i * P + j + 1 << " ";
		cout << "\n";
	}
	rep(i, 0, P) {
		rep(j, 0, P) {
			rep(k, 0, P) {
				cout << k * P + (j + i * k) % P + 1 << " ";
			}
			cout << P * P + i + 1 << "\n";
		}
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 512
#include <iostream>
#define rep(i,n) for(int (i) = 0; (i) < (n); (i)++)
using namespace std;

int main() {
    int N;
    cin >> N;
    int count = 0;
    for (int i = 1; i <= N; i++) {
        if (i % 2 == 0) continue;
        int eight = 0;
        for (int j = 1; j <= N; j++) {
            if (i % j == 0) {
                eight += 1;
            }
        }
        if (eight == 8) {
            count += 1;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        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.println("Yes");
        }else{
            System.out.println("No");
        }
    }else{
        System.out.println("No");
    }
  }
}



Measured memory_bytes: 26232
#include<iostream>

using namespace std;

int main(){

    char s[4];
    string res = "Good";

    cin >> s;

    for(int i = 1;i < 4;i++){

        if(s[i - 1] == s[i]){

            res = "Bad";
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Data.List
import Data.Maybe

main = do
    n<-readLn::IO Int
    xyhs <- replicateM n (map read.words<$>getLine) ::IO [[Int]]
    let Just (_,(x,y,h)) = find (\(f,_)->f) $ map (f xyhs) [(cx,cy)|cx<-[0..100],cy<-[0..100]]
    putStrLn $ unwords $ map show [x,y,h]
--
f xyhs (cx,cy) = (all (g cx cy ch) xyhs, (cx,cy,ch))
    where
        Just(tx:ty:th:_) = find (\(_:_:h:_)->h>0) xyhs
        ch = th + abs(cx-tx) + abs(cy-ty)

g cx cy ch (x:y:h:_)
    | max (ch-abs(cx-x)-abs(cy-y)) 0 == h = True
    | otherwise = False
 

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N, K;
  cin >> N >> K;
  for (int i = 0;; i++) {
    if (i * (K - 1) + 1 >= N) {
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int[] d = new int[6];

		for(int i = 0; i < d.length; i++) {
			d[i] = sc.nextInt();
		}

		System.out.println(d[4] - d[0] <= d[5] ? "Yay!" : ":(");
	}
}

Measured memory_bytes: 35676
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>
#include<iomanip>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vvi = vector<vector<int> >;
using vvd = vector<vd>;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

#define INF 10000.0

class city{
public:
  int to; double d; int c;
  city(int x, double y, int z):to(x), d(y), c(z){}
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int n, m;
  while(cin >> n >> m, n){
    int s, g; cin >> s >> g;
    s--, g--;
    vector<vector<city>> edges(n, vector<city>(n, {0, 0, 0}));
    vector<vvd> costs(n, vvd(31, vd(n, INF)));
    for(int i = 0; i < m; i++){
      int x, y; double d; int c;
      cin >> x >> y >> d >> c;
      x--; y--;
      edges[x][y] = {y, d, c};
      edges[y][x] = {x, d, c};
    }
    priority_queue<pair<pair<double, int>, pii>, vector<pair<pair<double, int>, pii>>, greater<pair<pair<double, int>, pii>>> q;
    for(int i = 0; i < n; i++){
      if(edges[s][i].c != 0){
        q.push({{edges[s][i].d, 1}, {s, i}});
      }
    }
    while(!q.empty()){
      pair<pair<double, int>, pii> now = q.top(); q.pop();
      int from = now.second.first;
      int to = now.second.second;
      int  vel = now.first.second;
      double dist = now.first.first;
      if(costs[to][vel][from] <= dist) continue;
      costs[to][vel][from] = dist;
      // if(to == g && vel == 1) break;
      for(int i = 0; i < n; i++){
        if(i == from || i == to) continue;
        if(edges[to][i].c == 0) continue;
        for(int j = -1; j <= 1; j++){
          if(vel + j <= 0 || edges[to][i].c < vel+j) continue;
          q.push({{dist + edges[to][i].d / (double)(vel+j), vel+j}, {to, i}});
        }
      }
    }
    double ans = INF;
    for(int i = 0; i < n; i++) ans = min(ans, costs[g][1][i]);
    if(ans != INF) cout << fixed << setprecision(16) << ans << endl;
    else cout << "unreachable" << endl;
  }

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}



Measured memory_bytes: 22228