akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;

class Cmondai
{
    static void Main()
    {
        var S = Console.ReadLine();
        var T = Console.ReadLine();
        var index = int.MinValue;
        for (int i = S.Length - 1; 0 <= i; --i)
        {
            if (S[i] == '?' || S[i] == T[T.Length - 1])
            {
                for (int j = 0; j < T.Length; ++j)
                {
                    if (i - (T.Length - 1) < 0) break;
                    if (S[i - j] == T[T.Length - 1 - j] || S[i - j] == '?')
                    {
                        if (j == T.Length - 1) index = i;
                        continue;
                    }
                    else break;
                }
                if (index != int.MinValue) break;
            }
        }
        if (index == int.MinValue)
        {
            Console.WriteLine("UNRESTORABLE");
            return;
        }
        var ans = new Stack<char>();
        for (int i= S.Length-1; 0<=i;--i)
        {
            if (i == index)
            {
                for (int j = T.Length-1; 0 <= j ; --j)
                {
                    ans.Push(T[j]);
                }
                i -= (T.Length-1);
            }
            else if (S[i] == '?') ans.Push('a');
            else ans.Push(S[i]);
        }
        foreach (var a in ans)
        {
            Console.Write(a);
        }
        Console.WriteLine();
    }
}

Measured memory_bytes: 13268
#include <stdio.h>

long long a [100010];
 
  int main ()
  {
  int n;
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%lld",&a[i]);
int zero =0;

for(int i=0;i<n;i++)if(a[i]==0) zero ++;
if(zero >0){
// a[i] contains 0
printf("0\n");
return 0;
}
long long prod =1;
for(int i=0;i<n;i++){
if(a[i ] <=1000000000000000000/ prod ){
// This condition is equivalent to prod*a[i] <=10ˆ18
prod *=a[i];
}else{
printf("-1\n");
return 0;
}
}
printf("%lld\n",prod );

return 0;
}

Measured memory_bytes: 2496
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional> 
#include <iomanip>
#include <unordered_map>
#include <memory.h>
#include <cstring>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <cassert>
#include <atcoder/dsu>
#include <cstdio>

using namespace std;
using namespace atcoder;

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

	string s = "ACL";
	int n;

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cout << s;
	}
	cout << '\n';

	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1L << 60;

