akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cstring>

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

using namespace std;

int a[8] = {0,1,2,3,5,7,8,9};
string ans;

void func(int n)
{
	if(n >= 8)
	{
		func(n/8);
	}

	stringstream ss;
	ss << a[n%8];
	ans += ss.str();
}

int main()
{
	string s;
	while(cin >> s)
	{
		if(s == "0") break;

		ans = "";
		func(atoi(s.c_str()));

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

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

int main() {
  string s;
  cin >> s;
  bool a = 0, b = 0;
  for(int i = 0; i < s.size(); i++){
    if(s.at(i) == 'C')
      a = 1;
    if(a){
      if(s.at(i) == 'F')
        b = 1;
    }
  }
  if(a && b)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

signed main()
{
    int N; cin>>N;
    vector<int> sum(N+1);
    for(int i=0;i<N;i++){
        int a; cin>>a;
        sum[i+1]=sum[i]+a;
    }
    
    int ans=1e9;
    for(int i=1;i<=N-1;i++){
        ans=min(ans,abs(2*sum[i]-sum[N]));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(a>=b+1)
		printf("%d",2*a-1);
	else if(a==b)
		printf("%d",2*a);
	else if(a+1<=b)
		printf("%d",2*b-1);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	long long int A[3];
	for (int i = 0; i < 3; i++)
		cin >> A[i];
	sort(A, A + 3);
	if (A[2] % 2 == 0)
		cout << 0 << endl;
	else cout << A[0] * A[1] << endl;
}

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int ret=700;
	char ch;
	while(cin>>ch)
		if(ch=='o')
			ret+=100;
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define int long long int

using namespace std;
typedef pair<int, int> PII;
typedef pair<PII, int> PPI;
typedef pair<int, PII> PIP;
typedef pair<PII, PII> PPP;
typedef vector<PII> VP;
typedef VP::iterator VPI;
typedef vector<int> VI;
const int INF = 3e18;

int n, t;
int a[100010];
int rieki[100010];
int ans = INF;

signed main()
{
  cin >> n >> t;
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }

  {
    int mn = a[0], mx_rieki = 0;
    for(int i = 1; i < n; i++){
      rieki[i] = (a[i] - mn) * t / 2;
      mx_rieki = max(mx_rieki, rieki[i]);
      mn = min(mn, a[i]);
    }
    
    int mx_num = 0;
    for(int i = 0; i < n; i++){
      if(mx_rieki == rieki[i]){
	mx_num++;
      }
    }

    ans = min(ans, mx_num);
  }
  
  memset(rieki, 0, sizeof rieki);
  reverse(a, a + n);
  for(int i = 0; i < n; i++){
    a[i] = -a[i];
  }

  {
    int mn = a[0], mx_rieki = 0;
    for(int i = 1; i < n; i++){
      rieki[i] = (a[i] - mn) * t / 2;
      mx_rieki = max(mx_rieki, rieki[i]);
      mn = min(mn, a[i]);
    }
    
    int mx_num = 0;
    for(int i = 0; i < n; i++){
      if(mx_rieki == rieki[i]){
	mx_num++;
      }
    }

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


Measured memory_bytes: 1792
#include <stdio.h>

static int ink[10][10];

int drop(int x, int y)
{
  if ((0 <= x) && (x <= 9) && (0 <= y) && (y <= 9)) {
    ++ink[x][y];
    return 1;
  } else {
    return 0;
  }
}

int white(void)
{
  int count = 0;
  int i,j;
  for (i=0; i<10; ++i) {
    for (j=0; j<10; ++j) {
      if (ink[i][j] == 0) {
        ++count;
      }
    }
  }
  return count;
}

int depth(void)
{
  int max = 0;
  int i,j;
  for (i=0; i<10; ++i) {
    for (j=0; j<10; ++j) {
      if (max < ink[i][j]) {
        max = ink[i][j];
      }
    }
  }
  return max;
}

int main(void)
{
  int i,j;
  for (i=0; i<10; ++i) {
    for (j=0; j<10; ++j) {
      ink[i][j] = 0;
    }
  }
  
  int x,y,size;
  while (scanf("%d,%d,%d", &x, &y, &size) != EOF) {
    drop(x,y);
    drop(x+1,y);
    drop(x,y+1);
    drop(x-1,y);
    drop(x,y-1);
    if (size > 1) {
      drop(x+1,y+1);
      drop(x-1,y+1);
      drop(x-1,y-1);
      drop(x+1,y-1);
    }
    if (size == 3) {
      drop(x+2,y);
      drop(x,y+2);
      drop(x-2,y);
      drop(x,y-2);
    }
  }

  printf("%d\n", white());
  printf("%d\n", depth());

  return 0;
}

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

public class Main {
    static long a[] = new long[100010];
    public static void main(String args[]){
        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt();
        int res = 0;
        boolean flag = false;
        long sum = 0;
        for(int i = 1; i <= n; i++) {
            a[i] = cin.nextLong();
            if(a[i] < 0) {
                res++;
                a[i] = -a[i];
            }
            if(a[i] == 0) flag = true;
            sum += a[i];
        }
        if(flag){
            System.out.println(sum);
            return;
        }
        Arrays.sort(a, 1, n + 1);
        if(res % 2 == 1){
            System.out.println(sum - 2 * a[1]);
        }
        else System.out.println(sum);
    }
}

Measured memory_bytes: 61712
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

//Code Short
#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define DSORT(n) sort(n.begin(),n.end())
#define QECHO(n) cout << n
#define QECHOS(n) cout << n << " "

//Define Math
const double EPS = 1e-10;
const double PI  = acos(-1.0);

using namespace std;
typedef long long ll;
/* prototype */
int EDSum(ll);//各桁の和
vector<int> SOE(int,int);//素数 (Min,Max)
int MinCM(int,int);//最小公倍数(num1,num2)
int MaxCD(int,int);//最大公約数(num1,num2)
vector<int> igets(int);//cin * N
ll nPr(ll,ll); //(n,r)
ll nE(ll); //(n)
ll nCr(ll,ll); //(n,r)

void solve(){
    //START
    int S;
    cin >> S;
    if(S%2==0){
      cout << (S/2)*(S/2) << endl;
    }else cout << (S/2)*((S/2)+1) << endl;
}

int main(void){cin.tie(0);ios::sync_with_stdio(false);solve();}
int EDSum(ll number) {
  int ans = 0;
  while (1) {
    ans += number % 10;
    number /= 10;
    if (number == 0) break;
  }
  return ans;
}

vector < int > SOE(int min, int max) {
  if (min < 2) min = 2;
  vector < int > int_array;
  for (int i = min; i <= max; i++) int_array.push_back(i);
  vector < int > sosu;
  double stop = sqrt(max);
  while (true) {
    sosu.push_back(int_array.front());
    int_array.erase(int_array.begin());
    if (stop < (double)(sosu.back())) break;
    for (int i = 0; i < (int) int_array.size(); i++) {
      if (int_array[i] % sosu.back() == 0)
        int_array.erase(int_array.begin() + i);
    }
  }
  sosu.insert(sosu.end(), int_array.begin(), int_array.end());
  return sosu;
}

int MinCM(int a, int b) {
  int c = a * b;
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return c / b;
}

int MaxCD(int a, int b) {
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
vector < int > igets(int N) {
  vector < int > A;
  int temp;
  for (int i = 0; i < N; ++i) {
    cin >> temp;
    A.push_back(temp);
  }
  return A;
}

ll nPr(ll n, ll r) {
  ll ans = 1;
  r = n - r;
  while (n != r) {
    ans *= n;
    --n;
  }
  return ans;
}

ll nE(ll n) {
  return nPr(n, n);
}

ll nCr(ll n, ll r) {
  if (r == 0) return -1;
  else {
    if (0 != n - r && n - r < r) r = n - r;
    return nPr(n, r) / nE(r);
  }
}

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

int main(){
  
ll m, n; cin>>m>>n;
char a[m][n];
ll dp[m][n];
ll i,j;
for(i=0;i<m;i++){
    for(j=0;j<n;j++){
        cin>>a[i][j];
    }
}
if(a[0][0]=='#') dp[0][0]=0;
else dp[0][0]=1;
for(i=1;i<n;i++){
    if(a[0][i]=='.')
    dp[0][i]=dp[0][i-1];
    else
    {
        dp[0][i]=0;
    }
    
}
for(j=1;j<m;j++){
    if(a[j][0]=='.'){
        dp[j][0]=dp[j-1][0];
    }
    else{
        dp[j][0]=0;
    }
}
for(i=1;i<m;i++){
    for(j=1;j<n;j++){
        if(a[i][j]=='#'){
            dp[i][j]=0;
        }
        else{
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
        }
    }
}
cout<<dp[m-1][n-1]%1000000007<<endl;

    return 0;
}

Measured memory_bytes: 9088
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scanner = new Scanner(System.in);

		int N = scanner.nextInt();
		long ans = 0;

		for (int i = 1; i <= N; i++) {

			//3の倍数でもあり5の倍数でもある場合
			if (i % 3 == 0 && i % 5 == 0) {
			
			}

			//3の倍数の場合
			else if (i % 3 == 0) {
				
			}
			//5の倍数の場合
			else if (i % 5 == 0) {
				
			//3と5の倍数以外の場合
			} else {
				
				ans += i;

			}

		}
		System.out.println(ans);

		scanner.close();
	}
}


Measured memory_bytes: 27104
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n; cin >> n;
    map<ll, ll> ma;
    ll ans = 0;
    rep(i,n) {
        int a; cin >> a;
        ans += a;
        ma[a]++;
    }
    int q; cin >> q;
    rep(i,q){
        int b, c; cin >> b >> c;
        if(!ma.count(b)) {
            cout << ans << endl;
            continue;
        }
        ans -= b * ma[b];
        ans += c * ma[b];
        ma[c] += ma[b];
        ma[b] = 0;
        cout << ans << endl;
    }
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int N; cin >> N;
  vector<int> vs(N);
  rep(i, N) {
    cin >> vs[i];
  }

  int max = -1;
  rep(i, N) {
    REP(j, i + 1, N) {
      int val = vs[i] * vs[j];
      auto K = to_string(val);
      bool ok = 1;
      REP(k, 1, K.size()) {
        if(K[k] != K[k-1] + 1) ok = 0;
      }
      if(ok)
        max = std::max(max, vs[i] * vs[j]);
    }
  }

  cout << max << endl;
  
  return 0;
}

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

int main() {
    int w, h, n;
    cin >> w >> h >> n;
    int min_x, max_x, min_y, max_y;
    min_x = 0; max_x = w; min_y = 0; max_y = h;
    rep(i, n){
        int x, y, a;
        cin >> x >> y >> a;
        if(a==1){
            chmax(min_x, x);
        }else if(a==2){
            chmin(max_x, x);
        }else if(a==3){
            chmax(min_y, y);
        }else if(a==4){
            chmin(max_y, y);
        }
    }
    int hh = max(max_y - min_y, 0);
    int ww = max(max_x - min_x, 0);
    int ans = hh * ww;
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N, A, b;
  cin >> N >> A;
  b = 1;
  for (int i = 0; i < N; i++) {
    if (b * 2 > b + A) {
      b = b + A;
    }
    else {
      b = b * 2;
    }
  }
  cout << b << endl;
      
}


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

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;


#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define rrep(i,n) RREP(i,0,n)
#define pb push_back
bool range(ll W, ll H, ll x, ll y) { return x >= 0 && x < W && y >= 0 && y < H; }
const ll dx[8] = { -1,-1,-1,0,0,1,1,1 }, dy[8] = { -1,0,1,-1,1,-1,0,1 };



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

	int H, W;
	cin >> H >> W;
	string S[50];
	rep(h, H)cin >> S[h];

	rep(h, H) {
		rep(w, W) {
			if (S[h][w] == '#')cout << "#";
			else {
				int cnt = 0;
				rep(d, 8) {
					int x = w + dx[d], y = h + dy[d];
					if (range(W, H, x, y)) {
						if (S[y][x] == '#')cnt++;
					}
				}
				cout << cnt;
			}
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 256
/* 
 * Project: AtCoder Beginners Contest 086 A - Round Up the Mean
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/01
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cmath>
using namespace std;

int a, b;

void solve() {

    int average = (a + b + 1) >> 1;
    printf("%d\n", average);

}

int main() {

    scanf("%d", &a);
    scanf("%d", &b);

    solve();

}

Measured memory_bytes: 504
#include<stdio.h>
int main()
{
    int a,b,c,r;
    scanf("%d%d%d",&a,&b,&c);
    if(a>=1&&a<=100&&b>=1&&b<=100&&c>=0&&c<=100)
    {
        r=(c-(a-b));
        if(r<0)
            printf("0\n");
        else
            printf("%d\n",r);
    }
    return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int n, count;
    boolean[] p;

    void run(){
	count = 0;
	p = new boolean[100000000];
	setP();
	while(sc.hasNext()){
	    n = sc.nextInt();
	    if(p[n]) {
		count++;
	     	p[n] = false;
	    }
	}
	System.out.println(count);
    }  

    void setP(){
	Arrays.fill(p, true);
	p[0] = p[1] = false;
	for(int i=2; i<p.length; i++)
	    if(p[i])
		for(int j=i*2; j<p.length; j+=i)
		    p[j] = false;
    }
}

Measured memory_bytes: 131376
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = (int)1e9 + 7;

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

    int n, k;
    cin >> n >> k;

    vector<LL> x(n), y(n);
    REP(i, n) cin >> x[i] >> y[i];

    LL ans = INFL;
    REP(i, n){
        REP(j, n){
            REP(l, n){
                REP(m, n){
                    if(i == j) continue;
                    if(l == m) continue;

                    LL top = max(y[i], y[j]), bot = min(y[i], y[j]),
                       right = max(x[l], x[m]), left = min(x[l], x[m]);

                    int cnt = 0;
                    REP(c, n){
                        if(y[c] <= top && y[c] >= bot && x[c] >= left && x[c] <= right) cnt++;
                    }
                    if(cnt >= k){
                        ans = min(ans, (top - bot) * (right - left));
                    }
                }
            }
        }
    }
    cout << ans << endl;

}

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

int main() {
  int N, K;
  cin >> N >> K;
  
  int num = 1;
  
  rep(i, N){
    if(num>K){
      num += K;
    }
    else{
      num *= 2;
    }
  }
  
  cout << num;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <utility>
#include <stack>
#include <numeric>
#include <random>
#include <algorithm>
#include <queue>
#include <functional>
#include <iterator>
#include <list>
#include <unordered_map>
#include <deque>
#include <math.h>
#include <tgmath.h>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define rep(i, b, e) for(i = b; i < e; ++i)
#define repr(i, b, e) for (i = b; i >= e; --i)
#define ull unsigned long long int
#define ll long long int
#define pint pair<int, int>

#define M_DEBUG 1
#define PI 3.141592653589793

#define E '\n'

#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << "\n";}
#define INF (1e18)

const ll MAX = 1000000000;
const ll MOD = 1e9 + 7;

ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;

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

ll aabs(ll a) {
    if (a < 0) return -a;
    return a;
}

//fast power
ll calc(ll a, ll b) {
    if (b == 0) return 1;
    else if (b % 2 == 0) {
        ll d = calc(a, b / 2);
        return (d * d) % MOD;
    }
    else return (a * calc(a, b - 1)) % MOD;
}

//fast combination
ll comb(ll n, ll a) {
    ll b = 1, c = 1;
    for (ll i = 1; i <= a; ++i) {
        b = b * i % MOD;
        c = c * (n - i + 1) % MOD;
    }

    return c * calc(b, MOD - 2) % MOD;
}

ll comb2(ll a) {
    ll b = a / 2;
    if (a % 2) {
        b = (a - 1) / 2;
        return (b * a);
    }
    return (b * (a - 1));
}

int dfs(int x, int y, int z) {
    if (x == a && y == b && z == c) return 1;
    
    int ans = 0;
    if (x != a) ans += dfs(x + 1, y, z);
    if (x >= y + 1/* && y != b*/) ans += dfs(x, y + 1, z);
    if (y >= z + 1/* && z != c*/) ans += dfs(x, y, z + 1); 

    return ans;
}

uint64_t gcd_impl( uint64_t n, uint64_t m ) {
        for( int i = 0; i < 10; ++i ) {
                uint64_t t = n - m;
                bool q = m > t;
                n = q ? m : t;
                m = q ? t : m;
                if( m == 0 ) { return n; }
        }
        return gcd_impl( m, n % m );
}

uint64_t gcd( uint64_t n, uint64_t m ) {
        return n > m ? gcd_impl( n, m ) : gcd_impl( m, n );
}

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;

    cout << setprecision(10) << (double)2 * (double)n * PI << endl;

    return 0;
}



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

using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
#define rep(pos, len) for(int pos=0;pos<len;pos++)
#define repp(pos, len) for(int pos=1;pos<=len;pos++)
 
#define INF 1987654321
#define IINF 87654321987654321
#define MOD 1000000007

struct Edge {
	int to, color, id;
};

const int MAXN = 1e5 + 50;
vector<Edge> adj[MAXN];
int n;

void readInput() {
	scanf("%d", &n);
	for(int i = 0; i < n-1; i++) {
		int u, v; scanf("%d%d", &u, &v);
		adj[u].push_back({v, 0, i});
		adj[v].push_back({u, 0, i});
	}
}

int res[MAXN];
void dfs(int v, int p, int pcolor) {
	int nxt_color = 1;
	for(auto &c : adj[v]) if(c.to != p) {
		if(nxt_color == pcolor)
			nxt_color++;
		c.color = nxt_color++;
		res[c.id] = c.color;
		dfs(c.to, v, c.color);
	}
}

int main() {
	readInput();
	int k = 0;
	for(int v = 1; v <= n; v++)
		k = max((int)adj[v].size(), k);
	dfs(1, -1, -1);
	printf("%d\n", k);
	for(int i = 0; i < n-1; i++)
		printf("%d\n", res[i]);
}


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

int main()
{
    int n;
    cin >> n;
    if(n%10 == 9 || n/10 == 9){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;

int main ()
{
    int n;
    string str;
    set <string> s;

    scanf("%d", &n);
    getchar();
    while (n--) {
        cin >> str;
        s.insert(str);
    }
    printf("%d\n", s.size());

    return 0;
}


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


int main(void){
  int N;
  cin >> N ;
  int cnt = 0;
  int M = N;
  while(M != 0){
      if(M > 0){
        if(M%2==0){
          M = -1*(M/2);
        }else{
          M = -1*(M/2);
        }
      }else if(M < 0){       
        if(((-1)*M)%2 == 0){
          M = ((-1)*M)/2;
        }else{
          M = ((-1)*M +1)/2;
        }
      }
      cnt++;
    }
  
  vector<int> vec(cnt);
  int i = 0;

  if(N == 0){
    cout << 0 << endl;
  }else{
    while(N != 0){
      if(N > 0){
        if(N%2==0){
          vec.at(i) = 0;
          N = -1*(N/2);
        }else{
          vec.at(i) = 1;
          N = -1*(N/2);
        }
      }else if(N < 0){
        
        if(((-1)*N)%2 == 0){
          vec.at(i) = 0;
          N = ((-1)*N)/2;
        }else{
          vec.at(i) = 1;
          N = ((-1)*N +1)/2;
        }
      }
      i++;
    }
    for(int k = i-1;k >= 0;k--){
      cout << vec.at(k);
    }
  }
}

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

using namespace std;

int main(){
    
    int n;
    cin>>n;
    bool ans=false;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(i*j==n) ans=true;
        }
    }
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB(x) push_back(x)
#define MP make_pair
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<'Y'<<'e'<<'s'<<endl
#define coutn cout<<'N'<<'o'<<endl
#define coutY cout<<'Y'<<'E'<<'S'<<endl
#define coutN cout<<'N'<<'O'<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;
//cout<<fixed<<setprecision(15)<<
#define ld long double

signed main(){
    ld a,b,x; cin >> a >> b >> x;
    x/=a;
    cout<<fixed<<setprecision(15);
    if(x<=a*b/2){
        cout<<atanl(b*b/x/2)*180/M_PI<<endl;
    }else{
        cout<<atanl(2*(a*b-x)/a/a)*180/M_PI<<endl;
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define F first
#define S second
#define pb push_back
mt19937 rnd;



int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    ll a, b, c;
    cin >> a >> b >> c;
    if (c - a - b <= 0) {
        cout << "No\n";
    }
    else if (4 * a * b < (c - a - b) * (c - a - b)) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }

#ifdef LOCAL
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    StringTokenizer stk = new StringTokenizer(in.readLine());
    int a[] = new int[n];
    boolean flg = true;
    for(int cnt = 0; cnt<n; cnt++){
      a[cnt] = Integer.parseInt(stk.nextToken());
      if(a[cnt]%2==0){
        if(a[cnt]%3!=0 && a[cnt]%5!=0)
          flg = false;
      }
    }
    if(flg == true)
      System.out.println("APPROVED");
    else
      System.out.println("DENIED");
  }
}

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

int main() {
	long long int n,d,count=0;
  cin>>n>>d;
  for(int i=0;i<n;i++){
    long long int c1,c2;
    cin>>c1>>c2;
    if(c1<0)c1=-c1;
    if(c2<0)c2=-c2;
    long double  dis=sqrt(c1*c1+c2*c2);
    //printf("dis is %llf\n",dis);
    if(dis<=d)count++;
  }
  printf("%d",count);
	return 0;
}

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

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt(), b = s.nextInt();
        int[] x = {a, a - 1, b, b - 1};
        Arrays.sort(x);
        System.out.println(x[2] +  x[3]);
    }
}


