akhauriyash/Code-Regression huggingface dataset:
import sys
#import time
import copy
#from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import heapq
#import time

input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def find(self, x):
        if(self.root[x] < 0):
            return x
        else:
            self.root[x] = self.find(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if(x == y):
            return 
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def same(self, x, y):
        return self.find(x) == self.find(y)
    # ノードxが属する木のサイズを返す
    def size(self, x):
        return -self.root[self.find(x)]


n = ri()
d1=[tuple(rl())+tuple((i,)) for i in range(n)]
d2=copy.deepcopy(d1)

d1.sort(key=lambda x:x[0])
d2.sort(key=lambda x:x[1])
edge=[]
for i in range(n-1):
    edge.append((d1[i+1][2], d1[i][2],d1[i+1][0]-d1[i][0]))
    edge.append((d2[i+1][2], d2[i][2],d2[i+1][1]-d2[i][1]))


    
edge.sort(key=lambda x: x[2])
res=0
uf = UnionFind(n)
for e in edge:
    if uf.same(e[0], e[1]):
        continue
    uf.unite(e[0], e[1])
    res+=e[2]
print(res)

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

int main(){
  int a,b,c,d,p;
  while(cin >> a >> b >> c >> d >> p){
    int x=p*a;
    int y=0;
    int ans;
    if(p-c>1){
      y=b+(p-c)*d;
    }else{
      y=b;
    }

    ans = min(x,y);
    cout << ans << endl;
  }
  return 0;
}

    
    



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

public class Main{
	public static void main(String args[]){
		try{
			new Main();
		}catch(IOException err){
			err.printStackTrace();
		}
	}

	public Main() throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		List<String> Ans = new ArrayList<String>();
		String line;

		while((line = in.readLine()) != null){
			List<Integer> rest = new ArrayList<Integer>();
			String[] dst = line.split(" ");
			int p = Integer.parseInt(dst[0]);
			int q = Integer.parseInt(dst[1]);

			if(p == 0 && q == 0){
				break;
			}

			rest.add(p);

			String num = "";
			String repeat = "";

			while(true){
				int x = 10 * p / q;
				p = 10 * p - x * q;
				num += Integer.toString(x);

				if(p == 0){
					break;
				}

				if(rest.contains(p)){
					int start = rest.indexOf(p);
					for(int i=0; i<rest.size(); i++){
						if(i<start){
							repeat += " ";
						}else{
							repeat += "^";
						}
					}
					break;
				}
				rest.add(p);


			}

			Ans.add(num);
			if(repeat.length() != 0){
				Ans.add(repeat);
			}
		}

		for(int i=0; i<Ans.size(); i++){
			System.out.println(Ans.get(i));
		}
	}
}

Measured memory_bytes: 10000
O = input()
E = input()
o = []
e=[]
ans = []

for i in range(len(O)):
  o.append(O[i])
  
for j in range(len(E)):
  e.append(E[j])
  
if len(o) == len(e):
  for k in range(len(o)):
    ans.append(o[k])
    ans.append(e[k])
    
  print("".join(ans))
  exit()
  
if len(o) != len(e):
  for l in range(len(e)):
    ans.append(o[l])
    ans.append(e[l])
    
  ans.append(o[-1])
  print("".join(ans))
  exit()
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define all(a) a.begin(),a.end()
#define lb(s,x) lower_bound(all(s),x)-s.begin()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define INF 1e9
typedef long long ll;

int main(void){
    int n,m;
    cin>>n>>m;
    vector<vector<int>> g(n);
    int d[n][n];
    rep(i,n)rep(j,n) d[i][j] = INF;
    rep(i,n) d[i][i] = 0;

    int e[n][n] = {};
    vector<pair<int,int>> ev;
    rep(i,m){
        int a,b,c;
        cin>>a>>b>>c;
        a--,b--;
        d[a][b] = d[b][a] = e[a][b] = e[b][a] = c;
        ev.push_back({a,b});
    }
    rep(k,n)rep(i,n)rep(j,n){
        if( d[i][j] > d[i][k] + d[k][j]){
            d[i][j] = d[i][k] + d[k][j];
        }
    }
    int cnt = 0;
    for(auto edge : ev){
        int x = edge.first;
        int y = edge.second;
        bool use = false;
        rep(s,n)rep(t,n)if(s!=t){
            if(d[s][t] == d[s][x] + e[x][y] + d[y][t]){
                use = true;
            }
        }
        if(!use) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i>n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int main() {

	int a, b, c, d;
	cin >> a >> b >> c >> d;

	cout << a * b - c * b - d * a + c * d << endl;

	return 0;
}


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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var a = cin.ReadInt;
            var b = cin.ReadInt;

            WriteLine(a*b%2==0?"Even":"Odd");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


Measured memory_bytes: 11220
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    int N=scan.nextInt();
    int[] A=new int[N+1];
    for(int i=1;i<N+1;i++){
      A[i]=scan.nextInt();
    }
    int[] ans=new int[N+1];
    for(int i=1;i<N+1;i++){
      ans[A[i]]=i;
    }
    for(int i=1;i<N+1;i++){
      System.out.print(ans[i]+" ");
    }   
  }
}

