akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_152
{
    class C
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] ps = ReadInts();
            int min = int.MaxValue;
            int res = 0;
            for(int i = 0; i < n; i++)
            {
                if (min >= ps[i]) res++;
                min = Min(min, ps[i]);
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 31068
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int H,W;
    cin >>H>>W;
    vector<vector<char>> vec(H,vector<char>(W));
    for (int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> vec.at(i).at(j);
        }
        
    }
    vector<bool> row(H,false);
    vector<bool> col(W,false);
    //2こにわけてることで縦の３全部＝true などとできてる
    for( int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(vec.at(i).at(j)=='#'){
                row.at(i)= true;
                col.at(j)= true;
            }
        }
    }
    for(int i=0;i<H;i++){
        if(row.at(i)){
            for(int j=0 ; j<W ; j++){
                if(col.at(j)){
                       cout << vec.at(i).at(j);
                }
            }
          }
          cout<< endl;
    }
}

Measured memory_bytes: 256
import java.io.PrintWriter
import java.util.*
import java.math.*

val pw = PrintWriter(System.out)

fun main(args: Array<String>) {
    val r = readInt()
    val g = readInt()

    println(2 * g - r)
    pw.flush()
}

fun inputList() = 
    readLine()!!.split(" ").map(String::toInt)

fun sum_digits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

/****** Decrared Functions ******/

// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }


fun println(value : Any) {
    pw.println(value)
}

fun gcd(a: Long, b: Long): Long = 
    if(b != 0L) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
    if(b==0L) a else gcd(b, a % b)


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

int main(){
    string s;	cin >> s;
    ll aptr = 0;
    ll zptr = s.size() - 1;
    while(s[aptr] != 'A') aptr++;
    while(s[zptr] != 'Z') zptr--;
    cout << zptr-aptr+1 << endl;
}


Measured memory_bytes: 640
import java.math.BigInteger;
import java.util.Scanner;
import java.io.PrintWriter;
import java.util.ArrayList;

public class Main {
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int V = sc.nextInt();
		int E = sc.nextInt();
		ArrayList<Integer>[] g = new ArrayList[V];
		for (int i = 0; i < V; ++i) {
			g[i] = new ArrayList<>();
		}
		for (int i = 0; i < E; ++i) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			g[s].add(t);
		}
		vis = new boolean[V];
		sort(g);
		for (int i = lis.size() - 1; i >= 0; --i) {
			System.out.println(lis.get(i));
		}
	}

	static boolean[] vis;
	static ArrayList<Integer> lis = new ArrayList<>();

	static void sort(ArrayList<Integer>[] g) {
		int n = g.length;
		for (int i = 0; i < n; ++i) {
			if (!vis[i]) {
				dfs(i, -1, g);
			}
		}
	}

	static void dfs(int cur, int pre, ArrayList<Integer>[] g) {
		for (int to : g[cur]) {
			if (pre != cur && !vis[to]) {
				dfs(to, cur, g);
			}
		}
		vis[cur] = true;
		lis.add(cur);
	}
}

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

int main(){
	int n;
	cin>>n;
	string s[n];
	for(int i=0;i<n;i++){
		cin>>s[i];
		sort(s[i].begin(),s[i].end());
	}
	sort(s,s+n);
	long long ct = 0;
	int i = 0;
	while(i<n){
		//cout<<s[i]<<endl;
		int j = i+1;
		//cout<<s[j]<<endl;
		long long c = 0;
		while(j<n && s[i] == s[j]){
			j++;
			c++;
		}
		/*if(c == 1)
			ct++;
		else*/
			ct += c*(c+1)/2;
		i = j;
	}
	cout<<ct;
	return 0;
}

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

int main(){

	int w, h ; cin >> w >> h ;

	int x, y ; cin >> x >> y ;

	cout << setprecision(9) << fixed ;

	cout << 1.0 * w * h / 2 << " " << ((2 * x == w) && (2 * y == h)) << endl ;

	return 0 ;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

    int a,b;
    int d,r;
    double f;
    
    scanf("%d %d",&a,&b);

    d=a/b;
    r=a%b;
    f=1.000000*a/b;
    
    printf("%d %d %.7lf\n",d,r,f);
    
    return 0;
    
}

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int grid[52][52];
bool visited[52][52];
vector<pair<int, int>> vec; 
set<int> st;

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

