akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int a,b,h;

main() {
    cin >> a >> b >> h;
    ct((a+b)*h/2)
}



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

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(H: int, N: int, A: "List[int]"):
    print(YES if H <= sum(A) else NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(H, N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 13996
# vim: set fileencoding=utf-8:
import bisect


def main():
    N, K = map(int, raw_input().split())
    x = [int(ele) for ele in raw_input().split()]
    o = bisect.bisect_right(x, 0)
    top = min(o + K, N)
    bottom = max(o - K, 0)
    best = 999999999999
    for i in xrange(K):
        if top < bottom + i + K:
            break

        if x[bottom + i + K - 1] < 0:
            best = min(best, abs(x[bottom + i]))
        elif x[bottom + i] < 0 <= x[bottom + i + K - 1]:
            ans1 = 2 * min(abs(x[bottom + i]), x[bottom + i + K - 1])
            ans2 = max(abs(x[bottom + i]), x[bottom + i + K - 1])
            ans = min(best, ans1 + ans2)
            best = min(best, ans)
        elif 0 <= x[bottom + i]:
            best = min(best, x[bottom + i + K - 1])

    print(best)


if __name__ == "__main__":
    main()


Measured memory_bytes: 11880
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

public class AtCoder
{
  public static void Main()
  {
    var input = Console.ReadLine();
    var a = int.Parse(input[0].ToString());
    var b = int.Parse(input[1].ToString());
    var c = int.Parse(input[2].ToString());
    var d = int.Parse(input[3].ToString());

    var x = 0;
    var i = 0;
    for(i=0; i < 16; i++)
    {
      x = a;
      x += (i & (1 << 2)) > 0 ? b : -b;
      x += (i & (1 << 1)) > 0 ? c : -c;
      x += (i & (1 << 0)) > 0 ? d : -d;

      if(x == 7) break;
    }
  
    var op = new []{"-","+"};

    var ans =
    a + op[i >> 2 & 1] +
    b + op[i >> 1 & 1] +
    c + op[i >> 0 & 1] +
    d + "=7";
    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 13140
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int x1=sc.nextInt();
		int y1=sc.nextInt();
		int x2=sc.nextInt();
		int y2=sc.nextInt();
		int a=x2-x1;
		int b=y2-y1;
		for(int i=0;i<a;i++){
			System.out.print("R");
		}
		for(int i=0;i<b;i++){
			System.out.print("U");
		}
		for(int i=0;i<a;i++){
			System.out.print("L");
		}
		for(int i=0;i<b;i++){
			System.out.print("D");
		}
		System.out.print("D");
		for(int i=0;i<a;i++){
			System.out.print("R");
		}
		System.out.print("RU");
		for(int i=0;i<b;i++){
			System.out.print("U");
		}
		System.out.print("L");
		System.out.print("U");
		for(int i=0;i<a;i++){
			System.out.print("L");
		}
		System.out.print("LD");
		for(int i=0;i<b;i++){
			System.out.print("D");
		}
		System.out.print("R");	
	}
}


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

int main() {
  int n, k;
  int res = 1;
  
  cin >> n >> k;
  
  int i;
  
  for(i = 0; i < n; i++) {
    if(res < k) {
      res *= 2;
    }
    else {
      break;
    }
  }
  for (; i < n; i++) {
    res += k;
  }
  
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
while True:
    n = int(input())
    if n == 0:
        break
    else:
        a = list(map(int, input().split()))
        m = sum(a)/n
        sigma = 0
        for i in range(n):
            sigma += (a[i] - m)**2
        bun = sigma/n
        ans = bun**(1/2)
    print(ans)


Measured memory_bytes: 5664
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.NoSuchElementException;
public class Main {
	public static void main(String[] args)throws Exception{
		int H=nextInt();
		int W=nextInt();
		boolean key[][]=new boolean[H][W];
		boolean visit[][]=new boolean[H][W];
		boolean fin=false;
		int ans=0,k=0;
		Deque<Integer> Q=new ArrayDeque<Integer>();
		for(int i=0;i<H;i++){
			String a=next();
			for(int j=0;j<W;j++){
				char b=a.charAt(j);
				if(b=='#'){
					key[i][j]=true;k++;
				}
			}
		}
		Q.add(0);Q.add(0);Q.add(1);visit[0][0]=true;
		while(Q.size()>0){
			int i=Q.poll();
			int j=Q.poll();
			int cout=Q.poll();
			if(i==H-1&&j==W-1){
				fin=true;ans=cout;
				break;
			}
			if(j!=W-1&&key[i][j+1]&&visit[i][j+1]==false){
				Q.add(i);Q.add(j+1);Q.add(cout+1);visit[i][j+1]=true;
			}
			if(i!=H-1&&key[i+1][j]&&visit[i+1][j]==false){
				Q.add(i+1);Q.add(j);Q.add(cout+1);visit[i+1][j]=true;
			}
		}
		if(fin&&k==ans)
			System.out.println("Possible");
		else
			System.out.println("Impossible");
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
}


Measured memory_bytes: 21332
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream cin("in.txt");
#endif
  int A, B, T;
  while (cin >> A >> B >> T) {
    int res = (T / A) * B;
    cout << res << endl;
  }
  return 0;
}


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

using namespace std;


using int64 = long long;
const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

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

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}


int main() {
  int H, W, K;
  cin >> H >> W >> K;
  vector< string > S(H);
  cin >> S;

  vector< int > ys;
  for(int i = 0; i < H; i++) {
    bool appear = false;
    for(int j = 0; j < W; j++) {
      appear |= S[i][j] == '#';
    }
    if(appear) ys.emplace_back(i);
  }
  ys.emplace_back(H);

  auto ans = make_v< int >(H, W);

  int ptr = 1;
  for(int i = 1; i < ys.size(); i++) {
    int s = (i == 1 ? 0 : ys[i - 1]);
    int t = ys[i] - 1;

    int base_y = ys[i - 1];

    vector< int > xs;
    for(int j = 0; j < W; j++) {
      if(S[base_y][j] == '#') xs.emplace_back(j);
    }
    xs.emplace_back(W);
    for(int j = 1; j < xs.size(); j++) {
      int ss = (j == 1 ? 0 : xs[j - 1]);
      int tt = xs[j] - 1;
      for(int yy = s; yy <= t; yy++) {
        for(int xx = ss; xx <= tt; xx++) {
          ans[yy][xx] = ptr;
        }
      }
      ++ptr;
    }
  }

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

}






Measured memory_bytes: 1280
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
double pi=3.14159265;

int main(){
    while(1){
        int H,W;
        cin >> H >> W;
        if(H==0 && W==0) return 0;
        rep(j,W) cout << '#';
        cout << endl;
        rep(i,H-2){
            cout << '#';
            rep(j,W-2) cout << '.';
            cout << '#';
            cout << endl;
        }
        rep(j,W) cout << '#';
        cout << endl;
        cout << endl;
    }
}


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

int main() {
	int64_t n;
	cin >> n;
	int64_t a[n], b[n], c[n];
	for (auto &i : a) {
		cin >> i;
	}
	for (auto &i : b) {
		cin >> i;
	}
	for (auto &i : c) {
		cin >> i;
	}
	sort(a, a + n);
	sort(b, b + n);
	sort(c, c + n);
	int64_t puni[n]{};
	for (int i = 0, j = 0; i < n; i++) {
		for (; j < n && b[i] >= c[j]; j++) ;
		if (j == n) {
			break;
		}
		puni[i] = n - j;
	}
	int64_t sum[n + 1]{};
	for (int i = 1; i < n + 1; i++) {
		sum[i] = sum[i - 1] + puni[i - 1];
	}
	int64_t muni[n]{};
	for (int i = 0, j = 0; i < n; i++) {
		for (; j < n && a[i] >= b[j]; j++) ;
		if (j == n) {
			break;
		}
		muni[i] = sum[n] - sum[j];
	}
	cout << accumulate(muni, muni + n, int64_t(0)) << endl;
	return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include <string>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

int main(){
	int h,w; cin >>h>>w;
	vector<string> a(h);
	cinf(h,a);
	int cnt=0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(a[i][j]=='#')cnt++;
		}
	}
	if(cnt==h+w-1)cout << "Possible" << endl;
	else cout << "Impossible" << endl;
}

Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
B = []
s = 0
ans = 0
val = 1000000007

for i in range(N):
    s += A[i]
    B.append(s)

for i in range(N-1):
    ans += A[N-i-1] * B[N-i-2]

print(ans % val)

Measured memory_bytes: 31432
from collections import deque
q=deque([1,2,3,4,5,6,7,8,9])
n=int(input())
def check(k):
  while k<=n:
    a=q.popleft()
    if a%10-1>=0:
      q.append(a*10+a%10-1)
      k=k+1 
      if k==n:
        return a*10+a%10-1
    k=k+1
    q.append(a*10+a%10)
    if k==n:
      return a*10+a%10
    if a%10+1<=9:
      q.append(a*10+a%10+1)
      k=k+1
      if k==n:
        return a*10+a%10+1
if n<=9:
  print(n)
else:
  print(check(9))
  

Measured memory_bytes: 40816
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>

using namespace std;


int main() {
	long long X;

	cin >> X;

	long  long m = 100, count = 0;

	while (m < X) {
		m += m / 100;
		count++;
	}

	cout << count << endl;
}

Measured memory_bytes: 3188
# include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long ll;

int main(){
  int a;
  cin >> a;
  if(a>=30) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
	long long int h;
	scanf("%lld", &h);

	long long int ans = 0;
	long long int num = h;
	long long int add = 1;
	while ( num != 0 ) {
		ans += add;
		add *= 2;
		num /= 2;
	}
	printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
string s;
cin>>s;
int smax = 0;
int r = 0;
bool f = false;

rep(i,s.size()){
    if(s[i]=='R'&&f)
    { r++;
       smax = max(r,smax);
    }else if(s[i]=='R'&&f==false){
        r++;
        smax = max(r,smax);
        f=true;
    }else{
        f=!f;
        r=0;
    }
}
smax=max(r,smax);
cout<<smax<<endl;




return 0;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;

#define MAX_NUM (1000000007)
#define PI 3.14159265358979323846

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

template <typename T>
static inline T ArraySum(vector<T>& A) {
  T res = 0;
  for (auto itr = A.begin(); itr < A.end(); ++itr) res += *itr;
  return res;
}

bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

u64 dec_dig(u64 num) {
  u64 res = 0;
  while (num > 0) {
    num /= 10;
    ++res;
  }
  return res;
}

i64 modinv(i64 a, i64 m) {
  i64 b = m, u = 1, v = 0;
  while (b) {
    i64 t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

u64 gcd(u64 a, u64 b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }

  return b ? gcd(b, a % b) : a;
}

i64 My_Comb(u64 n, u64 k, i64 m) {
  if (n < k) return 0;
  if (k == 0 || n == k) return 1;
  u64 res = 1;
  k = (n / 2 < k) ? n - k : k;
  for (u64 i = 1; i <= k; ++i)
    res = (((res * (n + 1 - i)) % m) * modinv(i, m)) % m;
  return res;
}

i64 My_Pow(u64 a, u64 n, i64 m) {
  u64 tmp = n, calc = 1;
  while (tmp > 0) {
    if (tmp % 2) {
      tmp--;
      calc *= a;
      calc %= m;
    } else {
      a *= a;
      a %= m;
      tmp /= 2;
    }
  }
  return calc;
}

int main() {
  cout << setprecision(18);
  i64 A, B, C;
  cin >> A >> B >> C;

  if (B / A <= C) {
    cout << B / A << endl;
  } else {
    cout << C << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2147483647
#define int long long
#define _MATH_DEFINES_DEFINED
#pragma GCC optimize("O2")
using namespace std;
int tot,cs;
inline int read(void){
	int f=1,n=0;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){n=n*10+(c-'0');c=getchar();}
	return f*n;
}
void step(int h){
	if(h==1) tot+=cs;
	else step(h>>1),tot+=cs;
	cs*=2;
	return;
}
signed main(void){
	int h=read();
	if(h==1){
		cout<<1<<endl;
		return 0;
	}
	tot++,cs=2;
	step(h>>1);
	cout<<tot<<endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    al = list(map(int, input().split()))

    #print(n)
    #print(al)

    #print(len(al))

    cnt = 1
    bl = []
    for ai in al:
        if ai == cnt:
            bl.append(ai)
            cnt += 1
    b_cnt = len(al) - len(bl)
    if(cnt == 1):
        print(-1)
    else:
        print(b_cnt)

if __name__ == "__main__":
    main()

Measured memory_bytes: 26268
import sys
 
read = sys.stdin.read
 
 
def main():
    N, K = map(int, read().split())
 
    dp1 = [0] * (K + 1)
    dp2 = [0] * (K + 1)
    dp1[0] = 1
 
    for x in map(int, str(N)):
        for j in range(K, -1, -1):
            if j > 0:
                dp2[j] += dp2[j - 1] * 9
                if x != 0:
                    dp2[j] += dp1[j - 1] * (x - 1) + dp1[j]
                    dp1[j] = dp1[j - 1]
            else:
                dp1[j] = 0
                dp2[j] = 1
 
    print(dp1[K] + dp2[K])
    return
 
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 9188
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int i,j;
    bool OK = false;
    
    for(i = 0; i <= N / 4; i++){
        for(j = 0; j <= N / 7; j++){
            if(4 * i + 7 * j == N)
            OK = true;
        }
    }
    if(OK == false){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define ALL(x) std::begin(x), std::end(x)
using namespace std;

int main() {
    // input
    int n; scanf("%d", &n);
    vector<int> a(n);
    REP (i, n) {
        scanf("%d", &a[i]);
    }
    vector<int> b(n);
    REP (i, n) {
        scanf("%d", &b[i]);
    }

    // solve
    vector<int> ja; {
        set<int> used;
        REP (i, n) {
            if (not used.count(a[i])) {
                used.insert(a[i]);
                ja.push_back(i);
            }
            if (ja.size() >= 100) break;
        }
    }
    vector<int> ib; {
        set<int> used;
        REP (i, n) {
            if (not used.count(b[i])) {
                used.insert(b[i]);
                ib.push_back(i);
            }
            if (ib.size() >= 100) break;
        }
    }
    default_random_engine gen;
    auto check = [&](int k) {
        int x = a[k] ^ b[0];
        for (int j : ja) {
            int i = (j - k + n) % n;
            if (x != (a[(i + k) % n] ^ b[i])) return -1;
        }
        for (int i : ib) {
            if (x != (a[(i + k) % n] ^ b[i])) return -1;
        }
        REP (iteration, 100) {
            int i = uniform_int_distribution<int>(0, n - 1)(gen);
            if (x != (a[(i + k) % n] ^ b[i])) return -1;
        }
        return x;
    };

    // output
    REP (k, n) {
        int x = check(k);
        if (x != -1) {
            printf("%d %d\n", k, x);
        }
    }
    return 0;
}


Measured memory_bytes: 4992
while True:
    H,W = [int(i) for i in input().split()]
    if H == 0 and W == 0:
        break
    else:
        for line in list(range(1,H+1,1)):
            for column in list(range(1,W+1,1)):
                if line == 1 or line == H:
                    if column == W:
                        print("#")
                    else:
                        print("#", end = "")

                else:
                    if column == 1:
                        print("#", end = "")
                    elif column == W:
                        print("#")
                    else:
                        print(".", end = "")
        print("")


Measured memory_bytes: 7004
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  double arr[n+1];
  for(int i=0;i<n;++i)
  cin>>arr[i+1];
  double dp[n+1][n+1];
  memset(dp,0,sizeof(dp));
  dp[0][0]=1;
  for(int i=1;i<=n;++i)
  {
    for(int j=0;j<i;++j)
    {
      dp[i][j+1]+=dp[i-1][j]*arr[i];
      dp[i][j]+=dp[i-1][j]*(1-arr[i]);
    }
  }
  double ans=0.0;
  /*for(int i=0;i<=n;++i)
  {
    for(int j=0;j<=n;++j)
    cout<<dp[i][j]<<" ";
    cout<<endl;
  }*/
  for(int i=0;i<=n;++i) if(i>n-i) ans+=dp[n][i];
  cout<<setprecision(12)<<ans;
}

Measured memory_bytes: 70528
#include <bits/stdc++.h>
    
using namespace std;
typedef long long ll;
    
int main()
{
    ll a, b;
    cin >> a >> b;

    int acount = 0;
    int bcount = 0;

    string sacount;
    for (int i = 1; i <= b; i++) {
        sacount.append(to_string(a));
    }
    string sbcount;
    for (int i = 1; i <= a; i++) {
        sbcount.append(to_string(b));
    }
    
    vector<string> vec;
    vec.push_back(sacount);
    vec.push_back(sbcount);
    sort(vec.begin(), vec.end());

    cout << vec[0];

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) scanf("%lld",&n)
#define pl(n) printf("%lld",n)
#define sz(a) (int)(a).size()
const int mod=2e9;
signed main(){
  int days;
  sl(days);
  Vl dp(3,0);
  for(int k=1;k<=days;k++){
	  int arr[3];
	  Vl new_dp(3,0);
	  for(int i=0;i<3;i++)sl(arr[i]);
	  for(int i=0;i<3;i++){
		  for(int j=0;j<3;j++){
		      if(i!=j)
		      {
				  new_dp[j]=max(dp[i]+arr[j],new_dp[j]);  
			  }	  
		  }
	  }
	  dp=new_dp;
  }
  
  cout<<max(dp[0],max(dp[1],dp[2]))<<endl;
  return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) {
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  int A, B; cin>>A>>B;
  int ans = 0;
  int cnt = 1;
  while(cnt < B) {
    cnt	+= A-1;
    ans++;
    //    cout << cnt << " " << ans << endl;                                                     
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define INF 1000000000
int i,j,k,p;

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

    while(1){
        bool prime=true;
        for(i=2;i*i<=x;i++){
            if(x%i==0){prime=false;break;}
        }
        if(prime){break;}
        x++;
    }

    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

ll s;
ll t[10];

ll mod_pow(ll x, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

ll calc0(ll i) {
    if (i >= 8 || t[i] - t[i-1] >= s/i) {
        ll ret = mod_pow(10, i);
        ret = (ret - mod_pow(10, i-1) + mod) % mod;
        ret = (ret - s/i + 1 + mod) % mod;
        return ret;
    }
    return 0;
}

ll calc1() {
    int ret = 0, l = 1, r = 1;
    int L = 10, fl = 1, R = 10, fr = 1;
    int sum = 1;
    while (l < t[8] && fr <= s) {
        while (sum < s) {
            r++;
            if (r == R) {
                fr++;
                R *= 10;
            }
            sum += fr;
        }
        if (r >= t[8]) break;
        if (sum == s) {
            if (fr - fl > 0) ret++;
            r++;
            if (r == R) {
                fr++;
                R *= 10;
            }
            sum += fr;
        }
        if (r >= t[8]) break;
        while (sum > s) {
            sum -= fl;
            l++;
            if (l == L) {
                fl++;
                L *= 10;
            }
        }
        if (sum == s) {
            if (fr - fl > 0) ret++;
            sum -= fl;
            l++;
            if (l == L) {
                fl++;
                L *= 10;
            }
        }
    }
    return ret;
}

ll calc2() {
    ll ret = 0;
    for (int i = 1; i < s; i++) {
        if (s % i != 0 && s / i >= 8) ret++;
    }
    return ret;
}

ll solve() {
    for (int i = 0; i < 10; i++) {
        t[i] = 1;
        for (int j = 0; j < i; j++) {
            t[i] *= 10;
        }
    }

    ll res = 0;
    for (ll i = 1; i * i <= s; i++) {
        if (s % i == 0) {
            res = (res + calc0(i)) % mod;
            if (i * i < s) res = (res + calc0(s/i)) % mod;
        }
    }

    res = (res + calc1()) % mod;
    res = (res + calc2()) % mod;
    return res;
}

void input() {
    cin >> s;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}


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

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int answer = 0;
        for (int i = 1; i <= N; i++) {
            if (i % 2 == 0) {
                continue;
            }
            int count = 0;
            for (int j = 1; j*2 <= i; j++) {
                if (i % j == 0) {
                    count += 1;
                }
            }
            if (count == 7) {
                answer += 1;
            }
        }
        System.out.println(answer);
    }
}


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

using namespace std;
typedef  long long int ll;
#define rep(i, n) for (int i = 0; i < (n); i++)

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

    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];

    int r, now_sum, now_xor;
    r = now_sum = now_xor = 0;

    ll ans = 0;
    for (int l = 0; l < n; l++) {
        while (r < n && (now_sum+v[r]) == (now_xor^v[r])) {
            now_sum += v[r];
            now_xor ^= v[r];
            r++;
        }
        ans += r -l;
        now_sum -= v[l];
        now_xor ^= v[l];
    }
    cout << ans << endl;



    return 0;
 }


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
    int H,W,k;
    while(1){
      cin >> H >> W;
      if(H==0&W==0) break;
      for (int i = 1; i<=H; i++){
        for (int j = 1; j<=W; j++){
          if((i+j)%2==0)
            cout<<"#";
          else
            cout<<".";
        }
        cout<<endl;
      } 
      cout<<endl;
    }
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void swap(int arr[], int x, int y)
{
	int temp = arr[x];
	arr[x] = arr[y];
	arr[y] = temp;
}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int arr[3];
	cin>>arr[0]>>arr[1]>>arr[2];
	swap(arr,0,1);
	swap(arr,0,2);
	printf("%d %d %d",arr[0],arr[1],arr[2]);
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int sum = 0;
        for (int i = 0; i < n; i++) {
            sum += scanner.nextInt() -1;
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 26600
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0,(i##_len)=(n);(i)<(i##_len);(i)++)
#define rep2(i,a,b) for(ll (i)=(a),(i##_len)=(b);(i)<=(i##_len);(i++))
#define rrep(i,n) ll(i)=(n);ll now=-1;while((i)--&&(now++||1))
#define Yes(n) cout<<((n)?Yes:No)<<"\n"
#define vll vector<ll>
#define pb push_back
using namespace std;
using ll = long long;

static inline void ignore_ret(int x) {}
template<class T> bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> T abs(T x){return max(x,-x);}
template<class T> T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> T lcm(T m,T n) {return m*n/gcd(m,n);}
template<class T> T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm<T>(r,v.at(i));return r;}
template<class T> T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> T nCr(T n,T k){return factorial<T>(n)/(factorial<T>(k)*factorial<T>(n-k));}
template<class T> T dot_product(vector<T>u,vector<T>v){T r=0;for(T i=0;i<u.size();i++)r+=u.at(i)*v.at(i);return r;}
template<class T> T sum(vector<T>v){return reduce(all(v),0LL);}

// Template ends here

void solve(ll N, ll D, ll X, vector<ll> A){
    ll sum = 0;
    rep(i, N) {
        sum += (D - 1) / A.at(i) + 1;
    }
    cout << X + sum << "\n";
}

int main() {
    ll N;
    ignore_ret(scanf("%lld",&N));
    ll D;
    ignore_ret(scanf("%lld",&D));
    ll X;
    ignore_ret(scanf("%lld",&X));
    vector<ll> A(N);
    for(int i = 0 ; i < N ; i++){
        ignore_ret(scanf("%lld",&A[i]));
    }
    solve(N, D, X, move(A));
    return 0;
}

Measured memory_bytes: 256
<?php
while (true)
{
    $in = explode(" ", trim(fgets(STDIN)));
    $h = $in[0];
    $w = $in[1];
    if($h == 0 && $w == 0)
    {
        break;
    }
    for($i = 0; $i < $h; $i++)
    {
        for($j = 0; $j < $w; $j++)
        {
            if($i % 2 == 0)
            {
                if($j % 2 == 0)
                {
                    echo "#";
                }
                else
                {
                    echo ".";
                }
            }
            else
            {
                if($j % 2 == 0)
                {
                    echo ".";
                }
                else
                {
                    echo "#";
                }
            }
        }
        echo "\n";
    }
    echo "\n";
}

Measured memory_bytes: 15276
#include<bits/stdc++.h>
typedef long long int ll;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define p push
#define p1 pop
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair<ll,ll>
#define e 1000000007
using namespace std;
int main(){
    ll n;cin>>n;
    ll dp[n][3];
    ll a,b,c;cin>>a>>b>>c;
    dp[0][0]=a;dp[0][1]=b;dp[0][2]=c;
    for(int i=1;i<n;++i)
    {
        ll x,y,z;cin>>x>>y>>z;
        dp[i][0]=x+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=y+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=z+max(dp[i-1][0],dp[i-1][1]);
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
    return 0;
}

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

using ll=long long; 

signed main(){
   ll n,k; 
   cin >> n >> k;
   vector<ll > h(n); 
   for (int i = 0 ; i < n ; i += 1){ 
      cin >> h[i] ;
   }
   sort(h.begin(), h.end());
   reverse(h.begin(), h.end());
   ll sum = 0;
   for (int i = k ; i < n ; i += 1){
      sum += h[i];
   }
   cout << sum << endl;
}

Measured memory_bytes: 1792
function main(input) {
  var temp = input.split('\n');
  var house = [];
  var bar = "";
  for (var l =0; l < 20; l++) {
    bar += "#";
  }
  for (var j =0; j < 12; j++) {
    house[j] = Array(10).fill(0);
  }
  
  for (var i = 0; i < temp[0]; i++) {
    var arr = temp[(i+1)].split(' ').map(Number);
    var b = arr[0];
    var f = arr[1];
    var r = arr[2];
    var v = arr[3];

    house[((b-1)*3)+f-1][(r-1)] += v;
  }
  for (var k = 0; k < house.length; k++) {
    console.log(" "+house[k].join(' '));
    if((k+1)%3 == 0 && k != 0 && k != house.length-1) {
      console.log(bar);
    }
  }
}

var x = require('fs').readFileSync('/dev/stdin', 'utf-8');
main(x);


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

int main(){
	int h1, m1, h2, m2, k;
  	cin >> h1 >> m1 >> h2 >> m2 >> k;
  	
  	int ans = (h2-h1) * 60 + m2 - m1 - k;
  	cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <math.h>

using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
static const ll maxLL = (ll)1 << 62;

int main() {
	ll N; cin >> N;
	ll T[1001] = {};
	ll A[1001] = {};
	repe(i, 1, N) {
		cin >> T[i] >> A[i];
	}
	ll a = 1, b = 1;
	repe(i, 1, N) {
		ll x = a / T[i] + ((a % T[i] == 0) ? 0 : 1);
		ll y = b / A[i] + ((b % A[i] == 0) ? 0 : 1);
		ll K = max(x, y);

		a = K * T[i];
		b = K * A[i];
	}

	cout << a + b << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int m,n,x;
int city[51]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
scanf("%d%d",&n,&m);
for(int i=0;i<2*m;i++){
scanf("%d",&x);
city[x]++;
}
for(int i=1;i<=n;i++){
printf("%d\n",city[i]);
}
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
	int w,h;
	vector<long long> p,q;
	long long cost=0;
	long long tmp;
	cin >> w >> h;
	for(int i=0;i<w;i++){
		cin >> tmp;
		p.push_back(tmp);
	}
	for(int i=0;i<h;i++){
		cin >> tmp;
		q.push_back(tmp);
	}
	sort(p.begin(),p.end());
	sort(q.begin(),q.end());
	int x=0;
	int y=0;
	int w1=w;
	int h1=h;
	while(w>0||h>0){
		if(x>(w1-1)){
			cost += q[y]*(w+1);
			h-=1;
			y+=1;
		}else if(y>(h1-1)){
			cost += p[x]*(h+1);
			w-=1;
			x+=1;
		}else if(p[x]<=q[y]){
			cost += p[x]*(h+1);
			w-=1;
			x+=1;
		}else{
			cost += q[y]*(w+1);
			h-=1;
			y+=1;		
		}
	}
	cout << cost << endl;
	return 0;
}

Measured memory_bytes: 2548
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define pp pair<ll, ll>
#define pps pair<ll, string>
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define srep(i, s) rep(i, s.size())
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define pb push_back
const int MOD=1e9+7;
ll n,m,dp[100010],fail[100010];
int main()
{
	cin>>n>>m;
	rep(i,m){
		int _;
		cin>>_;
		fail[_]=1;
	}
	dp[0]=1;
	rep(i,n){
		if(!fail[i]){
			dp[i]%=MOD;
			dp[i+1]+=dp[i];
			dp[i+2]+=dp[i];
		}
	}
	cout<<dp[n]%MOD<<endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	static int[] a;
	static int n;
	static int k;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		n=sc.nextInt();
		k=sc.nextInt();
		a=new int[n];
		long sum=0;
		for(int i=0; i<n; i++){
			a[i]=sc.nextInt();
			sum+=a[i];
		}
		long ans=1;
		for(int i=1; i*i<=sum; i++){
			if(sum%i==0){
				ans=Math.max(ans,ch(i));
				ans=Math.max(ans,ch(sum/i));
			}
		}
		System.out.println(ans);
	}
	public static long ch(long t){
		long[] ar=new long[n+1];
		for(int i=1; i<=n; i++){
			ar[i]=a[i-1]%t;
		}
		Arrays.sort(ar);
		for(int i=2; i<=n; i++){
			ar[i]+=ar[i-1];
		}
		int q=(int)(ar[n]/t);
		if(ar[n-q]<=k){
			return t;
		}else{
			return 1;
		}
	}
}


Measured memory_bytes: 31824
n, d = gets.strip.split.map(&:to_i)
ary = n.times.map {gets.split.map(&:to_i)}
count = 0
ary.combination(2) do |a, b|
  sum = 0
  d.times do |i|
    sum += (a[i] - b[i]) ** 2
  end

  dis = Math.sqrt(sum)
  count += 1 if (dis % 1).zero?
end

puts count

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define srand() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l,r) uniform_int_distribution<int>(l,r)(rng)
typedef unsigned long long ull;
const int inf=1039074182;
using namespace std;
map<map<char,int>,int> m;

int main()
{
//	freopen("input.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	string c;
	map <char,int> t;
	for(int i=0;i<n;i++)
	{
		t.clear();
		cin>>c;
		for(auto x:c)
		{
			t[x]++;
		}
		m[t]++;
	}
	ll res=0;
	for(auto x:m)
	{
		res+=1LL*x.second*(x.second-1)/2;
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 49152
def insert(pos, s, x):
    return x.join([s[:pos], s[pos:]])


s = input()
length = len(s)
ret = 0

for i in range(2 ** (length-1)):
    my_str = s
    cnt = 0
    for j in range(length):
        if ((i >> j) & 1):
            my_str = insert(j+cnt+1, my_str, "+")
            cnt = cnt + 1
    ret = ret + eval(my_str)

print(ret)


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

#define PREP(i, m, n) for(int i = m; i < n; i++)
#define MREP(i, m, n) for(int i = m - 1; i >= n; i--)

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define prime first
#define weight second
#define MP make_pair
#define PB push_back

using namespace std;

int main(){
	int n = 0;
	while(cin >> n && n != 0){
		map<int, int> ev;
		int max = -1, min = 1001;
		
		rep(i, n){
			int s = 0;
			cin >> s;

			if(s > max) max = s;
			if(s < min) min = s;

			if(ev.find(s) != ev.end()) ev[s]++;
			else ev[s] = 1;
		}

		ev[max]--;
		ev[min]--;

		int result = 0, factor = 0;
		
		for(map<int, int>::iterator it = ev.begin(); it != ev.end(); it++){
			rep(i, it->second){
				result += it->first;
				factor++;
			}
		}

		cout << result / factor << endl;
	}
	

	return 0;
}

Measured memory_bytes: 1200
#include <stdio.h>

int main(void) {
  double x[4], y[4];
  int i, j;
  while(scanf("%lf,%lf", &x[0], &y[0]) != EOF) {
    for(i = 1; i < 4; ++i) scanf(",%lf,%lf", &x[i], &y[i]);
    int s, ans = 1;
    if((x[1] - x[0]) * (y[2] - y[0]) - (y[1] - y[0]) * (x[2] - x[0]) > 0) s = 1;
    else s = 0;
    for(i = 1; i < 4; ++i) {
      double tmp = (x[(i + 1) % 4] - x[i]) * (y[(i + 2) % 4] - y[i]) - (y[(i + 1) % 4] - y[i]) * (x[(i + 2) % 4] - x[i]);
      if((s && tmp < 0) || (!s && tmp > 0)) {
        ans = 0;
        break;
      }
    }
    if(ans) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}


Measured memory_bytes: 2632
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main(){
  int N;
  cin>>N;
  vector<ll> A(N);
  rep(i,N) cin>>A[i];

  ll ans=0;
  for(ll k=0;k<60;k++){
    ll num=0;
    for(int i=0;i<N;i++){
      if(A[i]&(1ll<<k)) num++;
    }

    ll coef=num*(N-num)%MOD;
    ll res=(1ll<<k)%MOD;
    res=res*coef%MOD;
    ans=(ans+res)%MOD;
  }
  cout<<(ans+MOD)%MOD<<endl;

  return 0;
}


Measured memory_bytes: 2560
#include <string>
#include <iostream>
using namespace std;
int main(){
	int n;
	cin >> n;
	int count = 0;
	if(n < 10){
		count = n;
	}else if(n < 100){
		count = 9;
	}else if(n < 1000){
		count = 9 + n - 99;
	}else if(n < 10000){
		count = 909;
	}else if(n < 100000){
		count = 909 + n - 9999;
	}else{
		count = 90909;
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
def is_collided(x: int, y: int, xn: list, ym: list) -> bool:
    xn_max = max(xn)
    ym_min = min(ym)

    if xn_max >= ym_min:
        return True
    # xn_max ~ ym_minとx ~ yが重なっていなければ衝突する
    return xn_max >= y or ym_min <= x

def main():
    line1 = list( map(lambda x:int(x), input().split(' ')) )
    line2 = list( map(lambda x:int(x), input().split(' ')) )
    line3 = list( map(lambda x:int(x), input().split(' ')) )
    print("War") if is_collided(line1[2], line1[3], line2, line3) else  print("No War")

if __name__=='__main__':
    main()

Measured memory_bytes: 3064
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int N = 20;

//head

int n;
int a[N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  rep(i, n) cin >> a[i];
  int cnt = 0;
  for(int i = 1; i < n-1; i++) {
    int u[] = {a[i-1], a[i], a[i+1]};
    sort(u, u+3);
    if(a[i] == u[1]) cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>

using namespace std;

void solve(int N, int M, int X, int Y, vector<int> x, vector<int> y) {
  int xmax = *max_element(x.begin(), x.end());
  int ymin = *min_element(y.begin(), y.end());
  xmax = max(xmax, X);
  ymin = min(ymin, Y);
  if (xmax < ymin) {
    printf("No War\n");
  } else {
    printf("War\n");
  }
}

int main() {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  vector<int> x(N);
  vector<int> y(M);

  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  for (int i = 0; i < M; i++) {
    cin >> y[i];
  }
  solve(N, M, X, Y, x, y);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define All(v) (v).begin(),(v).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
ll A(ll a, ll b){return (a + b - 1) / b;}
ll B(ll a, ll b){return a / b;}
int main(){
    ll a, b, x;
    cin >> a >> b >> x;
    cout << B(b, x) - A(a, x) + 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mod (long long)(1e9+7)
#define endl "\n"
using namespace std;


void solve(){
	string s;
	cin>>s;
	ll n=s.length();
	ll ans=0;
	for(ll i=0;i<n;i++){
		ans=(ans+(s[i]-'0'))%9;
	}
	if(ans==0){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}


int main(){
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}


Measured memory_bytes: 3708
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x= scan.nextInt();
		int y= scan.nextInt();
		int z= scan.nextInt();
		scan.close();
		x-=z*2;
		int cnt=0;
		while(true) {
			if(x-(y+z)>=0) {
				x-=(y+z);
				cnt++;
			}else {
				if(x-y>=0)cnt++;
				break;
			}
		}
		System.out.println(cnt);
	}

}

Measured memory_bytes: 22100
#include<iostream>
using namespace std;
int main(void)
{
	int n;
	cin >> n;
	for(int i=0;i*7<=n;i++)
	{
		int v=n-i*7;
		if(v%4==0){cout << "Yes" << endl;return 0;}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256