Measured memory_bytes: 21460
//Name: Frequency Distribution of Height
//Level: 1
//Category: やるだけ
//Note: 

/**
 */
#include <iostream>
#include <algorithm>

using namespace std;

bool solve(bool first) {
    int N;
    if(!(cin >> N)) return false;
    int cnt[6] = {0};

    for(int i = 0; i < N; ++i) {
        double d;
        cin >> d;
        d -= 165;
        if(d < 0) {
            cnt[0]++;
        } else {
            cnt[min(5, (int)d / 5 + 1)]++;
        }
    }
    for(int i = 0; i < 6; ++i) {
        cout << i+1 << ":";
        for(int j = 0; j < cnt[i]; ++j) {
            cout << "*";
        }
        cout << endl;
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    bool first = true;
    while(solve(first)) {
        first = false;
    }
    return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const int mod=1e9+7;         
const int N=1e6+4;

ll fac[N],infac[N];
 
ll me(ll a,ll b)
{
    ll res=1;
 
    if(b<0)
    return 0;
 
    while(b)
    {
        if(b&1)
        res=(res*a)%mod;
 
        b>>=1;
 
        a=(a*a)%mod;
    }
 
    return res;
}
 
ll mi(ll a)
{
    return me(a,mod-2);
}
 
void factorial()
{
   fac[0]=1;
 
   for(ll i=1;i<N;i++)
   fac[i]=(i*fac[i-1])%mod;
 
   infac[N-1]=mi(fac[N-1]);
 
   for(ll i=N-1;i>=1;i--)
   infac[i-1]=(i*infac[i])%mod;
}
 
ll ncr(ll n,ll r)
{
    if(n<r)
    return 0;
 
    ll val=fac[n];
 
    val=(val*infac[r])%mod;
 
    val=(val*infac[n-r])%mod;
 
    return val;
}
 
int main()
{	
	factorial();

	int n,m; scn(n); scn(m);

	ll ans=0,sign=1;

	rep(i,0,n+1)
	{
		ll here,val,temp;

		val=(ncr(m,i)*ncr(n,i))%mod; val=(val*fac[i])%mod;

		temp=(ncr(m-i,n-i)*fac[n-i])%mod; temp=(temp*temp)%mod;

		here=(val*temp)%mod; here*=sign;

		ans=(ans+here+mod)%mod;

		sign*=-1;
	}

	lpri(ans);

	return 0;
}                   

Measured memory_bytes: 19416
//BISMILLAHIR RAHMANIR RAHIM
                                          //By the name of ALLAH
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<iterator>
#include<numeric>
#define pi acos(-1.0)
using namespace std;
bool f(long long int x,long long int y)
{
    return x>y;
}
void solve()
{
    int t,a[105],i,j;
    cin>>t;
    for(int i=0;i<t;i++){
        cin>>a[i];
    }
    int ans=1000000;
    for(j=-100;j<=100;j++){
            int cost=0;
        for(i=0;i<t;i++){
            cost+=(a[i]-j)*(a[i]-j);
        }
     ans=min(ans,cost);
    }
    cout<<ans<<endl;

}
int main()
{
    solve();
    return 0;
}


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

int main() {
	int n, p;
	cin >> n >> p;
	long long _count[2] = {0, 0};
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		_count[x % 2]++;
	}
	if (_count[1] != 0) {
		cout << (1LL << (n - 1)) << endl;
	} else if (p == 0) {
		cout << (1LL << n) << endl;
	} else {
		cout << 0 << endl;
	}
	return 0;
}

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef long long ll;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define fi first
#define se second

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    ll a, b, n;
    cin >> a >> b >> n;

    ll x = min(n, b-1);
    cout << a * x / b << '\n';

    return 0;
}