void init(){
    rep(i, 52)  rep(j, 52) {grid[i][j] = -1; visited[i][j] = false;}
}

void dfs(int sx, int sy, int px, int py){
    visited[sx][sy] = true;
    vec.push_back(make_pair(sx, sy));
    rep(i, 4){
        int nx = sx + dx[i];
        int ny = sy + dy[i];
        if(grid[nx][ny] == 0){
            if(!visited[nx][ny]) dfs(nx, ny, sx, sy);
        }
        else if(grid[nx][ny] == 1) st.insert(1);
        else if(grid[nx][ny] == 2) st.insert(2);
    }
}

int main(void){
    int W, H;
    vector<pair<int, int>> ans;
    while(true){
        init();
        int black = 0, white = 0;
        cin >> W >> H;
        if(W == 0) break;
        string S;
        rep(i, H){
            cin >> S;
            rep(j, W){
                if(S[j] == 'W'){
                    grid[i+1][j+1] = 1;
                }
                else if(S[j] == 'B'){
                    grid[i+1][j+1] = 2;
                }
                else{
                    grid[i+1][j+1] = 0;
                }
            }
        }
        for(int i = 1; i <= H; i++){
            for(int j = 1; j <= W; j++){
                if(grid[i][j] == 0 && !visited[i][j]){
                    dfs(i, j, -1, -1);
                    if(st.size() == 1){
                        if(st.count(1)) white += vec.size();
                        else black += vec.size();
                    }
                    st.clear();
                    vec.clear();
                }
            }
        }
        ans.push_back(make_pair(black, white));
    }
    rep(i, ans.size()) cout << ans[i].first << " " << ans[i].second << endl;
    return 0;
}


Measured memory_bytes: 3280
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int count = 0;
        for(int i = 0; i < n; i++){
            int d1 = sc.nextInt();
            int d2 = sc.nextInt();
            if(d1 == d2){
                count++;
                if(count == 3){
                    System.out.println("Yes");
                    return;
                }
            }else{
                count = 0;
            }
        }
        System.out.println("No");
    }
}


Measured memory_bytes: 36092
#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end()
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

int solve(int N,int X)
{
    int ans = 0;

    repc(i, 1, N + 1){
        repc(j, i + 1, N + 1){
            repc(k, j + 1, N + 1){
                if(i + j + k == X){
                    ans++;
                }
            }
        }
    }
    return ans;
}

int main()
{
    int N,X;

    while(true){
        cin >> N >> X;
        if(N + X == 0){
            return 0;
        }

        cout << solve(N,X) << endl;
    }
}


Measured memory_bytes: 3084
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Hamza Hasbi
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        B_Varied solver = new B_Varied();
        solver.solve(1, in, out);
        out.close();
    }

    static class B_Varied {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            char[] s = in.next().toCharArray();
            int[] mp = new int[26];
            Arrays.fill(mp, 0);
            for (char c : s) {
                if (mp[c - 'a'] > 0) {
                    out.printLine("no");
                    return;
                }
                mp[c - 'a']++;
            }
            out.printLine("yes");
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void printLine(String s) {
            writer.println(s);
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer st;

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

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

    }
}



Measured memory_bytes: 21332
import java.util.*;

public class Main {
  public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int a = sc.nextInt();
    	int b = sc.nextInt();
    	if(a < 10 && b < 10) {
          System.out.println(a * b);
        } else {
          System.out.println(-1);
        }
  }
}

Measured memory_bytes: 22612
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>

static const int MOD = 1000000007;
using ll = int64_t;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<ll> v(n);
    for (auto &&i : v) scanf("%li", &i);
    vector<ll> dp(n+1, INF<ll>);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        ll l = v[i], r = v[i];
        for (int j = i; j >= max(0, i-m+1); --j) {
            chmin(dp[i+1], dp[j]+(r-l)*(i-j+1)+k);
            if(j) chmax(r, v[j-1]), chmin(l, v[j-1]);
        }
    }
    cout << dp[n] << "\n";
    return 0;
}



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