Measured memory_bytes: 62600
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;
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;}

int main(){
  string s; cin >> s;
  sort(all(s));
  if(s[0]==s[2]) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n,m,a,b,c,d,x,y,z;
  string s,t;
  //

  // ここから
  IN4(a,b,c,d);
  OUT(max(a*b,c*d));
}

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

using namespace std;

int main(void) {
  int a, b, k;
  cin >> a >> b >> k;

  map<int, bool> m;

  if(k > b - a + 1) {
    k = b - a + 1;
  }
  for(int i = 0; i < k; i++) {
    m[a + i] = true;
    cout << a + i << endl;
  }
  for(int i = k - 1; i >= 0; i--) {
    if(!m[b - i]) {
      cout << b - i << endl;
    }
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int n;
  int h[100001];
  int i;
  int check = 1;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&h[i]);
  }
  
  for(i=0;i<n-1;i++){
  	if(h[n-1-i] < h[n-2-i]){
      h[n-2-i] -= 1;
        if(h[n-1-i] < h[n-2-i]){
          check = 0;
          break;
        }
    }
  }
  
  if(check == 1){
      printf("Yes");
    }else{
      printf("No");
    }
    return 0;
    
  }

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

int main(){
    int n,m,x;cin>>n>>m>>x;
    int a=0;int b=0;
    for(int i=0;i<m;i++){
        int j;cin>>j;
        if(j>x)b++;
        else a++;
    }
    cout<<min(a,b)<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();

		HashSet<String> hs = new HashSet<String>();
		String s = null;

		sc.nextLine();

		for (int i = 0; i < n; i++) {

			s = sc.nextLine();
			hs.add(s);
		}

		System.out.println(hs.size());

	}

}