int main() {
    int N, K; cin >> N >> K;
    vector<int> h(N);
    REP(i, 0, N) cin >> h[i];

    vector<ll> dp(N, INF);
    dp[0] = 0;
    REP(i, 1, N) {
        int j = i - 1;
        while (j >= 0 && j >= i - K) {
            chmin(dp[i], dp[j] + abs(h[i] - h[j]));
            j--;
        }
    }
    cout << dp[N - 1] << endl;

    return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
int main (void)
{
  int a,b,c,i,n=0;
  scanf("%d%d%d",&a,&b,&c);
  for(i=a;i<=b;i++){
    if(c%i==0){
      n++;
    }
  }
  printf("%d\n",n);
  return 0;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;

int n;

void solve()
{
    const int MAX = 100;
    cin >> n;
    vi ans(26, MAX);
    REP(i, n)
    {
        string s; cin >> s;
        vi count(26, 0);
        REP(j, s.length()) 
        {
            count[s[j] - 'a']++;
        }
        REP(j, 26)
        {
            ans[j] = min(ans[j], count[j]);
        }
    }

    REP(i, 26)
    {
        while(ans[i] > 0)
        {
            cout << char('a'+i);
            ans[i]--;
        }
    }
    cout << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();

    return 0;
}

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

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

    int C[N];
    int V[N];

    for(int i = 0; i < N; i++){
        cin >> V[i];
    }
    for(int i = 0; i < N; i++){
        cin >> C[i];
    }

    int ans = 0;
    int k = 0;

    for(int i = 0; i < N; i++){
        if(V[i] > C[i]){
            k = V[i] - C[i];
            ans += k;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

int main(){
  int a,n;
  cin >> n;
  int ans = 100000;
  for(int i=0;i<n;i++){
    cin >> a;
    int count = 0;
    while(a%2 == 0){
      a /= 2;
      count += 1;
    }
    ans = min(ans,count);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[15],dp[15];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	if(a[n-1]%2==0)
		dp[n-1]=1;
	else
		dp[n-1]=2;
	for(int i=n-2;i>=0;i--)
	{
		if(a[i]%2==1)
		{
			dp[i]+=2*pow(3,n-i-1);
			dp[i]+=dp[i+1];
		}
		else
		{
			dp[i]+=pow(3,n-i-1);
			dp[i]+=2*dp[i+1];
		}
	}
	cout<<dp[0]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<int> H(N);
  for(int i=0;i<N;i++){
    cin>>H.at(i);
  }
  int count = N;
  for(int i=1;i<N;i++){
    for(int j=i-1;j>=0;j--){
      if(H.at(i)<H.at(j)){
        count--;
        break;
      }
    }
  }
  cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a[4], i, j1=0, j9=0, j7=0, j4=0;
    
    for(i=0;i<4;i++){
        scanf("%d", &a[i]);
    }

    for(i=0;i<4;i++){
        if(j1==0 && a[i] == 1)
            j1=1;
        if(j9==0 && a[i] == 9)
            j9=1;
        if(j7==0 && a[i] == 7)
            j7 = 1;
        if(j4 == 0 && a[i] == 4)
            j4 = 1;
    }

    if(j1==1 && j9 == 1 && j7 == 1 && j4 == 1)
        printf("YES\n");
    else
        printf("NO\n");
    
    return 0;
}


Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(H, W, M):
    C = Counter()
    for r in M:
        C.update(r)
    f = (H // 2) * (W // 2)
    t = (H % 2) * (W // 2) + (H // 2) * (W % 2)

    v = list(map(lambda x: -x, C.values()))
    heapq.heapify(v)
    for _ in range(f):
        c = -heapq.heappop(v)
        if c == 4:
            pass
        elif c > 4:
            c -= 4
            heapq.heappush(v, -c)
        else:
            return 'No'

    for _ in range(t):
        c = -heapq.heappop(v)
        if c == 2:
            pass
        elif c > 2:
            c -= 2
            heapq.heappush(v, -c)
        else:
            return 'No'
    return 'Yes'


def main():
    H, W = read_int_n()
    M = [read_str() for _ in range(H)]
    print(slv(H, W, M))


if __name__ == '__main__':
    main()


Measured memory_bytes: 6340
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  bool n = false, w = false, s = false, e = false;
  string S;
  cin >> S;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] == 'N') n = true;
    if (S[i] == 'W') w = true;
    if (S[i] == 'S') s = true;
    if (S[i] == 'E') e = true;
  }
  if (n ^ s == 0 && w ^ e == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>

using namespace std;

#define Int int64_t

void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}


template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}




int main() {
	Int N; cin >> N;
	Int X; cin >> X;
	vector<int> an(N);
	for (int i = 0; i < N; i++) {
		cin >> an[i];
	}
	//printVec(an);
	int y = 0,counts=0;
	for (int count = 0; y <= X;count++) {
		y += an[count];
		counts++;
	}
	if (counts >= N + 1) {
		cout << N + 1 << endl;
	}
	else {
		cout << counts << endl;
	}
	


	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main()
{
	unsigned long long l,r,ans=0,sum,i;
	scanf("%llu %llu",&l,&r);
	sum=l;
	while(sum<=r)
	{
		ans++;
		sum*=2;
	}
	printf("%llu\n",ans);
}

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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n; cin >> n;
    vector<ll> hoge(n);
    for (int i = 0; i < n; i++)
    {
        /* code */
        cin >> hoge[i];
    }
    ll sum = sum_vll(hoge);
    cout << *min_element(hoge.begin(), hoge.end()) << " " << *max_element(hoge.begin(), hoge.end()) << " " << sum << endl;
} 


Measured memory_bytes: 3212
#!/usr/bin/env python3
n = int(input())
e = sorted([[str(i + 1)] + input().split() for i in range(n)],
           key=lambda x: int(x[2]),
           reverse=True)
d = dict()
for i in e:
    if i[1] not in d:
        d[i[1]] = []
    d[i[1]].append(i[0])
e = sorted(d.items(), key=lambda x: x[0])
for i in e:
    print(*i[1], sep="\n")


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

using namespace std;

int main(){

  int N = 0;
  string ans="Yes";
  cin >> N;
  vector<pair <int, int>> task;

  for(int i=0; i<N; ++i){
    int a, b;
    cin >> a >> b;
    task.emplace_back(b, a);
  }

  sort(task.begin(), task.end());
  int sum = 0;

  for ( auto v : task){
    sum += v.second;

    if(sum > v.first){
      ans="No";
      break;
    }
  }

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


Measured memory_bytes: 2420
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	string s;
	cin >> s;

	int k;
	cin >> k;

	for (int i = 0; i < (int) s.size() - 1; ++i) {
		if (s[i] == 'a') {
			continue;
		}
		
		if ('z' - s[i] + 1 <= k) {
			k -= 'z' - s[i] + 1;
			s[i] = 'a';
		}
	}

	k %= 26;
	s[s.size() - 1] = (((s[s.size() - 1] - 'a') + k) % 26) + 'a';

	cout << s << "\n";

	return 0;

}

Measured memory_bytes: 3716
#include "stdio.h"
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int a = 0;
	int b = 0;
	int aw,bw;
	for(int i = 0; i < 4; i++)
	{
		scanf("%d",&aw);
		a += aw;
	}
	for(int i = 0; i < 4; i++)
	{
		scanf("%d",&bw);
		b += bw;
	}
	printf("%d\n",max(a,b));
	return 0;
}

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

#define int long long
#define mod 1000000007

using namespace std;

double dp[3010][3010];
double a[3010];

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

    dp[0][0] = 1;

    for(int i=1;i<=n;i++)
        cin >> a[i], dp[0][i] = a[i]*dp[0][i-1];

    double ans = dp[0][n];

    for(int i=1;i<=n/2;i++)
    {
        for(int j=1;j<=n;j++)
            dp[i][j] = dp[i-1][j-1]*(1-a[j]) + dp[i][j-1]*a[j];

        ans += dp[i][n];
    }

    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 37248
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cmath>
#include <time.h>
#include <tuple>
#define all(c) ((c).begin(),(c).end())
#define rall(c) ((c).rbegin(),(c).rend())
//#define sort(v,n) sort(v,v+n)
#define ll long long
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int n;
int a[110];
vector<int> v;
int main() {
	cin >> n;
	ll s = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i]; s += a[i];
		if (a[i] % 10 != 0) {
			v.push_back(a[i]);
		}
	}
	if (s % 10 == 0) {
		if (v.size() != 0) {
			sort(v.begin(), v.end());
			s -= v[0];
			cout << s << endl;
		}
		else {
			cout << 0 << endl;
		}
	}
	else {
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import * as fs from 'fs';

// main
function main(input: string[]) {
    // param
    var d: number = 0;
    var t: number = 0;
    var s: number = 0;
    var ans: string = "";
    // init
    [d, t, s] = input.shift().split(" ").map(x => Number(x));
    // solve
    ans = (d <= s * t) ? "Yes" : "No";
    // answer
    console.log(ans);
}

// entrypoint
function entrypoint() {
    try {
        var input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            input = lines;
            main(input);
        });
    }
}
entrypoint();