int main()
{
    string s;
    cin >> s;
    if(s == "SUN") cout << 7 << endl;
    if(s == "MON") cout << 6 << endl;
    if(s == "TUE") cout << 5 << endl;
    if(s == "WED") cout << 4 << endl;
    if(s == "THU") cout << 3 << endl;
    if(s == "FRI") cout << 2 << endl;
    if(s == "SAT") cout << 1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<sstream>
#include<cmath>
#include<iterator>
#include<bitset>
#include<stdio.h>
using namespace std;
#define _for(i,a,b) for(int i=(a);i<(b);++i)
#define _rep(i,a,b) for(int i=(a);i<=(b);++i)
typedef long long ll;
int readint() { int x; cin >> x; return x; }
const int INF = 1 << 30;
const int maxn = 20;

int main()
{
    int a,b,c,x,y;
    while(cin>>a>>b>>c>>x>>y){
        ll ans=INF;
        if(x>y)swap(a,b),swap(x,y);
        ans=min(1ll*a*x+1ll*b*y,ans); 
        int t=x*2;
        ans=min(ans,1ll*(y-x)*b+1ll*t*c); 
        t=y*2;
        ans=min(ans,1ll*t*c);
        cout<<ans<<endl;
    }
	return 0;
}

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

int main(int argc, const char * argv[]) {
    string nameHead = "MARCH";
    int str[5] = {0};
    int N; cin >> N;
    for(int i = 0; i < N; i++) {
        string inp; cin >> inp;
        for(int j = 0; j < 5; j++) {
            if(nameHead[j] == inp[0]) str[j]++;
        }
    }
    long long sum = 0;
    for (int i = 0; i < 5; i++) {
        for (int j = i+1; j < 5; j++) {
            for (int k = j+1; k < 5; k++) {
                sum += str[i] * str[j] * str[k];
            }
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace CODEFESTIVAL2016_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var sn = new char[s.Length + 1];
            for(var i=0;i<s.Length+1;i++)
            {
                if(i==4)
                {
                    sn[4] = ' ';
                }
                else if(i<4)
                {
                    sn[i] = s[i];
                }
                else
                {
                    sn[i] = s[i - 1];
                }
            }
            var st = new String(sn);
            Console.WriteLine(st);
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;
typedef long long ll;

struct node{
    int parent;
    vector<int> child;
    ll cnt;
};

int main(){

    int n; cin >> n;
    int q; cin >> q;

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

    int p[q], x[q];
    for(int i=0; i<q; i++){
        cin >> p[i] >> x[i];
        p[i]--;
    }

    vector<int> g[n];
    vector<int> vempty;
    // for(int i=0; i<n-1; i++){
    //     g[i].push_back(vempty);
    // }

    for(int i=0; i<n-1; i++){
        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
    }
    
    node nd[n];
    for(int i=0; i<n; i++){
        nd[i] = {-1, vempty, 0};
    }

    queue<int> que;
    que.push(0);
    while(!que.empty()){
        int now = que.front();
        que.pop();

        for(int i=0; i<g[now].size(); i++){
            int to = g[now][i];
            if(nd[now].parent != to){
                nd[now].child.push_back(to);
                nd[to].parent = now;
                que.push(to); 
            }
        }
    }

    // cout << nd[0].parent << endl;
    // cout << nd[1].parent << endl;
    // cout << nd[2].parent << endl;
    // cout << nd[3].parent << endl;

    // for(int i=0; i<n; i++){
    //     for(int j=0; j<nd[i].child.size(); j++){
    //         cout << i << " " << nd[i].child[j] <<endl;
    //     }
    // }

    for(int i=0; i<q; i++){
        // cout << p[i] << " " << x[i] << endl;
        nd[p[i]].cnt += x[i];
    }

    // for(int i=0; i<n; i++){
    //     cout << nd[i].cnt << " ";
    // }

    que.push(0);
    while(!que.empty()){
        int now = que.front();
        que.pop();

        for(int i=0; i<nd[now].child.size(); i++){
            int to = nd[now].child[i];
            // cout << "i: " << i << " " << nd[i].child.size() << endl;
            // cout << now << " " << to << endl;
            nd[to].cnt += nd[now].cnt;
            que.push(to);
        }
    }

    for(int i=0; i<n; i++){
        cout << nd[i].cnt << " ";
    }

    return 0;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> fg(M,0);
  for(int i = 0; i < N; i++){
   int kac;
    cin >> kac;
    for(int j = 0; j < kac; j++){
      int sayi;
      cin >> sayi;
      fg[sayi-1]++;
    }
  }
  int tot = 0;
  for(int i= 0; i < M; i++){
  	if(fg[i] == N) tot++;
  }
  cout << tot;


}


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

LL cost[15][15];

int main(){
	ios_base::sync_with_stdio(0);
	
	int h, w;
	LL ans=0;
	cin >> h >> w;
	for(int i=0; i<10; i++){
		for(int j=0; j<10; j++)
			cin >> cost[i][j];
	}
	
	//floyd warshall
	for(int i=0; i<10; i++){
		for(int j=0; j<10; j++){
			for(int k=0; k<10; k++){
				cost[j][k]=min(cost[j][k], cost[j][i]+cost[i][k]);
			}
		}
	}
	
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			int in;
			cin >> in;
			if(in > -1)
				ans+=cost[in][1];
		}
	}
	
	cout << ans << "\n";
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int k,a,b;
	cin>>k;
	cin>>a>>b;
	int largest=(b/k)*k;
	if(a<=largest)
	{
		cout<<"OK";
	}
	else
	{
		cout<<"NG";
	}
	return 0;
}

Measured memory_bytes: 3580
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_Training
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var d = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var result = 0;
            for(int i = 0; i < n; i++)
            {
                for(int j = i+1; j < n; j++)
                {
                    result += d[i] * d[j];
                }
            }
            Console.WriteLine(result);
        }
    }
}


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

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<pair<int, int>, int> PP;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
//------------------------------------------------------------------------------------------------------------------------------