Measured memory_bytes: 79612
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class B { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long N = GetLong();
		long D = GetLong();
		long cnt = 0;
		for(long i = 0; i < N; i++)
		{
			long X = GetLong();
			long Y = GetLong();
			if(X * X + Y * Y <= D * D)
				cnt++;
		}
		WriteLine(cnt);
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 40684
#include <bits/stdc++.h>
using namespace std;
struct Graph{
  using seen_t=int64_t; using ver_t=int32_t; using edge_t=pair<seen_t,ver_t>;
  const seen_t NO=1e18; vector<seen_t> seen;
  const ver_t NONE=-1; vector<ver_t> prev;
  vector<vector<edge_t>> edge;
  Graph(size_t n): seen(n,NO*2), prev(n,NONE), edge(n) {}
  // has negative cycle => false
  bool bellmanford(ver_t frm){
    seen[frm]=0;
    seen_t alt; bool no_neg_cycle=true;
    for(ver_t i=0; i<edge.size(); ++i){
      for(ver_t u=0; u<edge.size(); ++u){
        for(const auto& v:edge[u]){
          alt=seen[u]+v.first;
          if(seen[v.second]>alt){
            seen[v.second]=alt; prev[v.second]=u;
            if(i==edge.size()-1){
              // return false;
              if(seen[v.second]<NO) no_neg_cycle=false;
            }
          }
        }
      }
    }
    return no_neg_cycle;
  }
};
ostream& operator<<(ostream& os, const Graph& g){
  for(const auto& x:g.seen){
    if(x>g.NO) os<<"INF\n";
    else os<<x<<'\n';
  }
  return os;
}
int32_t main(){
  ios::sync_with_stdio(false); cin.tie(0);
  size_t n,m,r; cin>>n>>m>>r;
  Graph graph(n);
  int32_t s,t,d;
  for(size_t i=0; i<m; ++i){
    cin>>s>>t>>d;
    graph.edge[s].push_back(make_pair(d,t));
  }
  if(graph.bellmanford(r)) cout<<graph;
  else cout<<"NEGATIVE CYCLE\n";
}


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

#define pb push_back
#define F first
#define S second
#define fo(i,a,b)  for(int i = a; i < b; i++)

using ll = long long;
using ld = long double;
using ul = unsigned long long;
using ii = pair<int, int>;
#define Mosta     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ReadFile            freopen("input.in","r",stdin)
#define WriteFile           freopen("output.txt","w",stdout)
const ll mod7 = 1000000007,mod = 1000000000,OO = 0x3f3f3f3f;
const ld EPS = 1e-7;
double Pi=acos(-1);
const ld rad=Pi/180.0;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll nCr (ll n,ll m)
{
        return(m == 0)?1:n*nCr(n-1,m-1)/m;
}
/*****************************************************/

int main()
{
    ll n, ans= 1e12;
    cin >> n;
    
    for(ll i=1;i*i<=n;i++){
        if(n%i==0)
            ans=min(ans,(i+n/i));
    }

     cout << ans-2 << endl;


    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
#include <assert.h>
#include <array>

using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mn(x) *min_element((x).begin(),(x).end())
#define mx(x) *max_element((x).begin(),(x).end())
//#define sum(x) accumulate((x).begin(),(x).end(),0ll)
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef  unsigned long long  ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

const ld pi=acos(-1);
const ll inf=(ll)1e9+1;
const int mod=1000000007;
//const int mod=998244353;

int n,m,k;
const int N=1e6+10;





int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    int q,t,u,v,h;
    ll x,a,b,c,d,y,z;
    cin >> n;
    vi vv(N);
    vb prime(N,true);
    int g=0;
    for(int i=0; i<n; i++){
        cin >> u;
        vv[u]++;
        g=gcd(u,g);
    }
    bool pair=true;
    for(int i=2; i<N; i++){
        if(prime[i]){
            u=0;
            for(int j=i; j<N; j+=i){
                prime[j]=false;
                u+=vv[j];
            }
            if(u>1){pair=false;break;}
        }
    }
    if(pair){
        cout << "pairwise coprime\n";
    }
    else if(g==1){
        cout << "setwise coprime\n";
    }
    else{
        cout << "not coprime\n";
    }
    
    return 0;
}







Measured memory_bytes: 7400
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


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

    ll r,D,x[20];
    cin >> r >> D >> x[0];
    F0R(i,10){
      x[i+1] = r*x[i] - D;
      cout << x[i+1] << endl;
    }

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast_io cin.tie(0);ios_base::sync_with_stdio(0);
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cout << endl; }
void show() { cout << endl; }
void pret() { cout << endl; exit(0);}
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cout << " " << to_string(H); debug_out(T...);}
template <typename Head, typename... Tail> void show(Head H, Tail... T) {cout <<H<<" "; show(T...);}
template <typename Head, typename... Tail> void pret(Head H, Tail... T) {cout <<H<<" "; pret(T...);}
#define pr(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
typedef long long ll;
#define int ll
typedef long double ld;
typedef vector<int> vi;
#define disp(x) cout<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(int)b;i++)
#define fo(i,a,b) for(int i=a;i<=(int)b;i++)
#define rf(i,a,b) for(int i=a;i>=(int)b;i--)
#define mp make_pair
#define pb emplace_back
#define F first
#define S second
#define endl '\n'
//cout.setf(ios::fixed);cout.precision(18)
const int MOD = 1e9+7;
const int maxn = 300000+10;

int32_t main(){
	fast_io;
	int a, b , c, d;
	cin >> a >> b >> c >> d;
	int ans = max(b * d, a * c);
	ans = max({ans, a * d, b * c});
	show(ans);
	return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>

using namespace std;

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

int n;
string s;

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

	int r = 0, l = 0;

	string ans = s;
	for (int i = 0; i < s.length();i++) {
		if (s[i] == '(')l++;
		else r++;
		if (r > l) {
			ans = '(' + ans;
			l++;
		}
	}
	for (int i = 0; i < l - r; i++) {
		ans = ans + ')';
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer stk;
		String str="";
		int S_ndn,A_ndn,B_ndn,C_ndn;
		int sum=0;
		S_ndn=6000; A_ndn=4000; B_ndn=3000; C_ndn=2000;
		int tmp1,tmp2;

		try {
			for(int i=0; i<4; i++) {
				str=bfr.readLine();
				stk=new StringTokenizer(str," ");
				tmp1=Integer.parseInt(stk.nextToken());
				tmp2=Integer.parseInt(stk.nextToken());
				if(tmp1==1) {
					sum+=tmp2*S_ndn;
				}

				else if(tmp1==2) {
					sum+=tmp2*A_ndn;
				}

				else if(tmp1==3) {
					sum+=tmp2*B_ndn;
				}

				else if(tmp1==4) {
					sum+=tmp2*C_ndn;
				}
				System.out.println(sum);
				sum=0;
			}


		}catch(IOException e) {

		}
	}
}