Measured memory_bytes: 29612
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  int a, b;
  cin >> a >> b;
  if(a <= 8 && b <= 8) cout << "Yay!" << endl;
  else cout << ":(" << endl;
  return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

const int mod = 1'000'000'007;

int main(void) {
    int n, m;
    cin >> n >> m;
    vector<int> dp(n+1000,0);
    vector<int> breakstep(n+1,true);
    rep(i, m) {
        int a;
        cin >> a;
        breakstep[a] = false;
    }
    dp[0] = 1;

    rep(i, n) {
        if(breakstep[i]) {
            if(breakstep[i+1]) dp[i+1] = (dp[i+1] + dp[i]) % mod ;
            if(breakstep[i+2]) dp[i+2] = (dp[i+2] + dp[i]) % mod ;
        }
    }

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


Measured memory_bytes: 1024
N,*M=`dd`.split.map &:to_i;A=M.shift N;D=[*0..1e6];s=0;2.upto(N-2){|i|s+=A[i];1.upto(A[i]){|j|D.unshift D[j*2-1]}};M.map{|e|p (D[e]||e-s)+A[0]-A[1]}

Measured memory_bytes: 88488
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){
	ll a,b;
	cin >> a>>b;

	if ((a<=0 && b>=0)||(a>=0 && b<=0)) {
		cout << "Zero" << endl;
	}
	else if (a>0 && b>0){
		cout << "Positive" << endl;
	}
	else {
		if ((a-b)%2==0) {
			cout << "Negative"<< endl;
		}
		else {
			cout << "Positive"<< endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < int(n); ++i)
#define REPE(i, a, b) for (int i = (a); i <= int(b); ++i)
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
#define PB push_back
#define EB emplace_back
using LL = long long;
using PII = pair<int, int>;
#define F first
#define S second

char s[200010];
int c[128];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  REP(i, n) c[s[i]]++;
  LL ans = 1, t = n;
  REP(i, n) {
    ans += (t--) - (c[s[i]]--);
  }
  cout << ans << endl;
  return 0;
}



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

int main()
{
	int i, k = 0;
	double arr[50][11] = { 0 };
	
	while (scanf("%lf",&arr[k][1])!=EOF)
	{
		for (i = 2; i <11; i++)
		{
			if (i%2)
			{
				arr[k][i] = arr[k][i - 1] / 3;
			}
			else
			{
				arr[k][i] = arr[k][i - 1] * 2;
			}
			arr[k][1] += arr[k][i];
		}
		++k;
	}
	
	
	for (i = 0; i < k; i++)
	{
		printf("%.8f\n",arr[i][1]);
	}

	return 0;
}


Measured memory_bytes: 656
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

void inp_str(long int*);

int main(void) {

long int input1[150];
inp_str(input1);

long int N,L;

N=input1[0];

int A,B,C,D;
A=N/1000;
N=N-A*1000;
B=N/100;
N=N-B*100;
C=N/10;
N=N-C*10;
D=N;



//printf("%d\n",A);
//printf("%d\n",B);
//printf("%d\n",C);
//printf("%d\n",D);


if(A==B){
printf("Bad\n");
} else if(B==C){
printf("Bad\n");

} else if(C==D){
printf("Bad\n");

} else {
printf("Good\n");

}




    return 0;

}


void inp_str(long int instr[]){
char *ptr;
long int z,i,count;
char str[20000]={'\0'};
char *ln;

fgets(str, 20000, stdin); // 入力："123456\n"
ln = strchr(str, '\n'); /* 改行文字を検索 */
if (ln != NULL) { /* 改行が読み取られていたかどうか */
   *ln = '\0';    /* 改行文字を終端文字に置き換える */
}
else {            /* 入力ストリーム上に文字が残ってる場合 */
   while (1) {    /* 改行文字が読み取られるまで空読みする */
       z = getchar();
      if (z == '\n' || z == EOF) break;
   }
}
	count=0;
    ptr = strtok(str, " ");
    i = atol(ptr);
    instr[count]=i;
    count=count+1;
    // 2回目以降
    while(ptr != NULL) {
        // strtok関数により変更されたNULLのポインタが先頭
        ptr = strtok(NULL, " ");
        // ptrがNULLの場合エラーが発生するので対処
        if(ptr != NULL) {
		    i = atol(ptr);
    instr[count]=i;
    		count=count+1;
        }
    }
}



Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
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)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int d;
	vector<int> a(3);
	bool ok = false;
	cin>>a[0]>>a[1]>>a[2]>>d;
	if(abs(a[0]-a[2])<=d)ok = true;
	sort(all(a));
	if(a[2]-a[1]<=d && a[1]-a[0] <= d)ok = true;
	cout<<((ok)?"Yes":"No")<<endl;
	return 0;
}

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

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

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

  vector<ll> denominator(n, 0);
  for(int i = 1; i <= n; ++i){
    if(i < k){
      int tmp = 2;
      while(i*tmp < k){
        tmp <<= 1;
      }
      denominator[i-1] = n * tmp;
    }
    else{
      denominator[i-1] = n;
    }
  }

  ll lcm_denomi = 1;
  for(int i = 0; i < n; ++i){
    lcm_denomi = lcm(lcm_denomi, denominator[i]);
  }

  ll numerator = 0;
  for(int i = 0; i < n; ++i){
    numerator += lcm_denomi / denominator[i];
  }

  // cout << numerator << " " << lcm_denomi << endl;
  long double ans = (long double)numerator / (long double)lcm_denomi;
  cout << fixed << setprecision(15) << ans << endl;

	return 0;
}