int main(void) {
    int ma = -1, sum = 0;
    for (int i = 0; i < 3; i++) {
        int n;
        cin >> n;
        ma = max(ma, n);
        sum += n;
    }
    if ((3 * ma - sum) % 2 == 0) cout << (3 * ma - sum) / 2 << endl;
    else cout << (3 * ma + 3 - sum) / 2 << endl;
}


Measured memory_bytes: 256
import sys
n, m = [int(i) for i in sys.stdin.readline().split()]
a_ls = set()
MOD = 10**9+7
for i in range(m):
    a = int(sys.stdin.readline())
    a_ls.add(a)

memo_ls = [0 for i in range(n+1)]
memo_ls[0] = 1
for i in range(1, n+1):
    if i in a_ls:
        memo_ls[i] = 0
    else:
        memo_ls[i] = memo_ls[i-1] + memo_ls[i-2]
    memo_ls[i] %= MOD
print(memo_ls[-1])

Measured memory_bytes: 52568
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
void mysort(vector<ll> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<pll> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll n ; cin >> n ;
	vll b(n) ;
	for(int i=0;i<n;i++){
		ll a ; cin >> a ;
		b.at(i) = a-i-1 ;
	}
	mysort(b) ;
	ll sub = b.at(n/2) ;
	ll ans = 0 ;
	for(int i=0;i<n;i++){
		ll a = b.at(i)+1+i ;
		ans += sa(a,sub+1+i) ;
	}
	cout << ans << endl ;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int l; cin >> l;
    double ans = (double)pow((double)l/3, (double)3);
    cout << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
program ABC173C
    implicit none
    integer(8)::H,W,K,i,j,l,m,b_all=0,ans=0,calc
    character(8)::i_bit,j_bit
    character(6)::C(6)
    read*,H,W,K
    do i=1,H
        read*,C(i)
    end do

    do i=1,H
        do j=1,W
            if(C(i)(j:j)=="#")b_all=b_all+1
        end do
    end do

    do i=0,2**H-1
        write(i_bit,'(b8.8)')i
        do j=0,2**W-1
            write(j_bit,'(b8.8)')j
            calc=b_all
            !行方向
            do l=8-H+1,8
                if(i_bit(l:l)=="1")then
                    do m=1,W
                        if(C(l-8+H)(m:m)=="#")calc=calc-1
                    end do
                end if
            end do

            !列方向
            do l=8-W+1,8
                if(j_bit(l:l)=="1")then
                    do m=1,H
                        if(C(m)(l-8+W:l-8+W)=="#".and.i_bit(8-H+m:8-H+m)=="0")calc=calc-1
                    end do
                end if
            end do
            if(calc==K)ans=ans+1
        end do
    end do
    print'(i0)',ans
end program ABC173C

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

int main()
{
    string s,t;
    cin >> s >> t;

    sort(s.begin(),s.end());
    sort(t.rbegin(),t.rend());

    cout << (s < t ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
n,t = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]
ab0 = []
ab1 = []
for i in range(n):
  if ab[i][0] == 0:
    ab0.append(ab[i][1])
  else:
    ab1.append(ab[i])
ab0.sort()
ab1.sort(key = lambda x:x[0]/(x[1]+1),reverse=True)
n = len(ab1)
dp = [[10**10 for i in range(31)] for j in range(n+1)]
for i in range(n+1):
  dp[i][0] = 0
for i in range(1,n+1):
  a,b = ab1[i-1]
  for j in range(1,31):
    dp[i][j] = min(dp[i-1][j],dp[i-1][j-1]+1+a*(dp[i-1][j-1]+1)+b)
m = len(ab0)
ans = 0
for j in range(31):
  if dp[n][j] > t:
    continue
  anstmp = j
  ttmp = t-dp[n][j]
  i = 0
  while i <= m-1 and ttmp >= ab0[i]+1:
    ttmp -= ab0[i]+1
    anstmp += 1
    i += 1
  ans = max(ans,anstmp)
print(ans)

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

int main() {
  int a,b,x; cin >> a >> b >> x;
  if(a > x || a+b < x){
    cout << "NO";
  }
  else{
    cout << "YES";
  }
}

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

bool has_key(unordered_map<string, ll> &m, string s){
    if (m.find(s) == m.end()){
        return false;
    }
    else{
        return true;
    }
}


bool vector_find(std::vector<ll> vec, ll number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) {
    return true;
  }
  else {
    return false;
  }
}


void recursive_comb(int *indexes, int s, int rest, std::function<void(int *)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}


void foreach_comb(int n, int k, std::function<void(int *)> f) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k, f);
}