Measured memory_bytes: 24244
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
 
		Scanner sc = new Scanner(System.in);
        
		int[] a=new int[5];
		int ans=0;
		
		for(int i=0;i<5;i++) {
			a[i] = sc.nextInt();
			if (a[i]== 0) {
				ans =i;
			}
		}
		System.out.println(ans+1);
	}
}

Measured memory_bytes: 27012
#include <bits/stdc++.h>
#include <cstring>
#include <ctype.h>
#include<stdlib.h>

#define flin            freopen("input.txt", "r", stdin);
#define flout           freopen("output.txt", "w", stdout);
#define ll              long long
#define ull             unsigned long long
#define fastio          ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define nl              '\n'
#define nll             '\0'
#define pb              push_back
#define bdyptb          return 0;
#define sorted(x)       sort(x.begin(), x.end())
#define reversed(x)     reverse(x.begin(), x.end())
#define all(x)          x.begin(), x.end()
#define mset(a, b)        memset(a, b, sizeof(a));
#define testcase        ll t,tt; cin>>tt; for(t=1;t<=tt;t++)

#define pi acos(-1.00)
#define mx 1000007

using namespace std;
ull ncr(ull n, ull r)
{
    ull p = 1, k = 1;

    if (n - r < r)
        r = n - r;

    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;
            ull m = __gcd(p, k);
            p /= m;
            k /= m;
            n--;
            r--;
        }
    }
    else
        p = 1;
    return p;
}

int main()
{
    fastio;
    int n;
    cin>>n;
    map<int, int> mp;
    map<int, int>::iterator it;
    for(int i=0; i<n; i++)
    {
        int x;
        cin>>x;
        mp[x]++;
    }
    int ans=0;
    for(it=mp.begin(); it!=mp.end(); it++)
    {
        ans+=it->second % 2;
    }

    cout<<ans<<nl;

}


Measured memory_bytes: 8172
from functools import reduce
from operator import and_, or_

N = int(input())
S, T, U, V = [[int(a) for a in input().split()] for _ in range(4)]
X = [[U[i] & V[j] if S[i] and T[j] else U[i] if T[j] else V[j] if S[i] else U[i] | V[j] for j in range(N)] for i in range(N)]

for _ in range(2):
    A1 = [[-1] * N for _ in range(N)]
    A2 = [[-1] * N for _ in range(N)]
    for i in range(N-1)[::-1]:
        for j in range(N):
            A2[i][j] = A2[i+1][j] & X[i+1][j]
    for i in range(N):
        a = ~U[i] | reduce(or_, X[i])
        for j in range(N):
            if i:
                A1[i][j] = A1[i-1][j] & X[i-1][j]
            if S[i] and not T[j]:
                X[i][j] |= ~(A1[i][j] & A2[i][j] | a)
            a |= X[i][j]
    
    if [reduce(or_ if S[i] else and_, x) for i, x in enumerate(X)] != U:
        print(-1)
        exit()
    
    X = [[X[j][i] for j in range(N)] for i in range(N)]
    S, T, U, V = T, S, V, U

for x in X:
    print(*x)

Measured memory_bytes: 188244
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>

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

using namespace std;

typedef unsigned long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;

const ll INF = LONG_LONG_MAX;

typedef ll Weight;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

void WarshallFloyd(const Matrix &g,
                  Matrix &dist, vector< vector<int> > &inter) {
    int n = (int)g.size();
    dist = g;
    inter.assign(n, vector<int>(n,-1));
    repeat(k, n) repeat(i, n) repeat(j, n) {
        if(dist[i][k] == INF || dist[k][j] == INF) continue;
        if (dist[i][j] > dist[i][k] + dist[k][j]) {
            dist[i][j] = dist[i][k] + dist[k][j];
            inter[i][j] = k;
        }
    }
}