Measured memory_bytes: 3616
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define FOR(i,a,n) for(i=(a);i<(n);i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
void fill(int a[],int b,int c){
	int i;
	FOR(i,0,b) a[i]=c;
	return;
}
ll dp[5001];
int main(void)
{
	int n,a,p,i;
	ll res=0;
	scanf("%d%d",&n,&p);
	dp[0]=1;
	while(n-->0){
		scanf("%d",&a);
		for(i=5000;i>=a;i--) dp[i]+=dp[i-a];
	}
	for(i=p;i<=5000;i+=2) res+=dp[i];
	printf("%lld\n",res); 
	return 0;
}    

Measured memory_bytes: 256
n = int(input())
xyhn = [None] * n
for i in range(n):
    xyhn[i] = list(map(int, input().split(' ')))

def calc_h(cx, cy, xyh):
    return xyh[2] + abs(cx - xyh[0]) + abs(cy - xyh[1])

base = -1
for i in range(n):
    if xyhn[i][2] != 0:
        base = i
        break

ans = None
for cx in range(0, 101):
    for cy in range(0, 101):
        result = True
        tmp_h = calc_h(cx, cy, xyhn[base])
        for k in range(n):
            if xyhn[k][2] > 0 and tmp_h != calc_h(cx, cy, xyhn[k]):
                result = False
                break
            if xyhn[k][2] == 0 and abs(cx - xyhn[k][0]) + abs(cy - xyhn[k][1]) < tmp_h:
                result = False
                break
        if result:
            ans = [cx, cy, calc_h(cx, cy, xyhn[base])]
            break

print(' '.join(map(str, list(ans))))



Measured memory_bytes: 46572
/*
      author : nishi5451
      created: 11.08.2020 01:18:06
*/

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


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

Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

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


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)