Measured memory_bytes: 1024
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

constexpr int inf = 2147483647;
constexpr int64_t inf64 = 9223372036854775807;
constexpr int mod = 1e9+7;
const int dx[4] = {0, 0, 1, -1};
const int dy[4] = {1, -1, 0, 0};

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

  int h, w;
  cin >> h >> w;
  vector<string> grid(h);
  rep(i,h) cin >> grid[i];

  rep(i,h) {
    rep(j,w) {
      if(grid[i][j] == '.') continue;

      bool flag = false;
      rep(dir, 4) {
        int ni = i + dy[dir];
        int nj = j + dx[dir];

        if(ni < 0) continue;
        if(nj < 0) continue;
        if(ni >= h) continue;
        if(nj >= w) continue;

        if(grid[ni][nj] == '#') flag = true;
      }
      if(!flag) { cout << "No" << endl; return 0; }
    }
  }

  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
def main():
    h, w = map(int, input().split())
    k = [["."]+list(input())+["."] for _ in range(h)]
    s = [[None]*(w+2) for _ in range(h+2)]
    s[0] = ["."]*(w+2)
    s[-1] = ["."]*(w+2)
    s[1:h+1] = k
    d = [[0, 1], [0, -1], [1, 0], [-1, 0]]
    for i in range(1, h+1):
        for j in range(1, w+1):
            if s[i][j] == ".":
                continue
            flag = True
            for (di, dj) in d:
                if s[i+di][j+dj] == "#":
                    flag = False
                    break
            if flag:
                print("No")
                return
    print("Yes")