int main() {
    // insert code here...    return 0;
    //////
    // input from txt
    /*
     std::ifstream in("input.txt");
     std::cin.rdbuf(in.rdbuf());
     std::ofstream out("output.txt");
     std::cout.rdbuf(out.rdbuf());
     ////
     */
    int N,M,R;
    cin >> N >> M >> R;
    int r[10];
    repeat(i, R){
        cin >> r[i];
        r[i]--;
    }
    Matrix g(N,Array(N,INF));
    repeat(i, N){
        g[i][i] = 0;
    }
    repeat(i, M){
        int a,b;
        Weight c;
        cin >> a >> b >> c;
        a--;
        b--;
        g[a][b] = c;
        g[b][a] = c;
    }
    Matrix dist;
    vector<vint> inter;
    WarshallFloyd(g, dist, inter);
    ll dp[10][1<<10];
    int total = 1 << R;
    repeat(i, R){
        repeat(s, total){
            dp[i][s] = INF;
        }
        dp[i][1<<i] = 0;
    }
    repeat(s, total){
        repeat(v, R){
            if(dp[v][s] == INF) continue;
            repeat(u, R){
                if((s>>u) & 1) continue;
                dp[u][s|(1<<u)] = min(dp[u][s|(1<<u)],dp[v][s] + dist[r[v]][r[u]]);
            }
        }
    }
    ll ans=INF;
    repeat(i, R){
        ans = min(ans,dp[i][total-1]);
    }
    cout << ans << endl;
    return 0;
}



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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if (A + B < C + D) {
    cout << "Right" << endl;
  }

  else if (A + B > C + D) {
    cout << "Left" << endl;
  }

   else {
    cout <<"Balanced" << endl;
  }
   
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long[] num = { a, b, c};
		
		if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
			System.out.println(0);
			return;
		}
		long max = 0;
		
		for (int i = 0; i < num.length; i++) {
			if (num[i] > max) {
				max = num[i]; 
			}
		}
		for (int i = 0; i < num.length; i++) {
			if (num[i] == max) {
				num[i] = 1;
				break;
			}
		}
		long ans = 1;
		for (int i = 0; i < num.length; i++) {
			ans *= num[i];
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 9940
{-# LANGUAGE BangPatterns          #-}

import Control.Monad
import Control.Applicative
import Data.List as List
import Data.Set as Set



solve:: Int -> Int -> Int
solve x t
    | x >= t = x - t
    | otherwise = 0

main :: IO()
main = do
    [x, t] <- List.map read . words <$> getLine :: IO [Int]
    let s = solve x t
    print s


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


int a,b,c;
int main(){
    bool unko[101];
    for(int i=0; i<101; i++){
        unko[i]=false;
    }
    cin>>a>>b>>c;
    unko[a]=true;
    unko[b]=true;
    unko[c]=true;
    int syurui=0;
    for (int i=0; i<=100; i++){
        if(unko[i]==true){
            syurui++;
        }
    }

    cout << syurui;

    return 0;
}

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

int main() {
  string s;
  int data[6] = {0};
  
  cin >> s;
  int i = 0;
  int now = 0;
  while ( i < s.size() ) {
    bool flag = false;
    if ( s[i] == '+' ) {
      i++;
      now++;
    } else if ( s[i] == '-' ) {
      i++;
      now++;
      flag = true;
    }
    
    int tmp = 0;
    if ( '0' <= s[i] && s[i] <= '9' ) { // keisu
      while ( '0' <= s[i] && s[i] <= '9' ) {
	tmp *= 10;
	tmp += s[i] - '0';
	i++;
      }
    }
    tmp = max(1, tmp);
    if ( flag ) tmp *= -1;
    if ( s[i] == 'x' ) {
      i++;
      if ( s[i] == '^' ) {
	i++;
	data[s[i] - '0'] = tmp;
	i++;
      } else {
	data[1] = tmp;
      }
    } else {
      data[0] = tmp;
    }
  }

  /*for ( int i = 0; i < 6; i++ ) {
    cout << data[i] << " ";
  }
  cout << endl;
  */
  vector<int> v;
  for ( int i = -2000; i <= 2000; i++ ) {
    int sum = data[0];
    for ( int j = 1; j < 6; j++ ) sum += data[j] * pow(i, j);
    if ( sum == 0 ) v.push_back(-i);
  }

  sort(v.begin(), v.end());
  for ( int i = 0; i < (int)v.size(); i++ ) {
    printf("(x%+d)", v[i]);
  }
  cout << endl;
}

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

#define ll long long
#define inf 0x3f3f3f3f
const int maxn=1e5+5;
#define mod 1000000007
 int gcd(int a,int b)
{
   return b==0?a:gcd(b,a%b);
}
int main()
{
    int a,b;
    ll ans;
    cin>>a>>b;
    int aa=gcd(a,b);
    ans=a/(ll)aa*b;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}


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

    RSORT(copy);
    ll maximum = copy[0];
    ll second = copy[1];

    for (int i = 0; i < N; i++)
    {
        if (maximum == A[i])
        {
            cout << second << endl;
        }
        else
        {
            cout << maximum << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4736
namespace VainZero.Procon.FSharp

open System
open System.Collections.Generic

[<AutoOpen>]
module Operators =
  let read f = Console.ReadLine().Split([|' '|]) |> Array.map f

module Program =
  [<EntryPoint>]
  let main _ =
    let [|a; b|] = read int
    let s = a + b
    printfn "%s" (if s >= 10 then "error" else string s)
    0


Measured memory_bytes: 11996
#include <bits/stdc++.h>
#define LL long long
#define dob complex<double>
#define Abs(a) ((a) < 0 ? (-(a)) : (a))
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
#define Swap(a, b) ((a) ^= (b), (b) ^= (a), (a) ^= (b))
#define writeln(x) (write(x), putchar('\n'))
#define lowbit(x) ((x)&(-(x)))
using namespace std;
//PURVIKAURRAINA
const int N = 100000;
const int yzd = 1e9+7;
void read(int &x) {
    char ch; bool flag = 0;
    for (ch = getchar(); !isdigit(ch) && ((flag |= (ch == '-')) || 1); ch = getchar());
    for (x = 0; isdigit(ch); x = (x<<1)+(x<<3)+ch-48, ch = getchar());
    x *= 1-2*flag;
}
void print(int x) {if (x > 9) print(x/10); putchar(x%10+48); }
void write(int x) {if (x < 0) putchar('-'); print(Abs(x)); }
 
int n, m, s, t, u, v, c;
struct tt {int to, next, cost; }edge[(N<<2)+5];
int path[N+5], top;
int ans1[N+5], ans2[N+5], vis[N+5], in[N+5];
LL dist1[N+5], dist2[N+5];
queue<int>Q;
vector<int>to[N+5];
//PURVIKAURRAINA
 
void add(int u, int v, int c) {
    edge[++top].to = v, edge[top].cost = c, edge[top].next = path[u], path[u] = top;
}
void SPFA(int s, LL *dist) {
    dist[s] = 0; Q.push(s); vis[s] = 1;
    while (!Q.empty()) {
    int u = Q.front(); Q.pop(); vis[u] = 0;
    for (int i = path[u]; i; i = edge[i].next)
        if (dist[edge[i].to] > dist[u]+edge[i].cost) {
        dist[edge[i].to] = dist[u]+edge[i].cost;
        if (!vis[edge[i].to]) {
            vis[edge[i].to] = 1; Q.push(edge[i].to);
        }
        }
    }
}
void topsort(int s, LL *dist, int *ans) {
    for (int u = 1; u <= n; u++) {
    to[u].clear();
    for (int i = path[u]; i; i = edge[i].next)
        if (dist[edge[i].to] == dist[u]+edge[i].cost) to[u].push_back(edge[i].to), ++in[edge[i].to];
    }
    ans[s] = 1; Q.push(s);
    while (!Q.empty()) {
    int u = Q.front(), size = to[u].size(); Q.pop();
    for (int i = 0; i < size; i++) {
        if (--in[to[u][i]] == 0) Q.push(to[u][i]); (ans[to[u][i]] += ans[u]) %= yzd;
    }
    }
}
void work() {
    read(n), read(m), read(s), read(t);
    for (int i = 1; i <= m; i++) {
    read(u), read(v), read(c); add(u, v, c); add(v, u, c);
    }
    memset(dist1, 127/3, sizeof(dist1));
    SPFA(s, dist1); topsort(s, dist1, ans1);
    memset(dist2, 127/3, sizeof(dist2));
    SPFA(t, dist2); topsort(t, dist2, ans2);
    int ans = 1ll*ans1[t]*ans1[t]%yzd;
    for (int u = 1; u <= n; u++) {
    if (dist1[u] == dist2[u] && dist2[u]*2 == dist1[t]) (ans -= 1ll*ans1[u]*ans1[u]%yzd*ans2[u]%yzd*ans2[u]%yzd) %= yzd;
    for (int i = path[u]; i; i = edge[i].next)
        if (dist1[u]+edge[i].cost+dist2[edge[i].to] == dist1[t] && dist1[u]*2 < dist1[t] && dist2[edge[i].to]*2 < dist1[t])
        (ans -= 1ll*ans1[u]*ans1[u]%yzd*ans2[edge[i].to]%yzd*ans2[edge[i].to]%yzd) %= yzd;
    }
    writeln((ans+yzd)%yzd);
}
int main() {
    work();
    return 0;
}

Measured memory_bytes: 14208
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
using namespace std;

const int MX=100005;

int main()
{
    string s;
    cin>> s;
    if(s=="RRR") cout<< 3 <<endl;
    else if(s=="RRS" || s=="SRR") cout<< 2 <<endl;
    else if(s[0]=='R' || s[1]=='R' || s[2]=='R') cout<< 1 <<endl;
    else cout<< 0 <<endl;
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

template<class T,class E,class F,class G,class H>
struct LazySegmentTree{
	F f;
	G g;
	H h;

	T ti;
	E ei;

	vector<T>dat;
	vector<E>put;
	int sz;
	LazySegmentTree(const T &ti,const E &ei,const F &f,const G &g,const H &h):ti(ti),ei(ei),f(f),g(g),h(h){}

	void build(const vector<T>&v){
		assert(v.size());
		sz=1;
		while(sz<v.size())sz<<=1;
		dat.resize(sz<<1,ti);
		put.resize(sz<<1,ei);
		for(int i=0;i<v.size();i++)dat[sz-1+i]=v[i];
		for(int i=sz-2;i>=0;i--)dat[i]=f(dat[i*2+1],dat[i*2+2]);
	}
	inline void push(int k,int l,int r){
		dat[k]=g(dat[k],put[k],r-l);
		if(k<sz-1){
			put[k*2+1]=h(put[k*2+1],put[k]);
			put[k*2+2]=h(put[k*2+2],put[k]);
		}
		put[k]=ei;
	}

	void modify(int a,int b,E x,int k,int l,int r){
		push(k,l,r);
		if(r<=a||b<=l)return;
		if(a<=l&&r<=b){
			put[k]=x;
			push(k,l,r);
			return;
		}
		modify(a,b,x,k*2+1,l,(l+r)/2);
		modify(a,b,x,k*2+2,(l+r)/2,r);
		dat[k]=f(dat[k*2+1],dat[k*2+2]);
	}

	inline void modify(int a,int b,E x){
		return modify(a,b,x,0,0,sz);
	}
	T query(int a,int b,int k,int l,int r){
		push(k,l,r);
		if(r<=a||b<=l)return ti;
		if(a<=l&&r<=b)return dat[k];
		return f(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2,r));
	}
	inline T query(int a,int b){
		return query(a,b,0,0,sz);
	}
};

signed main(){
	auto f=[](int a,int b){return a==-1?b:a;};
	auto g=[](int a,int b,int len){return a+b;};
	auto h=[](int a,int b){return a+b;};
	int ti=-1,ei=0;

	LazySegmentTree<int,int,decltype(f),decltype(g),decltype(h)>seg(ti,ei,f,g,h);
	
	int N,Q;scanf("%lld%lld",&N,&Q);
	seg.build(vint(N,0));

	while(Q--){
		int t;scanf("%lld",&t);
		if(t==0){
			int s,t,x;
			scanf("%lld%lld%lld",&s,&t,&x);
			s--;
			seg.modify(s,t,x);
		}
		else{
			int k;
			scanf("%lld",&k);
			k--;
			printf("%lld\n",seg.query(k,k+1));
		}
	}
	return 0;
}


Measured memory_bytes: 7848
n=int(input())
l=[['0']*10 for _ in range(n)]
for i in range(n):
        a=str(input())
        for j in range(10):
                l[i][j]=a[j]
        l[i].sort()
l.sort()

c=0
d=[]
for j in range(n-1):
        if l[j]==l[j+1] and j==n-2:
                c+=2
                d.append(c)
        elif l[j]==l[j+1]:
                c+=1
        else:
                c+=1
                d.append(c)
                c=0
aa=0
for k in range(len(d)):
        aa+=d[k]*(d[k]-1)//2
print(aa)


Measured memory_bytes: 20648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try(Scanner sc = new Scanner(System.in);) {
			
			int W = sc.nextInt();
			int H = sc.nextInt();
			int x = sc.nextInt();
			int y = sc.nextInt();
			int r = sc.nextInt();
			
			if(x - r >= 0 && x + r <= W &&
					y - r >= 0 && y + r <= H) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}

}



Measured memory_bytes: 26336
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int p[] = new int[N];
		int psort[] = new int[N];
		int count = 0;

		for (int i = 0; i < N; i++) {
			p[i] = sc.nextInt();
			psort[i] = p[i];
		}

		Arrays.sort(psort);

		for (int i = 0; i < N; i++) {
			if (!(p[i] == psort[i])) {
				count++;
			}
		}

		if (count ==2 || count == 0) {
			System.out.print("YES");
		} else {
			System.out.print("NO");
		}

	}
}

Measured memory_bytes: 23252
fun main() {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }

    val answer = Array(n + 1) {0}

    for (b in a) {
        answer[b]++
    }

    for (i in 1..n) {
        println(answer[i])
    }
}

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