int main() {
	ll N;
	string S;
	std::cin >> N >> S;

	ll cnt_l = 0, cnt_r = 0;
	rep(i, 0, N) {
		if (S[i] == ')') {
			if (cnt_r > 0) {
				cnt_r--;
			}
			else {
				cnt_l++;
			}
		}
		else {
			cnt_r++;
		}
	}
	std::cout << std::string(cnt_l, '(') << S << std::string(cnt_r, ')') << endl;


	return 0;
}


Measured memory_bytes: 256
n=int(input())
a=[0]+list(map(int,input().split()))
from itertools import accumulate
a=accumulate(a)
a=list(a)
a.sort()
from collections import Counter
c=Counter(a)
ans=0
for k,v in c.items():
    if v>=2:
        ans+=v*(v-1)//2
print(ans)


Measured memory_bytes: 34452
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;

int main(void) {
    map<char, int> roman;
    //ローマ文字について情報をmapに入れておく
    roman.insert(make_pair('I', 1)); roman.insert(make_pair('V', 5));
    roman.insert(make_pair('X', 10)); roman.insert(make_pair('L', 50));
    roman.insert(make_pair('C', 100)); roman.insert(make_pair('D', 500));
    roman.insert(make_pair('M', 1000));
    string input;
    while(cin >> input) {
        int sum = roman[input[0]];
        for(int r = 1; r < input.length(); r++) {
            if(roman[input[r]] > roman[input[r - 1]]) sum += roman[input[r]] - 2*(roman[input[r - 1]]);
            else                                      sum += roman[input[r]];
        }
        cout << sum << endl;
    }
    return(0);
}