if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#define REP(i,n) for(int(i)=(0);(i)<(n);(i)++)

using namespace std;

int main(){
  string S;
  cin >> S;
  int siz = S.size();
  int wb,bw;
  wb = 0;
  bw = 0;
  //wbwbwbwb......
  REP(i,siz){
    if((i%2==0&&S[i]=='0')||(i%2!=0&&S[i]=='1')) wb++;
    if((i%2==0&&S[i]=='1')||(i%2!=0&&S[i]=='0')) bw++;
    }
  cout << min(wb,bw) << '\n';
}


Measured memory_bytes: 512
import java.util.Scanner;


public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		for(; scanner.hasNext();)
		{
			String str = scanner.next();
			String[] s = str.split(",");
			
			int[] l = new int[10];
			int d = 0;
			for(int i=0; i<10; i++)
			{
				l[i] = Integer.parseInt(s[i]) * 100;
				d += l[i];
			}
			int v1 = Integer.parseInt(s[10]);
			int v2 = Integer.parseInt(s[11]);
			
			int t;
			for(t=0; ;t++)
			{
				if((v1+v2)*t >= d)
				{
					break;
				}
			}
			
			d = 0;
			int st=0;
			for(int i=0; i<10; i++)
			{
				d += l[i];
				if(d >= v1*t)
				{
					st = i+1;
					break;
				}
			}
			
			System.out.println(st);
		}
		
	}
}

Measured memory_bytes: 26136
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner entrada= new Scanner(System.in);
        String str=entrada.next();
        String str2="";
        int p=-2;
        int cont=0;
        for(int i=0; i<str.length();i++){
            char c=str.charAt(i);
            for(int j=0;j<str.length();j++){
                if(str.charAt(j)==(c)){
                    cont+=1;
                }
            }
        }
        if (cont==8){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
        //System.out.println(cont);
    }
}
    


Measured memory_bytes: 21972
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (a); i < (int)(b); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll MOD = (ll)pow(10.0, 9.0) + 7;
pint dx[4] = { {0, 1}, {0, -1}, {1, 0}, {-1, 0} };
char da[4] = { 'R', 'L', 'D', 'U' };
char dax[4] = { -1, 1, -1, 1 };
char dax2[4] = { 1, -1, 1, -1 };
ll min(ll a, ll b)
{

	return (a < b) ? a : b;
}
ll max(ll a, ll b) { return (a > b) ? a : b; }





vector<ll> conlist[100];
ll p[1000];


ll dfs(string state, int all, int M) {
	ll retval = 0, sum = 0;
	if (state.length() == all) {
		rep(i, M) {
			rep(j, conlist[i].size()) {
				sum += (state[conlist[i][j]] == '1');
			}

			if (sum % 2 != p[i]) {
				return 0;
			}
			sum = 0;
		}


		return 1;
	}

	
		return dfs(state + "0", all, M) + dfs(state + "1", all, M);
	

}


int main() {
	ll n, m;

	cin >> n >> m;


	rep(i, m) {
		ll k, s;
		cin >> k;

		rep(j, k) {

			cin >> s;
			s--;
			conlist[i].push_back(s);
		}

	}


	rep(i, m) {
		cin >> p[i];
	}

	cout << dfs("", n, m) << endl;

	return 0;

}

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

