akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
//const ll mod = 1000000007;
//const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-5;

typedef complex<ld> Point;

ld dot(Point a, Point b) { return real(conj(a)*b); }
ld cross(Point a, Point b) { return imag(conj(a)*b); }
struct Line {
	Point a, b;
};

Point proj(Line l, Point p) {
	ld t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + t * (l.a - l.b);
}
bool isis_sp(Line s, Point p) {
	return (abs(s.a - p) + abs(s.b - p) - abs(s.b - s.a) < eps);
}
ld dist_sp(Line s, Point p) {
	Point r = proj(s, p);
	return isis_sp(s, r) ? abs(p - r) : min(abs(p - s.a), abs(p - s.b));
}

int n;
Point p[16][2]; ld rad[16];
bool valid[16][16][2];

void solve() {
	cin >> n;
	rep(i, n) {
		cin >> rad[i];
		ld sx, sy, gx, gy;
		cin >> sx >> sy >> gx >> gy;
		p[i][0] = { sx,sy };
		p[i][1] = { gx,gy };
	}
	rep(i, n) {
		rep(j, n) {
			if (i == j)continue;
			rep(k, 2) {
				Line l = { p[i][0],p[i][1] };
				ld dist = dist_sp(l, p[j][k]);
				valid[i][j][k] = (dist >= rad[i] + rad[j]);
			}
		}
	}
	vector<bool> can(1 << n, false);
	can[0] = true;
	rep(i, (1 << n) - 1) {
		if (!can[i])continue;
		vector<int> b(n,0);
		rep(j, n) {
			if (i&(1 << j)) {
				b[j] = 1;
			}
		}
		rep(j, n) {
			if (b[j])continue;
			bool ok = true;
			rep(k, n) {
				if (j == k)continue;
				if (!valid[j][k][b[k]]) {
					ok = false; break;
				}
			}
			if (ok) {
				can[i ^ (1 << j)] = true;
			}
		}
	}
	int ans = 0;
	rep(i, (1 << n)) {
		if (!can[i])continue;
		int tmp = 0;
		rep(j, n) {
			if (i&(1 << j))tmp++;
		}
		ans = max(ans, tmp);
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//init();
	solve();

	//cout << "finish" << endl;
	//stop
	return 0;
}



Measured memory_bytes: 3308
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<stdbool.h>
using namespace std;

int main(void) {
	int h, w;
	cin >> h >> w;
	vector<string>s(h);
	for (int i = 0;i < h;i++)cin >> s[i];
	for (int i = 0;i < h;i++) {
		cout << s[i] << endl;
		cout << s[i] << endl;
	}
	return 0;
}

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

int main() {
    int c[4][4] = {0};
    bool flag = false;

    int a1, a2, a3, b1, b2, b3;

    for (int i = 1; i <= 3; i++) {
        for (int j = 1; j <= 3; j++) {
            cin >> c[i][j];
        }
    }

    for (int i = 0; i <= 100; i++) {
        a1 = i;
        b1 = c[1][1] - i;
        b2 = c[1][2] - i;
        b3 = c[1][3] - i;

        a2 = c[2][1] - c[1][1] - i;
        a3 = c[3][1] - c[1][1] - i;

        if ((a2 + b2 == c[2][2]) && (a2 + b3 == c[2][3]) && (a3 + b2 == c[3][2]) && (a3 + b3 == c[3][3])) {
            flag = true;
            break;
        }
    }

    if (flag) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod

int main(){
	ll n,x[110];
	cin>>n;
	rep(i,n)cin>>x[i];
	ll ans=1e17;
	for(ll p=0;p<=100;p++){
		ll res=0;
		rep(i,n)res+=(x[i]-p)*(x[i]-p);
		chmin(ans,res);
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
using namespace std;
inline int read(){
    int x = 0; char c = getchar();
    while (!isdigit(c)) c = getchar();
    while (isdigit(c)) x = x * 10 + c - '0',c = getchar();
    return x;
}
template <typename T> void read(T &x){
	x = 0; int f = 1; char ch = getchar();
	while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}
inline void write(int x){if (x > 9) write(x/10); putchar(x%10+'0'); }
const int N = 55;
int n,ex[N],ey[N],G[N][N],fa[N],dpt[N];

int st[N],m,L;
inline void dfs(int x){
	for (int i = 1; i <= n; ++i) if (i!=fa[x]&&G[x][i]>0){
		fa[i] = x; dpt[i] = dpt[x] + 1; dfs(i);
	}
}
inline void Tag(int u,int v,int t){
	while (u != v){
		if (dpt[u] >= dpt[v]) st[G[u][fa[u]]] |= t,u = fa[u];
		else st[G[v][fa[v]]] |= t,v = fa[v];
	}
}
LL dp[1<<20];
inline void DP(int s){
	for (int i = L-1; i >= 0; --i) dp[i|s] += dp[i];
}
int main(){
	int i;
	n = read();
	for (i = 1; i < n; ++i) ex[i] = read(),ey[i] = read(),G[ex[i]][ey[i]] = G[ey[i]][ex[i]] = i;
	dfs(1);
	m = read(),L = 1<<m;
	for (i = 0; i < m; ++i) ex[n] = read(),ey[n] = read(),Tag(ex[n],ey[n],1<<i);
	dp[0] = 1;
	for (i = 1; i < n; ++i) DP(st[i]);
	cout << dp[L-1] << endl;
    return 0;
}

Measured memory_bytes: 8448
public class Main {

  private static void solve() {
    String s = next();

    String hi = "hi";
    String now = hi;

    for (int i = 0; i < 10; i++) {
      if (s.equals(now)) {
        System.out.println("Yes");
        return;

      }
      now += hi;
    }
    System.out.println("No");

  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



Measured memory_bytes: 21076
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>

using ll = long long;

int main() {
    int A, P;
    std::cin >> A >> P;

    std::cout << ((A * 3) + P) / 2 << std::endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long n = long.Parse(input[0]);
		long m = long.Parse(input[1]);
    long[][] vertexes = new long[m][];//ここに受け取る
    for(int i = 0; i < m; i++)
    {
      vertexes[i] = new long[4];
      long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);//１行ごとに受け取る
      vertexes[i][0] = nums[0]-1;
      vertexes[i][1] = nums[1];
      vertexes[i][2] = i;
    }

    Array.Sort(vertexes, (a, b) => a[1].CompareTo(b[1]));
    long[] memo = new long[n];
    for(int i = 0; i < m; i++)
    {
      vertexes[i][3] = memo[vertexes[i][0]] + 1;
      memo[vertexes[i][0]]++;
    }

    Array.Sort(vertexes, (a, b) => a[2].CompareTo(b[2]));

    for(int i = 0; i < m; i++)
    {
      Console.WriteLine((vertexes[i][0]+1).ToString("D6") + vertexes[i][3].ToString("D6"));
    }

	}
}

Measured memory_bytes: 28328
import java.util.*;
import java.io.*;
import java.lang.*;

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

        if (a<1200)
            System.out.println("ABC");
        else if (a<2800)
            System.out.println("ARC");
        else
            System.out.println("AGC");
    }
}


Measured memory_bytes: 35632
#include <stdio.h>

int main(void)
{
	int num[5];
	int flag, i, tmp;
	
	scanf("%d %d %d %d %d", &num[0], &num[1], &num[2], &num[3], &num[4]);
	
	while(1){
		flag = 0;
		for (i = 0; i < 4; i++){
			if (num[i] < num[i + 1]){
				tmp = num[i];
				num[i] = num[i + 1];
				num[i + 1] = tmp;
				flag++;
			}
		}
		if (flag == 0){
			break;
		}
	}
	
	printf("%d %d %d %d %d\n", num[0], num[1], num[2], num[3], num[4]);
	
	return (0);
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(i64 i = 0; i < N; i++)
#define Rep(i, k, N) for(i64 i = k; i < N; i++)
#define all(v) v.begin(), v.end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}

int main(){
    int X, N;
    cin >> X >> N;
    set<int> st;
    rep(i, N) {
        int p; cin >> p;
        st.insert(p);
    }

    int maxDiff = 1e9;
    int ans = 1e9;;
    for(int i = 200; i >= -200; i--){
        if(st.count(i)) continue;
        if(maxDiff >= abs(X - i)){
            maxDiff = abs(X - i);
            ans = i;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3632
T=list(input())
T.insert(0,'B')
T.append('B')
for i in range(len(T)):
    if T[i]=='?':
        if T[i-1]=='P':
          T[i]='D'
        elif T[i+1]=='?' or T[i+1]=='D':
          T[i]='P'
        else:T[i]='D'
          
T.pop(0)
T.pop(-1)
print(''.join(T))

Measured memory_bytes: 10912
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

#define mem(ar,a)       memset(ar,a,sizeof ar)
#define iOS               ios_base::sync_with_stdio(false);cin.tie(NULL); 
#define pb(x)           push_back(x)
#define all(c)          c.begin(), c.end()
#define int             long long
#define ff              first
#define ss              second
#define nl              '\n'

int32_t main()
{
    iOS
    string a,b; cin>>a>>b;
    int n=a.size();
    int res=0;
    for(int i=0;i<n;i++){
        if(a[i]!=b[i])
            res++;
    }
    cout<<res;
}



Measured memory_bytes: 3836
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>

using namespace std;

uint64_t count_bit(uint64_t val, int digit)
{
	val++;

	uint64_t round = 1ULL << (digit + 1);
	uint64_t half = round >> 1;
	uint64_t mod = val % round;
	if (mod < half) {
		return half * (val / round);
	}
	else {
		return half * (val / round) + (mod - half);
	}
}

int main()
{
	uint64_t a, b;
	cin >> a >> b;

	uint64_t n = b - a;

	if (n == 0) {
		cout << b << endl;
		return 0;
	}


	uint64_t bits[63] = { 0 };
	for (int i = 0; i < 63; i++) {
		uint64_t bn = count_bit(b, i);
		uint64_t an = count_bit(a - 1, i);
		bits[i] = bn - an;
	}


	uint64_t val = 0;
	int shift = 0;
	for (int i = 0; i < 63; i++) {
		val += (bits[i] & 1) << shift;
		shift++;
	}

	cout << val << endl;

	return 0;
}

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

using namespace std;
typedef long long ll;
const int maxn=1005;
int num[maxn];
int dp[maxn];

int main()
{
    int n;
    while(cin>>n){
        for(int i=0;i<n;i++){
            cin>>num[i];
        }
        int temp = 0, ans = 0;
        for(int i=0;i<n;i++){
            if(num[i] >= temp) {
                ans++;
                temp = num[i];
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

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

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

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

typedef long long ll;

string S;
int main() {
  cin >> S;
  cout << (S == "RRR" ? 3 : S == "RRS" || S == "SRR" ? 2 : S == "SSS" ? 0 : 1)
       << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 1000000009
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main(){
  int N;
  cin >> N;
  vector<string> S(N);
  rep(i, N){
    cin >> S.at(i);
  }
  map<string, int> poll;
  rep(i, N){
    if(poll.count(S.at(i))){
      poll.at(S.at(i))++;
    }
    else{
      poll[S.at(i)] = 1;
    }
  }
  int m = 0;
  for(pair<string, int> x : poll){
    chmax(m, x.second);
  }
  vector<string> ans;
  for(pair<string, int> x : poll){
    if(x.second == m){
      ans.push_back(x.first);
    }
  }
  sort(all(ans));
  rep(i, sz(ans)){
    cout << ans.at(i) << endl;
  }
}

Measured memory_bytes: 28404
#include<iostream>
using namespace std;
int main() {
  int rate; cin >> rate;
  if (rate < 1200) {
    cout << "ABC" << endl;
  } else if (rate < 2800) {
    cout << "ARC" << endl;
  } else {
    cout << "AGC" << endl;
  }
  return 0;
}

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

// dp[i][j][k] ((i,j)にいるときの最大値. その行で既にk個のアイテムを選んだとき(k <= K))

int table[3005][3005];
ll dp[3005][3005][4];

int main() {
  int R, C, K;
  cin >> R >> C >> K;
  rep(i, K) {
    int r, c, v;
    cin >> r >> c >> v;
    table[r-1][c-1] = v;
  }
  rep(i, R) rep(j, C) {
    for (int k = 2; k >= 0; k--) {
      chmax(dp[i][j][k+1], dp[i][j][k] + table[i][j]);
    }
    rep(k, 4) {
      chmax(dp[i+1][j][0], dp[i][j][k]);
      chmax(dp[i][j+1][k], dp[i][j][k]);
    }
  }
  
  ll ans = 0;
  rep(k, 4) chmax(ans, dp[R-1][C-1][k]);
  cout << ans << endl;
}

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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <queue>
#include <stack>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

int lcm(int a, int b)
{return a * b / gcd(a, b);}

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}

// printf("%.10f\n" , ans);
int main(void){
  ios::sync_with_stdio(false);
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int ans = (h2 - h1) * 60 + (m2 - m1) - k;
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3648
from itertools import permutations
from math import sqrt

N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]

ans = 0
cnt = 0
base = list(range(0, N))
for order in permutations(base, N):
    cnt += 1
    for i in range(0, N - 1):
        n1 = order[i]
        n2 = order[i + 1]
        res = (XY[n1][0] - XY[n2][0]) ** 2
        res += (XY[n1][1] - XY[n2][1]) ** 2
        ans += sqrt(res)

print(ans / cnt)


Measured memory_bytes: 40556
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=sys.stdin.readline
def resolve():
    n=int(input())
    run=[int(input().replace(' ',''),2) for _ in range(n)]
    profit=[tuple(map(int,input().split())) for _ in range(n)]
    print(max(sum(profit[j][bin(run[j]&i).count('1')] for j in range(n)) for i in range(1,1<<10)))
resolve()

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

struct Tree
{
    int p, start, end, min;
    bool isSearched;
    vector<int> v;
};

void DFS( Tree* t, int a, int cnt )
{
    if( t[a].isSearched && t[a].min <= cnt )
        return;
    
    t[a].isSearched = true;

    if( t[a].min > cnt )
        t[a].min = cnt;

    cnt++;

    for( int i = 0; i < t[a].v.size(); i++ )
        DFS( t, t[a].v[i], cnt );
}


int main()
{
    int n, a, b, c;
    Tree t[101];

    for( int i = 0; i < 101; i++ )
    {
        t[i].p = -1;
        t[i].min = 1000;
        t[i].isSearched = false;
    }
    
    cin >> n;

    for( int i = 0; i < n; i++ )
    {
        cin >> a >> b;
        for( int j = 0; j < b; j++ )
        {
            cin >> c;
            t[a].v.push_back(c);
            t[c].p = a;
        }
    }

    int cnt = 0;
    DFS( t, 1, cnt );

    for( int i = 1; i <= n; i++ )
    {
        if( t[i].min == 1000 )
            cout << i << " " << -1 << endl;
        else
            cout << i << " " << t[i].min << endl;
    }
    return 0;
}


Measured memory_bytes: 3172
#include "bits/stdc++.h"
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long

int n,m;
unordered_map<string,int> mp;

int main(){
  cin>>n;
  string s;
  REP(i,n){
    cin>>s;
    mp[s]++;
  }
  cin>>m;
  REP(i,m){
    cin>>s;
    mp[s]--;
  }
  int ret=0;
  for(auto it:mp){
    ret=max(ret,it.second);
  }
  cout<<ret<<endl;
  return 0;
}


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

// int/long:            -2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:      -9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define MOD 1000000007

#define Rep0(i, n)      for (auto i=0; i<n; i++)
#define Rep1(i, n)      for (auto i=1; i<=n; i++)
#define Sort(P) sort(P.begin(), P.end())
#define Rev(P)  reverse(P.begin(), P.end())

int     main() {
        int N, M;
        cin >>N >>M;
        if (1==N%2) {
                int L=N/2;
                int R=L+1;
                Rep0(i, M) {
                        printf("%d %d\n", L, R);
                        L--;
                        R++;
                }
        } else { // even
                int L=1;
                int R=N;
                for (int i=0; i<M; i+=2) {
                        printf("%d %d\n", L, R);
                        L++;
                        R--;
                }
                R--;
                for (int i=1; i<M; i+=2) {
                        printf("%d %d\n", L, R);
                        L++;
                        R--;
                }
        }
        return 0;
}


Measured memory_bytes: 3728
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,sx,sy,ex,ey;
int MX[400004];
struct node{
	int ax,ay;
	int hg;
}E[200002];
double ans=1e9;
const double d=4.292036732051033807686783083602,aa=11.415926535897932384626433832795;
int Read()
{
	int s=0;char ch=getchar();
	while(ch<'0'|ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9')
	s=s*10+ch-'0',ch=getchar();
	return s;
}
bool cmp0(node x,node y)
{return x.ax<y.ax;}
bool cmp1(node x,node y)
{return x.ay<y.ay;}
bool cmp2(node x,node y)
{return x.ax>y.ax;}
int G(int x)
{
	int re=0;
	while(x)
	{
		re=max(MX[x],re);
		x-=(x&(-x));
	}
	return re;
}
void add(int x,int y)
{
	while(y<=2*n)
	{
		MX[y]=max(MX[y],x);
		y+=(y&(-y));
	}
	return;
}
void work1()
{
	n=Read();
	int ct=0;
	for(int i=1,x,y;i<=n;i++)
	{
		x=Read()+2;y=Read()+2;
		if(x>=sx&&x<=ex&&y>=sy&&y<=ey)
		E[++ct].ax=x,E[ct].ay=y;
	}n=ct;
	sort(E+1,E+n+1,cmp1);
	for(int i=1,j=0;i<=n;i++)
	if(E[i].ay!=E[i-1].ay+1)
	j+=2,E[i].hg=j;
	else E[i].hg=++j;
	sort(E+1,E+n+1,cmp0);
	int la[3]={0,0,0},js=0;
	for(int i=1,tmp;i<=n;i++)
	{
		tmp=G(E[i].hg)+1;js=max(js,tmp);add(tmp,E[i].hg);
	}
	ans=-d*js+((js==ey-sy+1)||(js==ex-sx+1)?aa+d:0);
	ans+=100.0*(ex-sx);
	ans+=100.0*(ey-sy);
	return;
}
void work2()
{
	n=Read();
	int ct=0;
	for(int i=1,x,y;i<=n;i++)
	{
		x=Read()+2;y=Read()+2;
		if(x>=ex&&x<=sx&&y>=sy&&y<=ey)
		E[++ct].ax=x,E[ct].ay=y;
	}n=ct;
	sort(E+1,E+n+1,cmp1);
	for(int i=1,j=0;i<=n;i++)
	if(E[i].ay!=E[i-1].ay+1)
	j+=2,E[i].hg=j;
	else E[i].hg=++j;
	sort(E+1,E+n+1,cmp2);
	int la[3]={0,0,0},js=0;
	for(int i=1,tmp;i<=n;i++)
	{
		tmp=G(E[i].hg)+1;js=max(js,tmp);add(tmp,E[i].hg);
	}
	ans=-d*js+((js==ey-sy+1)||(js==sx-ex+1)?aa+d:0);
	ans+=100.0*(sx-ex);
	ans+=100.0*(ey-sy);
	return;
}
int main()
{
	sx=Read()+2;sy=Read()+2;
	ex=Read()+2;ey=Read()+2;
	if(sx==ex&&sy==ey){
		puts("0.000000");
		return 0;
	}
	if(sy>ey||sy==ey&&sx>ex){
		swap(sx,ex);
		swap(sy,ey);
	}
	if(sx<ex)work1();
	else work2();
	ans+=0.00000000000001;
	/*long long tmp=10000000*ans;
	if(tmp%10>=5)tmp+=10;
	tmp/=10;ans=(double)tmp/1000000.0;
	ans+=0.00000000001;*/
	printf("%.12lf",ans);
	return 0;
}

Measured memory_bytes: 4096
#include <iostream>

using namespace std;

int main()
{
    string s, t; //s?
    cin >> s >> t;
    int len_s = s.length(); ///7
    int len_t = t.length(); ///5
    int flag = -1;
    for(int i = len_s - len_t; i >= 0; i--) /// 2-0
    {
        if(s[i] == '?' || s[i] == t[0])
        {
            for(int j = 0; j < len_t; j++)
            {
                if(s[i + j] != t[j] && s[i + j] != '?')
                {
                    break;
                }
                if(j == len_t - 1)
                {
                    flag = i;
                }
            }
            if(flag != -1)
            {
                break;
            }
        }
    }
    if(flag != -1)
    {
        for(int i = 0; i < flag; i++)
        {
            if(s[i] == '?')
                s[i] = 'a';
            cout << s[i];
        }
        cout << t;
        for(int i = flag + len_t; i < len_s; i++)
        {
            if(s[i] == '?')
                s[i] = 'a';
            cout << s[i];
        }
    }
    else
    {
        cout << "UNRESTORABLE";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
X = int(input())


def is_prime(n):
    if n == 1:
        return False
    else:
        for x in range(2, int(n ** 0.5) + 1):
            if (n % x) == 0:
                return False
        return True


while True:
    if is_prime(X):
        print(X)
        exit()
    else:
        X += 1


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N;
    cin >> N;
    repe(i,1,N+1){
        if(i%3==0){
            cout << " " << i;
        }
        else if(i%10==3){
            cout << " " << i;
        }
        else{
            ll x = i;
            while(x){
                x /= 10;
                if(x%10==3){
                    cout << " " << i;
                    break;
                }
            }
        }
    }
    cout << endl;
}


Measured memory_bytes: 3204
#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 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 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;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,c=0,x,y,z;
double d,e,f;
string s,t;
//

signed main() {
  RAPID;
  IN2(n,m);
  vector<vector<double>> X(n, vector<double>(m));
  REP(i,n){
    REP(j,m){
      IN(X.at(i).at(j));
    }
  }

  REP(i,n){
    REP(j,n){
      if(i >= j) continue;
      double sum = 0, result = 0;
      REP(k,m){
        sum += pow(abs(X.at(i).at(k) - X.at(j).at(k)),2);
      }
      result = sqrt(sum);
      if(floor(result) == result) c++;
    }
  }

  OUT(c);
}

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

int main() {
  int K; cin >>K;
  int ans=0;
  for (int i=2;i<=K;i+=2) {
    for (int j=1;j<=K;j+=2) {
      ans++;
    }
  }
  cout <<ans <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807/2;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
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 dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
int x,y;
int main(){
	cin>>x>>y;
	int ans=0;
	if(x<=3){
		ans+=(4-x)*100000;
	}
	if(y<=3){
		ans+=(4-y)*100000;
	}
	if(x==1&&y==1)ans+=400000;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset; // order_of_key, find_by_order
ll mod = 1e9+7, dp[200100], cnt[200200];

int main() {
	 ios::sync_with_stdio(0);
	 cin.tie(0);
	 cout.tie(0);
	 ll n;
	 vi c;
	 cin >> n;
	 c.resize(n);
	 for(auto &i : c) cin >> i;
	 for(int i = 0; i < n; i++) {
		 if(i&&c[i]==c[i-1]) {dp[i]=dp[i-1];continue;}
		 dp[i] = (cnt[c[i]]+(i?dp[i-1]:1))%mod;
		 cnt[c[i]] = (cnt[c[i]]+(i?dp[i-1]:1))%mod;
	 }
	 cout << dp[n-1];
}


Measured memory_bytes: 4224
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        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); }

        private static HashSet<int> Points(IEnumerable<int> steps)
        {
            var set1 = new HashSet<int>() { 0 };
            foreach (int step in steps)
            {
                var set2 = new HashSet<int>();
                foreach (int p in set1)
                {
                    set2.Add(p - step);
                    set2.Add(p + step);
                }
                set1 = set2;
            }
            return set1;
        }

        private static bool Solve(string s, int x, int y)
        {
            var steps = new List<int>();
            int step = 0;
            foreach (char c in s)
            {
                switch (c)
                {
                case 'F':
                    ++step;
                    break;
                case 'T':
                    steps.Add(step);
                    step = 0;
                    break;
                }
            }
            steps.Add(step);
            var xs = new List<int>();
            var ys = new List<int>();
            for (int i = 1; i < steps.Count; ++i)
            {
                if (i % 2 == 0) { xs.Add(steps[i]); }
                else            { ys.Add(steps[i]); }
            }
            return Points(xs).Contains(x - steps[0]) && Points(ys).Contains(y);
        }
        
        static void Main(string[] args)
        {
            string s = Read();
            int[] points = ReadInts();
            Console.WriteLine(Solve(s, points[0], points[1]) ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 35368
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int K = stdIn.nextInt();
		int[] price = new int[N];
		int total = 0;

		for(int i=0;i<N;i++) {
			price[i] = stdIn.nextInt();
		}

		Arrays.sort(price);

		for(int i=0;i<K;i++) {
			total += price[i];
		}

		System.out.println(total);
		stdIn.close();
	}

}

Measured memory_bytes: 38968
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		String word[] = new String[N]; 
		
		for(int i = 0; i < N; i++) {
			word[i] = sc.next();
		}
		
		boolean isRule = true;
		for(int i = 1; i < N; i++) {
			if(word[i-1].charAt(word[i-1].length()-1) == word[i].charAt(0)) {
				isRule = true;
			}else {
				isRule = false;
				System.out.println("No");
				break;
			}
		}
		
		for(int i = 0; i < N; i++) {
			for(int j = i+1; j < N; j++){
				if(word[i].equals(word[j])) {
					isRule = false;
					System.out.println("No");
					break;
				}
			}
		}
		
		if(isRule == true) {
			System.out.println("Yes");
		}
		
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const int MAX = 105;

class edge {
  public:
  int t, c;

  edge(int t = -1, int c = INF): t(t), c(c) {}

  bool operator < (const edge &e) const {
    return c > e.c;
  }
};

vector<edge> to[MAX];
bool seen[MAX];
int d[MAX], n;

void dijkstra(int u) {
  d[u] = 0;
  while (1) {
    seen[u] = true;
    for (edge e: to[u]) {
      if (seen[e.t]) continue;
      d[e.t] = min(d[e.t], d[u] + e.c);
    }

    int mind = INF;
    rep(i, n) {
      if (seen[i]) continue;
      if (d[i] < mind) {
        u = i;
        mind = d[i];
      }
    }

    if (mind == INF) break;
  }
}

int main() {
  cin >> n;
  int u, k;
  edge e;
  rep(i, n) {
    cin >> u >> k;
    rep(j, k) {
      cin >> e.t >> e.c;
      to[u].push_back(e);
    }
  }

  rep(i, n) {
    seen[i] = false;
    d[i] = INF;
  }

  dijkstra(0);

  rep(i, n) cout << i << " " << d[i] << endl;
  
  return 0;
}


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

#define check cout<<"-------"<<endl
#define debug(x) cout<<x<<endl;

#define N 101

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a[N][N] = {};
    int n;
    cin>>n;
    
    int u, k, v;
    for(int i = 0; i < n; i++) {
        cin>>u>>k;
        
        for(int j = 0; j < k; j++) {
            cin>>v;
            a[u][v] = 1;
        }
    }
    
    int i, j;
    for(i = 1; i <= n; i++) {
        for(j = 1; j < n; j++) {
            cout<<a[i][j]<<' ';
        }
        cout<<a[i][j]<<endl;
    }
    
    return 0;
}



Measured memory_bytes: 3256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int ma[309][309];
int main(){
    int n;
    scanf("%d",&n);
    ll ans=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            scanf("%d",&ma[i][j]);
            ans+=ma[i][j];
        }
    }
    ans/=2;
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            for(int k=1;k<=n;k++){
                if(k==i||k==j)continue;
                if(ma[i][j]>ma[i][k]+ma[k][j]){
                    printf("-1\n");
                    return 0;
                }
                if(ma[i][j]==ma[i][k]+ma[k][j]){
                    //cout<<i<<' '<<j<<' '<<k<<endl;
                    ans-=ma[i][j];break;
                }
            }
        }
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 640
import java.io.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));
        long N = Long.parseLong (reader.readLine());
        System.out.println (calc (1, N) - calc (3, N) - calc (5, N) +
                            calc (15, N));
        return;
    }

    static long calc (long n, long N) {
        return (n + N / n * n) * (N / n) / 2;
    }
}

Measured memory_bytes: 32636
#include<stdio.h>

void read(int *n,int A[]){
	scanf("%d",n);
	int i;
	for (i = 0; i < *n; i++) {
		scanf("%d", &A[i]);
	}
}

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

void insertionsort(int n,int A[]){
	int i,j,a;
	for(i=0;i<n;i++){
		for(j=0;j<i;j++){
			if(A[i]<A[j])
			{
				a=A[i];A[i]=A[j];A[j]=a;
			}
		}
	white(n,A);
	}
}

int main(){
	int i,n,A[100];
	read(&n,A);
	insertionsort(n,A);

	return 0;
}

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

int main() {
    int H, W;
    cin >> H >> W ;
    int i,j;
       
    while( (H != 0) or (W != 0)){ 
        i = 1;
        
        while(i <= H){
            j = 1;
            if (i== 1){
                while(j <= W){
                    cout << "#";
                    j = j + 1;
                }
            }
            else if(i == H){
                while(j <= W){
                    cout << "#";
                    j = j + 1;
                }
                
            }
            
            else{
                while(j <= W){
                if(j == 1){
                    cout << "#" ;
                    
                }
                else if(j == W){
                    cout << "#" ;
                }
                else{
                    cout << ".";
                }
                j = j + 1;
            }
                
            }
            
            cout << endl;
            i = i + 1;
        }
        cout<<""<< endl;
        cin >> H >> W;    
        }
        
        
    }
    


Measured memory_bytes: 3104
#include<iostream>
#include<string>
#include<map>

using namespace std;

class Dice{
	int face[6] ;
	map<string,int> dir;
	
public:
	Dice(int sai[6]){
		for(int i=0 ; i<6 ; i++){
			face[i] = sai[i] ;
		}
		dir["top"]    = 1 ;
		dir["south"]  = 2 ;
		dir["east"]   = 3 ;
		dir["west"]   = 4 ;
		dir["north"]  = 5 ;
		dir["bottom"] = 6 ;
	}
	void show(string d){
		if(d == "all"){
			for(int i=0 ; i<6 ; i++){
				cout << face[i] << " " ;
			}
			cout << endl;
			return ;
		}else{
			cout << face[dir[d]-1] << endl;
		}
	}
	int get(string d){
		return face[dir[d]-1] ;
	}
	void move(const string str){//動かす
		for(int i=0 ; i<str.size() ; i++){
			turn(str[i]);//char
		}
	}
	void turn(char d){//回す//direction:方向
		map<char, int> mp;
		mp['S'] = 0 ;
		mp['E'] = 1 ;
		mp['W'] = 2 ;
		mp['N'] = 3 ;
		
		static const int index[4][6] ={
			{5,1,3,4,6,2},//south
			{4,2,1,6,5,3},//east
			{3,2,6,1,5,4},//west
			{2,6,3,4,1,5},//north
		};
		
		int copy[6] ;
		for(int i=0 ; i<6 ; i++){
			copy[i] = face[i] ;
		}
		//これは止めて、代入演算子＝をオーバーライドしてもいいかもしれない。しかして、それをやると実行時のメモリが微増するはずだ。
		
		for(int i=0 ; i<6 ; i++){//permutation:置換
			face[i] = copy[index[mp[d]][i]-1] ;
		}
		
		//show("all");//check
	}
	void rotate(void){//回転//SWNの操作で、上から見てCCW:counter clock wise：反時計回りでの90度回転。
		turn('S');
		turn('W');
		turn('N');
	}
	bool adjust(int top,int south){//位置合わせ
		for(int i=0;i<6;i++){
			if(get("top") == top){
				break;
			}
			//cout << "zigzag:" << i << endl ;//check
			turn(i%2==0 ? 'S' : 'E');//三項演算子
		}
		for(int i=0;i<4;i++){
			//cout << "rotate:" << i << endl ;//check
			rotate();
			if(get("south") == south){
				return true ;
			}
		}
		
		return false ;
	}
	bool operator == (Dice obj){//演算子のオーバーライド
		if(obj.adjust(this->get("top"),this->get("south"))){
			for(int i=0 ; i<6 ; i++){
				if(this->face[i] != obj.face[i]){
					return false ;
				}
			}
			return true ;
		}
		
		return false ;
	}
};

int main(void){
	// ITP1_11_B　右側
	int sai[6] ;
	cin >> sai[0] >> sai[1] >> sai[2] >> sai[3] >> sai[4] >> sai[5] ;
	Dice d(sai) ;
	
	int n ;
	cin >> n ;
	
	for(int i=0 ; i<n ; i++){
		int top, south;
		cin >> top >> south ;
		d.adjust(top,south) ;
		d.show("east") ;
	}
}

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

int main(){
    int n;
    cin >> n;
    int a[100010];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a, a+n);
    cout << a[n/2]-a[n/2-1] << endl;
    return 0;
}

Measured memory_bytes: 640
n = int(input())
alphabet = list("abcdefghijklmnopqrstuvwxyz")
if n <= 26:
    print(alphabet[n-1])
else:
    ans = ""
    while(True):
        q, mod = divmod(n, 26)
        if mod == 0:
            q -= 1
            ans = "z" + ans
        else:
            ans = alphabet[mod-1] + ans
        if q < 1:
            break
        n = q
    print(ans)

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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,N,j) for(int i = (N-1);i >= (j);i--)
#define _rec(i,N,j) for(int i = (N);i >=(j);i--)
#define ALL(x) x.begin(),x.end()
#define MEM(a,n) memset(a,n,sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

int get_int(){int x;scanf("%d",&x);return x;}
LL get_ll(){LL x;scanf("%lld",&x);return x;}
double get_db(){double x;scanf("%lf",&x);return x;}

template<typename T> int chmin(T &a,T b){if(a > b){a = b;return 1;}else return 0;}
template<typename T> int chmax(T &a,T b){if(a < b){a = b;return 1;}else return 0;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {_for(i,0,v.size()) os << v[i] << " ";return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){for(auto a:v) os << a <<" ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){os << v.fst <<" "<<v.scd << " ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& v){for(auto a:v) cout << a << endl;return os;}

static const int dx[8] = { -1,  0, 1, 0,  1, -1,  1, -1};
static const int dy[8] = {0,  1, 0,  -1,  1, -1, -1,  1};
const double pi  = acos(-1.0);
const double eps = 1e-8;
//const LL  INF  = 0x3f3f3f3f3f3f3f3f;
const int inf  = 0x3f3f3f3f;

int L,R;

int main()
{
    cin >> L >> R;
    if(R-L >= 2019){
        cout << 0 << endl;
    }
    else{
        LL ans = 2019;
        _rep(i,L,R){
            _rep(j,i+1,R){
                LL a = i;
                LL b = j;
                chmin(ans,a*b%2019);
            }
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 256
from sys import stdin

lst = []
maxv = 0
for i in range(5):
    p = int(stdin.readline().rstrip())
    lst.append(p)
for i in range(4):
    a = lst[i]
    for j in range(5):
        b = lst[j]
        tmp = abs(a-b)
        if tmp > maxv:
            maxv = tmp

k = int(stdin.readline().rstrip())
if maxv <= k:
    ans = "Yay!"
else:
    ans = ":("
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repp(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

signed main(){
    string w;
    cin >> w;
    int d[26] = {};
    rep(i, 0, w.size()){
        d[w[i] - 'a']++;
    }
    bool f = true;
    rep(i, 0, 26){
        if(d[i] % 2) f = false;
    }
    cout << (f ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
    String s = sc.next();
    String ans = "No";
    if(n%2==0){
      String s1 = s.substring(0,n/2);
      String s2 = s.substring(n/2,n);
      if(s1.equals(s2))ans="Yes";
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21204
#include <bits//stdc++.h>
using namespace std;
int main(void){
    int a,b,c,i,j;
    cin>>a>>b;
    c=a+b;
    i=a-b;
    j=a*b;
    if(c>i&&c>j)
    cout<<c<<endl;
    else if(i>j)
    cout<<i<<endl;
    else
    cout<<j<<endl;
    
}


Measured memory_bytes: 256
import java.util.*;

class Main {
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();
       int[] A = new int[N+1];
       int cnt = 0;
       for(int i=1;i<N;i++) {
           A[i] = sc.nextInt();
       }
       
       for(int i=1;i<N;i++) {
    	   if(A[i]!=i) {
    		   A[A[i]] = A[i];
    		   A[i]=i;
    		   cnt++;
    	   }
       }
       
       
       if(cnt<2) {
           System.out.print("YES");
    	   
       }else {
           System.out.print("NO");
    	   
       }
       
   }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
signed main()
{
	vector<int>v;
	int n;
	cin>>n;
	for (int i=0;i<n;i++){
		int l;
		cin>>l;
		v.pb(l);
	}
	sort(all(v));
	int ans=0;
	for (int i=0;i<n-1;i++){
		for (int j=i+1;j<n;j++){
			int u=lower_bound(all(v),v[j]+v[i])-upper_bound(all(v),v[j]-v[i]);
			if (lower_bound(all(v),v[j]+v[i])-v.begin()>=i && upper_bound(all(v),v[j]-v[i])-v.begin()<=i)  u--;
			if (lower_bound(all(v),v[j]+v[i])-v.begin()>=j && upper_bound(all(v),v[j]-v[i])-v.begin()<=j)  u--;
			ans+=u;
			//cout<<"i="<<i<<",j="<<j<<",u="<<u<<",ans="<<ans<<endl;
		}
	}
	ans/=3;
	cout<<ans;
	re 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, h = IR(3)
    print((a+b)*h//2)
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 38512