int main() {

    long double A, B;
    
    cin >> A >> B;    

    long double ans;


    ans = floor(A * B);

    cout << std::setprecision(20) << ans << endl;

    return 0;
}

Measured memory_bytes: 3832
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 5e18;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

ll gcd(ll a, ll b) {
    if(b == 0) return a;
    return gcd(b, a%b);
}

struct RECT{
    ll l;
    ll r;
    ll t;
    ll b;

    RECT(){}
    RECT(ll x1, ll y1) :
    l(x1), r(x1), t(y1), b(y1) {}

    ll sq() {
        return (r - l) * (t - b);
    }

    void update(ll x, ll y) {
        if (x > r) r = x;

        if (x < l) l = x;

        if (y > t) t = y;

        if (y < b) b = y;
    }

    void print() {
        cout << l << " " << r << " " << t << " " << b << " " << endl;
    }
};

inline ll sq(ll r, ll l, ll t, ll b) {
    assert(r >= l);
    assert(t >= b);
    return (r - l) * (t - b);
}


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

    ll x[N], y[N];
    RECT R[N];
    REP(i, N) {
        cin >> x[i] >> y[i];
    }

    ll ans = INF;
    REP(l, N) REP(r, N) {
        ll left = x[l], right = x[r];
        if (right < left) continue;
        REP(b, N) REP(t, N) {
            ll bottom = y[b], top = y[t];
            if (top < bottom) continue;
            int cnt = 0;
            REP(i, N) {
                if (x[i] <= right && x[i] >= left && y[i] <= top && y[i] >= bottom) ++cnt;
            }

            ll s = sq(right, left, top, bottom);
            if (cnt >= K && ans > s) {
                ans = s;
            }
        }
    }

    cout << fixed << setprecision(20);
    cout << ans << endl;

}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int a,b,c,d,i;
    int xx=0;
    int x=0,y=0,cnt=0;

    scanf("%d%d%d%d",&a,&b,&c,&d);
    xx = a+b+c+d;
    for(;;){
        xx -= 60;
        cnt++;
        if(xx < 60)break;
    }
    y = cnt;
    x = xx;

    printf("%d\n%d\n",y,x);
    return 0;
}

Measured memory_bytes: 596
import sys

while True:
	h, w = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	if 0 ==h and 0 == w:
		break
	for i in range( h ):
		if 0 == i or h-1 == i:
			print( "#"*w )
		else:
			print( "#"+"."*(w -2)+"#"  )
	print( "" )

Measured memory_bytes: 4208
//2018年  3月 26日 月曜日 14:59:29 JST
#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 N, M;
vi G[MAX_N];
bool used[MAX_N];