int main()
{   
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;

    if(s[k-1]=='A') s[k-1] = 'a';
    else if(s[k-1]=='B') s[k-1] = 'b';
    else if(s[k-1]=='C') s[k-1] = 'c';

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 384
n = int(input())
a = [list(input().split()) for i in range(n)]
d = sorted(set([i[0] for i in a]))
for i in a:
  for j in range(len(d)):
    if i[0] == d[j]:
      i[0] = 10000**(len(d)-(j+1))
c = [i[0]*int(i[1]) if int(i[1]) != 0 else i[0]*0.1 for i in a ]
e = sorted(c,reverse=True)
for i in e:
  print(c.index(i)+1)


Measured memory_bytes: 3064
#include <iostream>
#include <thread>
#include <chrono>
#include <random>
#include <fstream>
#include <time.h>

#define ll long long int
#define pr(x) (std::cout << x << std::endl)



int main()
{
    ll a,b;
    std::cin >> a >> b;

    pr((a-1)*(b-1));
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            List<ClsJob> lstJob = new List<ClsJob>();
            for (int i = 0; i < iN; i++)
            {
                sS = System.Console.ReadLine().Trim().Split(' ');
                ClsJob oneUsr = new ClsJob();
                oneUsr.iC = int.Parse(sS[0]);
                oneUsr.iD = int.Parse(sS[1]);
                lstJob.Add(oneUsr);
            }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            lstJob.Sort(delegate (ClsJob mca1, ClsJob mca2) { return mca1.iD - mca2.iD == 0 ? mca1.iC - mca2.iC : mca1.iD - mca2.iD; });    // iD(〆切)昇順のiC(時間)の昇順
            string sOut = "Yes";
            long iCs = 0;
            for (int i = 0; i < lstJob.Count; i++)
            {
                iCs += lstJob[i].iC;                                    // 総掛かった時間
                if (iCs > lstJob[i].iD) { sOut = "No"; break; }         // 〆切超えてたら終わり
            }

            // 出力
            System.Console.WriteLine("{0}", sOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

        private class ClsJob
        {
            public int iC { get; set; }         // 掛る時間
            public int iD { get; set; }         // 〆切
        }

}


Measured memory_bytes: 25636
a = list(map(int, input().split()))
N = a[0]
b = 0
for i in range(1,N+1):
    c = 0
    for j in range(len(str(i))):
        c = c + int(str(i)[j])
    if c >= a[1] and c <= a[2]:
        b = b + i
print(b)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n);

	for(int i = 1; i < 10; i++) {
		if(n % i) continue;
		if(n / i >= 10) continue;

		printf("Yes\n");
		return 0;
	}
	printf("No\n");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
#define INF 2000000000
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
int n;

int main(){
	cin>>n;
	int ans = 0;
	rep(i,8){
		int k = pow(2,i);
		if(k<=n){
		chmax(ans ,k);
		}
	}
	cout<<ans<<endl;
}




Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
	int x,a,b;
	cin>>x>>a>>b;
	if(b-a<=0){
		cout<<"delicious"<<endl;
		
	}
	else if(b-a<=x){
		cout<<"safe"<<endl;
		
	}
	
	else cout<<"dangerous"<<endl;
	
}

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 Acount = 0;
        
        for (int i = 0; i < 100; i++){
            Acount = i;
            
            int total = (A - 1) * Acount + 1;
            
            if (total >= B){
                break;
            }
        }
        
        System.out.println(Acount);
    }
}


Measured memory_bytes: 22100
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

  vector<int> d;
  for (int i = 0; i < n; i++) {
    int v;
    cin >> v;
    d.push_back(v);
  }

  int ans = -1;
  int mn;
  if (n > k) {
    mn = k;
  } else {
    mn = n;
  }

  int mans = -111111;
  for(int i = 0; i <= mn; i++) {
    for(int j = 0; j <= mn - i; j++) {
      vector<int> md;
      int ans = 0;

      for(int l = 0; l < i; l++) {
        ans += d[l];
        md.push_back(d[l]);
      }

      for(int l = 0; l < j; l++) {
        ans += d[n - 1 - l];
        md.push_back(d[n - 1 - l]);
      }

      sort(md.begin(), md.end(), less<int>());

      int rk = k - (i + j);
      for (int l = 0; l < i + j; l++) {
        if (rk <= 0) break;
        if (md[l] < 0) {
          ans -= md[l];
          rk -= 1;
        }
      }

      if (mans < ans) {
        mans = ans;
      }
    }
  }

  cout << mans << "\n";

  return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace C_ABC168
{
    class MainClass
    {

        static int[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            double a = s[0];
            double b = s[1];
            double h = s[2];
            double m = s[3];

            double them = (m / 60)*2*PI;
            double theh = ((h/12) + ((m/60) /12 )) * 2 * PI;
            // + ((double)(1/12))*2*PI *(m/60);
            double the =Abs(them - theh);
            
            // WriteLine("them : {0} theh : {1} the : {2}",them/(2*PI),theh/(2*PI),the/(2*PI));

            double c = Sqrt(Pow(b,2) + Pow(a,2) - 2 * a*b*Cos(the));
            WriteLine(c);
        }
    }
}