Measured memory_bytes: 1184
# -*- coding: utf-8 -*-


def main():
    n, m, q = map(int, input().split())
    summed = [[0 for _ in range(n + 1)] for _ in range(n + 1)]

    for _ in range(m):
        li, ri = map(int, input().split())
        summed[li][ri] += 1

    for i in range(1, n + 1):
        for j in range(1, n + 1):
            summed[i][j] += summed[i - 1][j]
            summed[i][j] += summed[i][j - 1]
            summed[i][j] -= summed[i - 1][j - 1]

    ans = list()

    for _ in range(q):
        pi, qi = map(int, input().split())
        count = summed[qi][qi] - summed[pi - 1][qi] - summed[qi][pi - 1] + summed[pi - 1][pi - 1]
        ans.append(count)

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 80008
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#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 complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n;
vector<vector<int>> g;
vector<int> col;

void dfs(int v, int p, int dep, vector<int>& d) {
    d[v] = dep;
    for(int nv: g[v]) {
        if(nv == p) continue;
        dfs(nv, v, dep + 1, d);
    }
}

void ddfs(int v, int p, int c) {
    for(int nv: g[v]) {
        if(nv == p) continue;
        if(col[nv] == -1) {
            col[nv] = c;
            ddfs(nv, v, c);
        }
    }
}