void loop(int v) {
	used[v] = true;
	rep(i, 0, sz(G[v])) {
		int n = G[v][i];
		if(!used[n]) loop(n);
	}
}

void solve() {
	cin >> N >> M;
	rep(i, 0, N) {
		int K; cin >> K;
		rep(j, 0, K) {
			int a; cin >> a; a--;
			G[i].pb(a + N);
			G[a + N].pb(i);
		}
	}
	loop(0);
	if(accumulate(used, used + N, 0) != N) {
		cout << "NO\n";
	}
	else cout << "YES\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: 8832
#include<bits/stdc++.h>

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

const int INF = 0x3f3f3f3f;

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
 
//int in() { int x; scanf("%d", &x); return x; }
//ll lin() { ll x; scanf("%lld", &x); return x; }
//void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }

const int m = 2019;

int main(void){
    std::ios_base::sync_with_stdio(false);

    int a,b;
    cin >> a >> b;
    cout << a*b;
    return 0;
}

Measured memory_bytes: 3568
package main

import (
	"fmt"
)

func min(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	r := n % k

	fmt.Println(min(r, k-r))
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;


int main(void)
{
    int n,k;
    cin >> n >> k;
    pr(n-(k-1));
    
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 500005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll fac[maxn],inv[maxn],n,k,len;
const ll mod=1000000007;

inline ll pw(ll a,ll b)
{
	ll ans=1,base=a;
	while(b)
	{
		if(b&1) ans=(ans*base)%mod;
		base=(base*base)%mod; b>>=1;
	}
	return ans;
}

inline ll C(int N,int M){return (fac[N]*inv[M]%mod)*inv[N-M]%mod;}

int main()
{
	fac[0]=1; inv[0]=1;
	rep(i,1,(maxn-5)) fac[i]=(fac[i-1]*i)%mod;
	rep(i,1,(maxn-5)) inv[i]=pw(fac[i],mod-2);
	cin>>n>>k; ll tmp=(fac[n]*C(k,n))%mod,p=0;
	for(int i=0;i<=n;i++)
	{
		ll nw=pw(-1,i),p2=((C(n,i)*fac[n-i])%mod*C(k-i,n-i))%mod; p2*=nw;
		//cout<<p2<<endl;
		p=(p+p2+mod)%mod;
	}
	cout<<(p*tmp)%mod<<endl;
	
	return 0;
}

Measured memory_bytes: 11444
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (int i = 0; i< (n); ++i)
const long long INF = 1LL<<58;

// aを常に小さい値にする　大きい値にする
template<class T> bool chmin(T &a, T b){ if(a>b) a = b; }
template<class T> void chmax(T &a, T b){ if(a<b) a = b; }

// 二分探索 前方のindexを返すもの（自分自身を含む） 前方: -INF側のこと
template<class T> int former(const vector<T> &v, T x){
    return upper_bound(v.begin(), v.end(), x) - v.begin() -1; // upper_bound : keyより大きい要素の内の一番左側のイテレータを返す
}
// 二分探索 後方のindexを返すもの（自分自身を含む）後方: INF側のこと
template<class T> int latter(const vector<T> &v, T x){
    return lower_bound(v.begin(), v.end(), x) - v.begin(); // lower_bound : key以上の要素の内の一番左側のイテレータを返す
}

// 最大公約数を求める GCD
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }

/*
 * 素因数分解っぽいテーマの問題。こういうのは「まずは素数べきで考える」というのが 1 つの定石ではある。p を素数として

    a1×a2×...×aN=pk
    を満たす (a1,a2,...,aN) が何通りあるかを考える。これは実は、p の指数に着目して ai=pxi として、

    x1+x2+...+xN=k
    を満たす 0 以上の整数 (x1,x2,…,xN) が何通りあるかを数え上げる問題と考えることができる。

    これは重複組合せ！！！！！
    重複組合せは、「仕切りを使って考える」というのが 1 つの見方ではある。（●と｜を並べて考えるというものである）
    【N 個の玉と、k−1 個の仕切りの並び替え方を数える問題】
    nHk = c+k-1Ck で求められる

    M が素数べきについての考察を終えたので、一般の合成数について考えることになるのだが、実は各素因子についてまったく独立に考えることができる。
    つまり、上記のことを各素因子ごとに独立に行って、得られた結果を掛け算していけば OK。

 *
 * */


// 素因数分解 pair
vector<pair<ll, ll> > prime_factorize(ll n) {
    vector<pair<ll, ll> > res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) {
            ++num;
            n /= p;
        }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

const int MAX = 210000;
const int MOD = 1000000007;

//  二項係数の計算nCk セット
//  https://drken1215.hatenablog.com/entry/2018/06/08/210000
//  使い方としては、最初に一度前処理として COMinit() をしておけば、あとは COM(n, k) 関数を呼べばよい
//  前処理 COMinit(): O(n)
//　クエリ処理 COM(n, k): O(1)
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/**
 * // 前処理
    COMinit();

    // 計算
    cout << COM(100000, 50000) << endl;
    のようにつかう
 */
int main() {

    int N, M;
    COMinit();
    cin >> N >> M;
    auto vec = prime_factorize(M);
    long long res = 1;
    for (auto pa : vec) {
        int num = pa.second;
        long long tmp = COM(num+N-1, N-1);
        res = (res * tmp) % MOD;
    }
    cout << res << endl;
}

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

int main(){
    int H, W;
    cin >> H >> W;
    int sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;
    sx--; sy--; gx--; gy--;
    string S[1000];
    for(int i=0; i<H; i++) cin >> S[i];

    auto inside = [&](int i, int j){ return i>=0 && i<H && j>=0 && j<W && S[i][j] == '.'; };

    vector<vector<int>> dist(H, vector<int>(W, 1e9));
    deque<pair<int, int>> que;
    dist[sx][sy] = 0;
    que.emplace_back(sx, sy);

    while(que.size()){
        auto [i, j] = que.front(); que.pop_front();
        for(int x=i-2; x<=i+2; x++) for(int y=j-2; y<=j+2; y++) if(inside(x, y)){
            int warp = (abs(x-i) + abs(y-j) != 1);
            int d = dist[i][j] + warp;
            if(d < dist[x][y]){
                dist[x][y] = d;
                if(warp){
                    que.emplace_back(x, y);
                }else{
                    que.emplace_front(x, y);
                }
            }
        }
    }

    int ans = dist[gx][gy];
    if(ans == 1e9) ans = -1;
    cout << ans << endl;
    return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        var n = Console.ReadLine().Split(' ');
        var a = int.Parse(n[0]);
        var b = int.Parse(n[1]);

        var ans1 = a + b;
        var ans2 = a - b;
        var ans3 = a * b;

        var ret = 0;
        if (ans1 >= ans2 && ans1 >= ans3)
        {
            ret = ans1;
        }
        else if (ans2 >= ans1 && ans2 >= ans3)
        {
            ret = ans2;
        }
        else
        {
            ret = ans3;
        }

        Console.Write(ret);
    }
}

Measured memory_bytes: 11092
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        long x = sc.nextLong();
        long y = sc.nextLong();

        long ans = 1;

        long now = x;

        while (true) {
            now *= 2;
            if (now <= y) {
                ans++;
            } else {
                break;
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 23764
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
        String s=sc.next();
        String t=sc.next();

        for(int i=0; i<=n-1; i++){
            System.out.print(s.substring(i,i+1)+t.substring(i,i+1));
        }
    }
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)


void func(long long N, long long K, std::vector<long long> A){
    lli left = N-K;
    lli ans = 1;
    cout<<( ans + (left/(K-1))+ (left%(K-1)!=0))<<endl;
}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    func(N, K, std::move(A));
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    int N;
    int s=3;

    vector<vector<int>> A(s, vector<int>(s));
    rep(i,s){
        rep(j,s){
            cin >> A.at(i).at(j);
        }
    } 
    cin >> N;
    vector<int> b(N);
    rep(i,N) cin >> b.at(i);

    vector<vector<int>> C(s, vector<int>(s,0));

    rep(i,s){
        rep(j,s){
            rep(k,N){
                if(A.at(i).at(j)==b.at(k)) C.at(i).at(j) = 1;
            }
        }
    } 

    string ans = "No";

    // 行 or 列
    rep(i,s){
        int seki = 1;
        int seki2 = 1;
        rep(j,s){
            seki *= C.at(i).at(j); // 行
            seki2 *= C.at(j).at(i); // 列
        }
        if(seki!=0 || seki2!=0) ans = "Yes";
    } 

    // 斜め
    int seki = 1;
    int seki2 = 1;
    rep(i,s){
        seki *= C.at(i).at(i);
        seki2 *= C.at(i).at(2-i);
    }          
    if(seki!=0 || seki2!=0) ans = "Yes"; 

    cout << ans;
    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict 

n,m = map(int, input().strip().split(" "))

dp = [-1]*n

def root(x):
    if dp[x] < 0:
        return x
    return root(dp[x])

def unite(x, y):
    rx = root(x)
    ry = root(y)
    
    if rx == ry:
        return False
        
    if dp[rx] > dp[ry]:
        rx,ry = ry,rx
        
    dp[rx] += dp[ry]
    dp[ry] = rx
    return True

def size(x):
    return -dp[root(x)]

for i in range(m):
    a,b = map(int, input().strip().split(" "))
    a-=1
    b-=1
    unite(a,b)
    
ans = 0
for i in range(n):
    ans = max(ans, size(i))
    
print(ans)
    

Measured memory_bytes: 15016
import java.util.*;
public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		//String word_before = sc.next();
		int array[][] = new int[3][3];
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				array[i][j] = sc.nextInt();
			}
		}
		int N = sc.nextInt();