Measured memory_bytes: 28424
import java.util.Scanner;

public class Main {
    public static void main(String[] c) {
        Scanner scan = new Scanner(System.in);
        String[] t = scan.nextLine().split("\\s");
        int n = Integer.valueOf(t[0]);
        int r = Integer.valueOf(t[1]);

        if (n >= 10)  {
            System.out.println(r);
        } else {
            int num = 100 * (10 - n);
            System.out.println(r + num);
        }
    }
}

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

#define int long long

bool check(int n, int k, vector<int> a, int m) {
	int cuts_need = 0;
	for (int i: a) {
		cuts_need += (i-1)/m;
	}
	return cuts_need <= k;
}

signed main() {
	ios::sync_with_stdio(0); cin.tie(0);
		
	int n, k; cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];

	int lo = 1, hi = 1000000000;
	while (lo < hi) {
		int mid = (lo + hi)/2;

		if (check(n, k, a, mid)) {
			hi = mid;
		} else {
			lo = mid+1;
		}
	}
	cout << lo << '\n';

	return 0;
}


Measured memory_bytes: 6296
import java.util.Scanner;

public class Main {

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

}

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

int main(){
	int n,ma=0,s,j,i;
	
	cin>>n;
	
	int a[3][n+1];
	for(i=1;i<=2;i++)
	 for(j=1;j<=n;j++){
	 	cin>>a[i][j];
	 }
	for(i=1;i<=n;i++){
		s=0;
		for(j=1;j<=i;j++){
			s+=a[1][j];
		}
		for(j=i;j<=n;j++){
			s+=a[2][j];
		}
		if(s>ma){
			ma=s;
		}
	}
	cout<<ma<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main()
{
int a, b, flag = 1;
char op;
 
while(flag)
{
scanf("%d %c %d ", &a, &op, &b);
 
switch(op)
{
case '?':
flag = 0;
break;
case '+':
printf("%d\n", a + b);
break;
case '*':
printf("%d\n", a * b);
break;
case '/':
printf("%d\n", a / b);
break;
case '-':
printf("%d\n", a - b);
break;
}
}
 
return 0;
}


Measured memory_bytes: 2120
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using ll=long long;
int main(){
    ll R,C,k;
    cin>>R>>C>>k;
    vector<vector<ll>> field(R+5,vector<ll>(C+5));
    rep(i,k){
        ll r,c,v;
        cin>>r>>c>>v;
        r--;c--;
        field[r][c]=v;
    }
    vector<vector<vector<ll>>> dp(R+5,vector<vector<ll>>(C+5,vector<ll>(5)));
    rep(i,R+1){
        rep(j,C+1){
            for(int k=2;k>=0;k--){
                dp[i+1][j][0]=max(dp[i+1][j][0],dp[i][j][k]);
                dp[i][j+1][k]=max(dp[i][j+1][k],dp[i][j][k]);
                if(field[i][j]!=0){
                    dp[i+1][j][0]=max(dp[i+1][j][0],dp[i][j][k]+field[i][j]);
                    dp[i][j+1][k+1]=max(dp[i][j+1][k+1],dp[i][j][k]+field[i][j]);
                }
            }
        }
    }
    ll ans=0;
    rep(i,4){
        ans=max(ans,dp[R][C][i]);
    }
    cout<<ans<<endl;
    return 0;
}

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


// 2 以上 M 以下の素数を求める愚直な実装, O( n * sqrt(n) )
int calculatePrime(int M)
{
    for(int i = M; i <= 10*M; ++i){
        bool isPrime = true;
        for(int j = 2; j*j <= i; ++j){
            if(i % j == 0 && i != j){
                isPrime = false;
                break;
            }
        }
        if(isPrime) return i;
    }
  	
  	return 0;
}


int main()
{
    int X;
  	cin >> X;
  
  	cout << calculatePrime(X) << endl;
  
	return 0;
}

Measured memory_bytes: 256
l, m, n = map(int, input().split())
A = [[0 for _ in range(m)] for _ in range(l)]
for i in range(l):
    A[i] = list(map(int, input().split()))

B = [[0 for _ in range(n)] for _ in range(m)]
for i in range(m):
    B[i] = list(map(int, input().split()))

C = [[0 for _ in range(n)] for _ in range(l)]
for i in range(l):
    for j in range(n):
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]