typedef long long ll;
typedef long double ld; 
typedef double db; 
typedef string str; 

typedef pair<int, int> pi;
typedef pair<ll,ll> pl; 
typedef pair<ld,ld> pd; 

typedef vector<int> vi; 
typedef vector<ll> vl;
typedef vector<ld> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
typedef vector<pl> vpl; 

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound 
#define ub upper_bound 

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 1000001;

int K;
ll ans; 

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    cin >> K; K++;
    FOR(i, 1, K) {
        FOR(j, 1, K) {
            FOR(k, 1, K) {
                ans += __gcd(i, __gcd(j, k));
            }
        }
    }
    cout << ans;
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  string a,b; cin >> a >> b;
  ll n = a.size();
  ll m = b.size();
  if(n>m){
    REP(i, n-m) b = "0" + b;
  }else{
    REP(i, m-n) a = "0" + a;
  }
  if(a>b){
    cout << "GREATER" << endl;
  }else if(a<b){
    cout << "LESS" << endl;
  }else{
    cout << "EQUAL" << endl;
  }
}

Measured memory_bytes: 384
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

int main() {

	int N;
	cin >> N;

	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	A.emplace_back(-1);
	A.emplace_back(0);
	DMP(A);

	lint ans = 1000;
	int i = 0;
	while (i < N) {
		int m = i;
		while (A[m] > A[m + 1]) m++;
		if (m >= N - 1) break;
		int M = m + 1;
		while (A[M] <= A[M + 1]) M++;
		DMP(m, M);
		ans = ans / A[m] * A[M] + ans % A[m];
		DMP(ans);
		i = M;
	}

	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 3656
#include<iostream>

using namespace std;

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if (a==b){
    if (b==c){
      cout << "1" << endl;
    } else {
      cout << "2" << endl;
    }
  } else {
    if (b==c) {
      cout << "2" << endl;
    } else {
      if (a==c) {
        cout << "2" << endl;
      } else {
        cout << "3" << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define mp make_pair
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
const int mod = (int)1e9 + 7;
int n, m;
set<int> s;
int ok(int x) {
	while(x > 0) {
		if(!s.count(x % 10)) {
			return 0;
		}
		x/=10;
	}
	return 1;
}
int main () {
	for(int i = 0; i < 10; i++) {
		s.insert(i);
	}
	cin >> n >> m;
	for(int i = 0; i < m; i++) {
		int x;
		cin >> x;
		s.erase(x);
	}
	for(int i = n; ; i++) {
		if(ok(i)) {
			cout << i << "\n";
			return 0;
		}
	}
 	return 0;
}



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

int main() {
    int a,b,c,tmp;
    cin >> a >> b >> c;
    if(a > b){
        tmp = a;
        a = b;
        b = tmp;
    }if(b > c){
        tmp = b;
        b = c;
        c = tmp;
    }if(a > b){
        tmp = a;
        a = b;
        b = tmp;
    }
    cout << a << " "<< b << " " << c << endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1e18
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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;}

int main(){
    string s;
    cin>>s;
    int m=s.size()-1;
    if(s[m]=='s')cout<<s+"es"<<endl;
    else cout<<s+"s"<<endl;
}


Measured memory_bytes: 3624