void solve() {
	cin >> n;
    g.assign(n, vector<int>());
    rep(i, n - 1) {
        int a, b; cin >> a >> b;
        -- a, -- b;
        g[a].pb(b);
        g[b].pb(a);
    }
    col.assign(n, -1);
    vector<int> d(n, -1);
    dfs(0, -1, 0, d);
    int di = d[n - 1];
    rep(i, n) {
        if(d[i] <= di / 2) {
            col[i] = 0;
        }
    }
    vector<int> e(n, -1);
    dfs(n - 1, -1, 0, e);
    rep(i, n) {
        if(e[i] <= (di - 1) / 2) {
            col[i] = 1;
        }
    }
    rep(i, n) {
        if(col[i] != -1) {
            ddfs(i, -1, col[i]);
        }
    }
    int cnt0 = 0;
    rep(i, n) {
        if(col[i] == 0) ++ cnt0;
    }
    if(n % 2 == 0) {
        if(cnt0 > n / 2) {
            cout << "Fennec" << endl;
        } else {
            cout << "Snuke" << endl;
        }
    } else {
        if(cnt0 >= (n + 1) / 2) {
            cout << "Fennec" << endl;
        } else {
            cout << "Snuke" << endl;
        }
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 16120
N = int(input())

pairs={}

for n in range(1, N+1):
  str_n = str(n)
  pair=str_n[0]+str_n[-1]
  if pair in pairs:
    pairs[pair]+=1
  else:
    pairs[pair]=1
ans = 0

for i in pairs.keys():
  if i[::-1] in pairs:
    ans+=pairs[i]*pairs[i[::-1]]

print(ans)

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

int main() {
  string num;
  cin >> num;
  char last_number = num[num.length() - 1];
  if (last_number == '2' || last_number == '4' || last_number == '5' || last_number == '7' || last_number == '9') {
    printf("hon");
    return 0;
  } else if (last_number == '0' || last_number == '1' || last_number == '6' || last_number == '8') {
    printf("pon");
    return 0;
  } else {
    printf("bon");
    return 0;
  }
}

Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
int main() {
	long long A[4], N;
	for (int i = 0; i < 4; i++) {
		cin >> A[i];
		if (i >= 1) {
			A[i] = min(A[i], A[i - 1] * 2);
		}
	}
  cin>>N;
  cout << A[3] * (N / 2) + A[2] * (N% 2) << endl;
		return 0;
}

Measured memory_bytes: 256
/// input macro from https://qiita.com/tanakh/items/1ba42c7ca36cd29d0ac8
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }
macro_rules ! rough_print {($ x : expr $ (, $ s : expr ) * ) => {print ! ("{:?}" , $ x ) ; $ (print ! (", {:?}" , $ s ) ; ) * println ! ("" ) ; } ; }

fn solve() {
    input!(n: usize, a: [u64; n]);
    let mut sum = 0;

    let mut tmp = 0;
    for i in 0..n {
        tmp += a[i];
    }
    tmp %= 1_000_000_000 + 7;

    for i in 0..(n - 1) {
        if a[i] > tmp {
            tmp = (tmp + 1_000_000_000 + 7) - a[i];
        }
        else {
            tmp -= a[i];
        }

        sum = (sum + tmp * a[i]) % (1_000_000_000 + 7);
    }

    rough_print!(sum);
}

fn main() {
    std::thread::Builder::new()
        .name("solve".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(solve)
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2704
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	private static Map<String, String> map = new HashMap<>();

	static {
		map.put("A", "T");
		map.put("T", "A");
		map.put("C", "G");
		map.put("G", "C");
	}

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.nextLine();
			System.out.println(map.get(s));
		}
	}
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define repl(i, a, b) for (ll i = a; i < (b); ++i)
#define repd(i, a, b) for (int i = b; i >= (a); --i)
#define repdl(i, a, b) for (ll i = b; i >= (a); --i)
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const ll MOD = 1'000'000'007LL;
ll bpow(ll b, ll p, ll m = 1000000007LL) {
  ll rt = 1;
  for (; p; p >>= 1, b = b * b % m)
    if (p & 1)
      rt = rt * b % m;
  return rt;
}
int main() {
  IOS;
  int d, s, t;
  cin >> d >> s >> t;
  if (d <= s * t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3632
S=input()
T=input()
U=list(S)
V=list(T)
dp=[0]*26
bp=[0]*26
for i in range(len(S)):
  dp[ord(U[i])-97]+=1
  bp[ord(V[i])-97]+=1
dp.sort()
bp.sort()
ans='Yes'
for i in range(len(dp)):
  if dp[i]!=bp[i]:
    ans='No'
    break
print(ans)

Measured memory_bytes: 12608
#include<bits/stdc++.h>
using namespace std;
#define lp(i, x, y) for(ll i = x ; i < y ; i++)
#define lp_rev(i, x, y) for(int i = x ; i >= y ; i--)
#define ff first
#define ss second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(v)  v.begin(), v.end()
#define vll vector<long long int>
#define vi vector<int>
#define Fasttt ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
typedef unsigned long long ull;
typedef long long ll;
#define endl "\n"
ll mod = 1000000007;

int main()
{
	Fasttt;
	int n;
	cin>> n;
	int dp[n][3];
	cin>> dp[0][0]>> dp[0][1]>> dp[0][2];
	lp(i, 1, n)
	{
		vi c(3);
		cin>> c[0]>> c[1]>> c[2];
		lp(j, 0, 3)
		{
			dp[i][j] = -1;
			lp(k, 0, 3)
				if(j != k)
					dp[i][j] = max(dp[i][j], dp[i - 1][k] + c[j]);
		}
	}
	int ans = max(dp[n - 1][0], dp[n - 1][1]);
	ans = max(ans, dp[n - 1][2]);
	cout<< ans;
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i=0,j=0,n;
    for(int t=0;t<3;t++)
    {
        cin>>n;
        if(n==5)
            i++;
        else if(n==7)
            j++;

    }
    if((i==2)&&(j==1))
        cout<<"YES"<<"\n";
    else
        cout<<"NO"<<"\n";

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;


int main() {
  ll n; cin >> n;
  vector<ll> factor;

  cout << n << ':';

  Rep(i, 2, sqrt(n)){
    while(n%i == 0){
      factor.push_back(i);
      n /= i;
    }
    if(n == 1) break;
  }
  if(n != 1) factor.push_back(n);

  rep(i, 0, factor.size()){
    cout << " " << factor[i];
  }
  cout << endl;


  return 0;
}



Measured memory_bytes: 3160
#include <stdio.h>
int main(){
  
  int i,j,N[100],loop,count=0,num,min;
  
  scanf("%d",&loop);
  
  for(i=0; i<loop; i++){
    scanf("%d",&N[i]);
  }
  
  for(i=0; i<loop-1; i++){
    
    min = i;
    
    for(j=i; j<loop; j++){
      
      if(N[j] < N[min]){
	min = j;
      }
    }
    if(min == i) count--;
    num = N[i];
    N[i] = N[min];
    N[min] = num;
    count++;
  }
  
  for(i=0; i<loop-1; i++){
    printf("%d ",N[i]);
  }
  printf("%d\n",N[i]);
  printf("%d\n",count);
  
  return 0;
}

Measured memory_bytes: 600
#include<iostream>
using namespace std;
int main()
{
	long long  n,k,num=0,num2=0;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		if(i%k==0)
		num++;
	}
	for(int i=0;i<=n-0.5*k;i++)
	{
		if(i%k==0)
		num2++;
	}
	if(k%2==1)
	{
		cout<<num*num*num<<endl; 
	}
	else
	{
		cout<<num2*num2*num2+num*num*num<<endl;
	}
}

Measured memory_bytes: 256
#include <stdio.h>
	int main (){
		
	int n; 	
	scanf("%d",&n);
		long long int arr[n], max=1e18, prod=1, flag=0, zero=0;
		
	for (int i =0;i<n;++i){
	
	scanf ("%lld", &arr[i]);
	 flag= (arr[i]> max)? 1:flag;
	 prod*=arr[i];	
	(arr[i]) ? max/=arr[i]:zero=1;	
		
	}
	(zero)? puts ("0"):((flag) ? puts("-1"): printf("%lld\n",prod));
	
	
	
	
	return 0;
	}

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

int main(){
    int k, a, b;
    cin >> k >> a >> b;
    int f = 0;

    for(int i = a; i <= b; i++){
        if(i%k == 0){
            f = 1;
            break;
        }
    }
    if(f == 1){
        cout << "OK" << endl;
    }
    else{
        cout << "NG" << endl;
    }
}

Measured memory_bytes: 3636
<?php
  $n = trim(fgets(STDIN));
  for($i=1; $i<=$n; $i++){
      $a[$i] = trim(fgets(STDIN));
  }
  $btn = [];
  $p = 1;
  $count = 0;
  while($p != 2){
      $p = $a[$p];
      if(!isset($btn[$p])){
          $btn[$p] = -1;
      }else{
          echo "-1";
          exit;
      }
      $count++;
  }
  echo $count;

Measured memory_bytes: 17140