//		int K = sc.nextInt();
		for (int i = 0; i < N; i++) {
			int b = sc.nextInt();
			for (int j = 0; j < 3; j++) {
				for (int j2 = 0; j2 < 3; j2++) {
					if(array[j][j2]==b){
						array[j][j2] =0;
					}
				}
			}
			
		}
		boolean flag = false;
		for (int i = 0; i < 3; i++) {
			if(array[i][0]==array[i][1]&&array[i][1]==array[i][2]){
				flag  = true;
			}
		}
		for (int i = 0; i < 3; i++) {
			if(array[0][i]==array[1][i]&&array[1][i]==array[2][i]){
				flag  = true;
			}
		}
		if(array[0][0]==array[1][1]&&array[1][1]==array[2][2]||array[2][0]==array[1][1]&&array[1][1]==array[0][2]){
			flag = true;
		}

		if(flag){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}		
		
      	sc.close();
    }
		
		
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"

	

int main(){
   
    int n;
    cin>>n;
    vector <double> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
        v[i]= 1/v[i];
    }
     for(int i=1;i<n;i++){
        v[i]= v[i]+v[i-1];
    }
    cout<<setprecision(9)<<(1/v[n-1]);
    return 0;
}

Measured memory_bytes: 256
/*
They turn the lights down low,
In shadows hiding from the world,
Only coming out when it gets cold

The seas part when they hit the floor,
The voices carry on and out the door
And everything you touch turns into gold

Like the angel you are you laugh creating
A lightness in my chest,
Your eyes they penetrate me,
(your answer's always 'maybe')
That's when I got up and left

A beating heart and a microphone,
A ticking clock in an empty home
Still tells of these times so long ago,

Even though I've come so far,
I know I've got so far to go
And any day now I'll explode

Like the angel you are you laugh creating
A lightness in my chest,
Your eyes they penetrate me,
(your answer's always 'maybe')
That's when I got up and left

And each and everyday will lead into tomorrow
Tomorrow brings one less day without you
But don't wait up just leave the light on
'Cause all the roads that I might take
Will all one day lead back to you

And like the angel you are you laugh creating
A lightness in my chest,
Your eyes they penetrate me,
(never cease to amaze me)
That's when I got up and left
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery

#define eps 1e-12
#define M_PI 3.141592653589793
#define bsize 300

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 600031;

int n,s,mx;

int k;
vector<int> order;
vector<int> seg;
int ans;

int main(){
//    freopen("apache.in","r",stdin);
//    freopen("apache.out","w",stdout);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    //ios_base::sync_with_stdio(0);
    //cin.tie(0);

	cin>>k>>n;
	for (int i=0;i<n;i++){
		int val;
		cin>>val;
		order.push_back(val);
	}
	sort(order.begin(),order.end());

	for (int i=1;i<order.size();i++){
		seg.push_back(order[i]-order[i-1]);
	}

	sort(seg.begin(),seg.end());

	int should_take=max(n-k,0);

	for (int i=0;i<should_take;i++){
		ans+=seg[i];
	}
	cout<<ans<<endl;

//    cin.get(); cin.get();
    return 0;
}


Measured memory_bytes: 1400