for i in range(l):
    print(" ".join(map(str,C[i])))


Measured memory_bytes: 6880
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <stack>

using namespace std;

int common_time=1,n;

int table[101][101],time_table[101][2];

void func(int node){
	if(time_table[node][0] == 0){
		time_table[node][0] = common_time++;
	}else{
		return;
	}
	for(int i=1;i<=n;i++){
		if(table[node][i] == 1){
			func(i);
		}
	}
	time_table[node][1] = common_time++;
}

int main(){
	int row,num,col;
	scanf("%d",&n);

	for(int i=1;i<=n;i++){
		for(int k=1;k<=n;k++){
			table[i][k]=0;
		}
		time_table[i][0]=0;
		time_table[i][1]=0;
	}

	for(int i=1;i<=n;i++){
		scanf("%d %d",&row,&num);
		for(int k=1;k<=num;k++){
			scanf("%d",&col);
			table[row][col]=1;
		}
	}

	for(int i=1;i<=n;i++){
		func(i);
	}

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

    return 0;
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}
template<typename T>vector<T> & cset(vector<T> &A,T e=T()){for(auto &I:A){I=e;} return A;}


int main(){
  ll n;
  cin>>n;
  vector<ll> A(n);
  cin>>A;
  vector<ll> B=A;
  sort(B.begin(),B.end());
  bool jd=(B==A);
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      swap(A[i],A[j]);
      if(A==B){jd=true;}
      swap(A[i],A[j]);
    }
  }
  cout<<(jd?"YES":"NO")<<endl;
  
  return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn

object Main {
  def main(args: Array[String]): Unit = {
    val length = StdIn.readInt
    val array = StdIn.readLine().split(" ").map(_.toInt)
    val problemLen = StdIn.readInt
    val problemArray = StdIn.readLine().split(" ").map(_.toInt)

    for (m <- problemArray) if (solve(0, m, array)) println("yes") else println("no")

  }

  def solve (i: Int, m: Int, array: Array[Int]): Boolean = {
    if (m == 0) return true
    if (i >= array.length) return false
    solve(i + 1, m, array) || solve(i + 1, m - array(i), array)
  }
}

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

int main() {
  int N;
  string S;
  bool f = false;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> S;
    if (S == "Y") {
      f = true;
      break;
    }
  }
  if (f)
    cout << "Four" << endl;
  else
    cout << "Three" << endl;
}


Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<double, double >pd;
typedef pair<string, string> sP;
typedef pair<ll, pair<ll, ll>> PP;


const ll mod = 1e4;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const double eps = 1e-10;
const double PI = 3.14159265358979323846;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second




int main() {
	int n, m, a, b, ans = 0;
	P p[100010];
	cin >> n >> m;
	for (int i = 0;i < m;i++) {
		cin >> a >> b;
		p[i] = P(b, a);
	}
	sort(p, p + m);
	int t = 0;
	for (int i = 0;i < m;i++) {
		if (t <= p[i].sc) {
			ans++;
			t = p[i].fr;
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define int long long
#define ci(m)     for(int i=0;i<m;i++)
#define cj(m)     for(int j=0;j<m;j++)
#define ck(m)     for(int k=0;k<m;k++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;
int n,m;
int ans=INT_MAX;
int a[500][500];
void solve(int num,set<int>&s)
{
    if(num==m)
    {
        return ;
    }
    vector<int>v(m+1,0);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(s.count(a[i][j]))
                continue;
            else
            {
                v[a[i][j]]++;
                break;
            }
        }
    }
    int val=maxe(v.begin(),v.end());
    ans=min(ans,val);
    for(int i=1;i<=m;i++)
    {
        if(v[i]==val)
        {
            s.insert(i);
            solve(num+1,s);
            return;
        }
    }
}
int32_t main() {
    nitin;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cin>>a[i][j];
        }
    }
    set<int>s;
    solve(0,s);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5468