akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main() {
	long long n,m,a,b=1;
	cin>>n>>m;
	a=min(n,m);
	for(int i=1;i<a+1;i++){
	    b*=i;
	    b%=1000000007;
	}
	if(n==m)b=(b*b*2)%1000000007;
	else if(n==a+1||m==a+1)b=(((b*a+b)%1000000007)*b)%1000000007;
	else b=0;
	cout<<b<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#define N 200010
using namespace std;
char str[N];
int f[N],p[N][26];
int main()
{
	scanf("%s",str);
	int n=strlen(str);
	for(int i=0;i<26;i++) p[n][i]=n;
	f[n]=1;
	for(int i=n-1;i>=0;i--)
	{
		for(int j=0;j<26;j++) p[i][j]=p[i+1][j];
		p[i][str[i]-'a']=i;
		f[i]=n+1;
		for(int j=0;j<26;j++) f[i]=min(f[i],f[p[i][j]+1]+1);
	}
	int m=f[0],u=0;
	while(m--)
	{
		for(int j=0;j<26;j++)if(f[p[u][j]+1]+1==f[u])
		{
			putchar('a'+j);
			u=p[u][j]+1;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 21504
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<string>
#include<set>
#include<cstdlib>

using namespace std;
typedef long long ll;

int main() {
  ll n;
  cin >> n;
  int a;
  char ac;
  string name;
  while(n!=0){
    a = n%26;
    if(a==0) ac = 'z';
    else ac = a+96;
    name = ac + name;
    //cout<<a<<" "<<ac<<endl;
    if(a==0) n = (n-26)/26;
    else n = (n-a)/26;
    //cout<<"n= "<<n<<endl;
    //if(a==0 && n==1) break;
  }

  cout<<name<<endl;
}

Measured memory_bytes: 3624
a = list(map(int,input().split()))
dis = [0]*a[0]

for i in range(1,a[0]):
    for j in range(i+1,a[0]+1):
        dis[min([ abs(j-i) -1 , abs(i-a[1]) + abs(j-a[2]) + 1 -1 ]) ] += 1

for i in range(a[0]-1):
    print(dis[i])

Measured memory_bytes: 3444
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // long long64_t, long long*_t
#include <cstdio> // prlong longf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack 
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
#include <list>
using namespace std;
int main(){
  long long n,k;
  long long MOD=1000000007,sum=0;
  cin >> n >> k;
  for(long long i=k; i<(n+2); i++){
      sum+=((n-i+1)*i+1);
      sum%=MOD;
  }
  cout << sum << endl;
}


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

int main(){
  while(1){
    int m, f, r;
    cin>>m>>f>>r;
    if(m == -1 && f == -1 && r == -1) break;

    if(m == -1 || f == -1){
      cout<<"F";
    } else if(m + f >= 80){
      cout<<"A";
    } else if(m + f >= 65){
      cout<<"B";
    } else if(m + f >= 50){
      cout<<"C";
    } else if(m + f >= 30){
      if(r >= 50) cout<<"C";
      else cout<<"D";
    } else {
      cout<<"F";
    }
    cout<<endl;
  }

  return 0;
}
   


Measured memory_bytes: 3092
H, W = map(int, input().split())
White = "."
Black = "#"

ans = []

for i in range(H):
    S = input()
    if(S.find(Black) == -1):
        H -= 1
    else:
        ans.append(list(S))

# print(ans)
i = 0
del_row = []
while(i < W):
    tmp = ""
    for j in range(H):
        tmp += ans[j][i]
    if(tmp.find(Black) == -1):
        del_row.append(i)

    i += 1

for i in reversed(del_row):
    for j in range(H):
        ans[j].pop(i)

for i in range(H):
    print("".join(ans[i]))

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;

int n,k,q[101]={},ans=0;
int main(){
	string c,s;
	cin >> n >> k;
	for(int i = 1; i <= n; i++){
		cin >> c;
		q[c[0]]++;
	}
	while(1){
		sort(begin(q),end(q),greater<int>());
		if(q[k-1]==0) break;
		for(int i = 0; i < k; i++){
			q[i]--;
		}
		ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define N 200000000
#define INF 2000000001
 
int size;
int heap[N];
 
void swap(int* a, int* b){
  int tmp = *a;
  *a = *b;
  *b = tmp;
}
 
void maxHeapify(i){
  int l = 2*i;
  int r = 2*i+1;
  int valM;
  if(l <= size && heap[l] > heap[i]) valM = l;
  else valM = i;
  if(r <= size && heap[r] > heap[valM]) valM = r;
  if(valM != i){
    swap(&heap[i], &heap[valM]);
    maxHeapify(valM);
  }
}
 
void heapIncreaseKey(int i, int key){
  if(key < heap[i]) return;
  heap[i] = key;
  while(i>1 && heap[i/2]<heap[i]){
    swap(&heap[i], &heap[i/2]);
    i = i/2;
  }
}
 
void maxHeapInsert(int key){
  size++;
  heap[size] = -INF;
  heapIncreaseKey(size, key);
}
 
int heapExtractMax(){
  int valM;
  if(size < 1) return 0;
  valM = heap[1];
  heap[1] = heap[size--];
  maxHeapify(1);
  return valM;
}
 
main(){
  char input[20];
  size = 0;
  while(scanf("%s", input)){
    if(!strcmp(input, "end")) break;
    if(!strcmp(input, "extract")) printf("%d\n", heapExtractMax());
    else{
      char val[20];
      scanf("%s", val);
      maxHeapInsert(atoi(val));
    }
  }
  return 0;
}


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

#define int int_fast64_t

signed main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);

  int h, w, k; cin >> h >> w >> k;
  vector<vector<int>> grid(h, vector<int>(w));
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      char c; cin >> c;
      grid[i][j] = c - '0';
    }
  }
  int mincuts = w*h;
  for (int cutmask = 0; cutmask < (1<<(h-1)); ++cutmask) {
    vector<int> rowof(h);
    int rowid = 0;
    int cuts = 0;
    for (int i = 0; i < h; ++i) {
      rowof[i] = rowid;
      if ((cutmask >> i)&1) {
        ++cuts;
        ++rowid;
      }
    }
    vector<int> rowsum(rowid+1);
    for (int x = 0; x < w; ++x) {
      for (int i = 0; i < h; ++i) {
        rowsum[rowof[i]] += grid[i][x];
      }
      if (*max_element(rowsum.begin(), rowsum.end()) > k) {
        ++cuts;
        fill(rowsum.begin(), rowsum.end(), 0);
        for (int i = 0; i < h; ++i) {
          rowsum[rowof[i]] += grid[i][x];
        }
      }
      if (*max_element(rowsum.begin(), rowsum.end()) > k) {
        cuts = w*h;
      }
    }
    mincuts = min(mincuts, cuts);
  }
  cout << mincuts << '\n';
}



Measured memory_bytes: 384
import itertools
import bisect

n, m, k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

cA = list(itertools.accumulate(A))
cB = list(itertools.accumulate(B))

#print(cA)
#print(cB)

ans = 0
for i in range(n):
    tmp = cA[-(i+1)]
    if tmp < k:
        indb = bisect.bisect_right(cB, k - tmp)
        #print(indb)
        ans = max(ans, (n-i)+indb)
    elif tmp == k:
        ans = n - i
    
indb = bisect.bisect_right(cB,k)
ans = max(ans, indb)
    
print(ans)

Measured memory_bytes: 129456
#include<bits/stdc++.h>
#define I64 "%I64d"
#define RAN(v)v.begin(),v.end()
#define pb push_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
typedef long long ll;
template<class T>
inline void upd1(T&a,T b){a>b?a=b:0;}
template<class T>
inline void upd2(T&a,T b){a<b?a=b:0;}
struct ano{
	operator ll(){
		ll x=0,y=0,c=getchar();
		while(c<48)
			y=c==45,c=getchar();
		while(c>47)
			x=x*10+c-48,c=getchar();
		return y?-x:x;
	}
}buf;
int main(){
	map<int,int>c;
	int n=buf;
	while(n--)++c[buf];
	int m=buf;
	while(m--)
		if(!c[buf]--)
			return!~puts("NO");
	puts("YES");
}

Measured memory_bytes: 11648
h,w=map(int,input().split())
d=[list(map(int,input().split())) for _ in range(10)]
e=[list(map(int,input().split())) for _ in range(h)]
def warshall_floyd(d,n):
    #d[i][j]=i番目の頂点からj番目の頂点までの最短距離
    for k in range(n+1):
        for i in range(n+1):
            for j in range(n+1):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d
d=warshall_floyd(d,9)
ans=0
for i in range(h):
    for j in range(w):
        if e[i][j]>=0:
            ans+=d[e[i][j]][1]
print(ans)

Measured memory_bytes: 3444
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main (String[] args){
        Scanner sc = new Scanner(System.in);
        int N =sc.nextInt();
        Map<String,Integer> map1 = new HashMap();
        for (int i=0;i<N;i++){
            String s = sc.next();
            if (!map1.containsKey(s)){
                map1.put(s,1);
            }else{
                int j =map1.get(s);
                j++;
                map1.put(s,j);
            }
        }
        int M = sc.nextInt();
        Map<String,Integer> map2 = new HashMap();
        for (int i=0;i<M;i++){
            String s = sc.next();
            if (!map2.containsKey(s)){
                map2.put(s,1);
            }else{
                int j =map2.get(s);
                j++;
                map2.put(s,j);
            }
        }
        int ans =0;
        Iterator it = map1.entrySet().iterator();
        while (it.hasNext()){
            Map.Entry entry =(Map.Entry)it.next();
            int count =(Integer)entry.getValue();
            if(map2.containsKey(entry.getKey())){
                count = count - map2.get(entry.getKey());
            }
            if (count >ans){
                ans =count;
            }
        }
        System.out.println(ans);


    }
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

class UnionFind{
public:
  vector<int> p;		// 親
  vector<int> rank;	// サイズ・各集合の根のみ有効
  UnionFind(int n){
    p.resize(n, -1);
    rank.resize(n, 1);
  }
  int root(int x){
    if(p[x] == -1)return x;
    else return p[x] = root(p[x]); // 深さを 1 にしている
  }
  void unite(int x, int y){
    x = root(x); y = root(y);
    if(x == y)return;
    if(rank[x] > rank[y]) swap(x, y); // rankの小さいものを下につける
    rank[y] += rank[x];
    p[x] = y;
  }
  //xが属すグループのサイズ
  int size(int x){ return rank[root(x)]; }
  bool same(int x, int y){ return (root(x) == root(y)); }
};

void solve()
{
	int n, m, x, y, z;
  cin >> n >> m;
  UnionFind uf(n);
  for(int i = 0; i < m; ++i)
  {
    cin >> x >> y >> z;
    x--; y--;
    uf.unite(x, y);
  }
  set<int> t;
  for(int i = 0; i < n; ++i)
  {
    t.insert(uf.root(i));
  }
  cout << t.size();
}

int main()
{
	fastio;
	solve();

	return 0;
}

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

#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()

using namespace std;

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

const int N = 1e5 + 5;
int n, m, vis[N];
vi a[N];

void dfs(int u) {
  vis[u] = 1;
  for (int v : a[u]) {
    if (!vis[v]) {
      dfs(v);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    a[v].push_back(u);
    a[u].push_back(v);
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      cnt++;
      dfs(i);
    }
  }
  cout << cnt - 1 << "\n";
}

Measured memory_bytes: 10008
#include<bits/stdc++.h>
#define int long long int
#define MP make_pair
#define PB push_back
#define F first
#define S second
using namespace std;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef vector<PII> VP;

const int INF = 3e18;

int n, m, d[1010], c[1010];
int dp[1010][1010];

signed main()
{
  cin >> n >> m;
  for(int i = 1; i <= n; i++){
    cin >> d[i];
  }
  for(int i = 1; i <= m; i++){
    cin >> c[i];
  }

  for(int i = 1; i <= n; i++){
    dp[0][i] = INF;
  }

  for(int i = 1; i <= m; i++){
    for(int j = 1; j <= n; j++){
      dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - 1] + c[i] * d[j]);
    }
  }

  cout << dp[m][n] << endl;
  
  return 0;
}

Measured memory_bytes: 10944
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <utility>
#include <map>
#include <set>
#include <algorithm>

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

using namespace std;

typedef long long ll;
typedef vector< int > vi;

int main() {
    unsigned long long  x, y;
    cin >> x >> y;

    if (x < y) {
        cout << x << "\n";
        return 0;
    }
    unsigned long long a = x;
    unsigned long long b = y;

    while(b != 0) {
        int temp = b;
        b = a % b;
        a = temp;
    }

    if (a == y) {
        cout << "-1" << "\n";
    } else if (a == 1) {
        cout << x << "\n";
    } else {
        unsigned long long c = x / a;
        cout << x * c << "\n";
    }

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <climits>
#include <math.h>

using namespace std;

double pos(double x);
double pos(int x);
double distance(int x[], int y[], int n, int p);


int main(void)
{
	int n, x[100], y[100];
	int i;

	cin >> n;
	for (i = 0; i < n; i++)
		cin >> x[i];
	for (i = 0; i < n; i++)
		cin >> y[i];

	cout << fixed << setprecision(6) << distance(x, y, n, 1) << endl;
	cout << distance(x, y, n, 2) << endl;
	cout << distance(x, y, n, 3) << endl;
	cout << distance(x, y, n, INT_MAX) << endl;
}

double pos(double x)
{
	if (x < 0)
		x = 0 - x;
	return x;
}

double pos(int x)
{
	if (x < 0)
		x = 0 - x;
	return x;
}

double distance(int x[], int y[], int n, int p)
{
	if (p != INT_MAX)
	{
		double D = 0;
		int i;
		for (i = 0; i < n; i++)
		{
			D += pow(pos(x[i] - y[i]), p);
		}

		D = pow(D, 1.0 / p);
		return D;
	}
	double max = 0;
	int i;

	for (i = 0; i < n; i++)
	{
		if (max < pos(x[i] - y[i]))
			max = pos(x[i] - y[i]);
	}
	return max;
}


Measured memory_bytes: 3492
#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 repr(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 ld long double
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
// const ll INF = 1LL << 30;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

void print(Vl vec){
    rep(i, 0, sz(vec)){
        if(i) cout << " ";
        cout << vec[i];
    }
    coel;
}

////////////////////////////////////////////////////////

int main() {
    char a; cin >> a;
    if(a >= 'A' && a <= 'Z') cout << 'A' << endl;
    else cout << 'a' << endl;

    return 0;
}


Measured memory_bytes: 3592
H, W = map(int, input().split())

field = []

for _ in range(H):
    field.append(input())

dp = [[0 for a in range(W)] for b in range(H)]
dp[0][0] = 1

# dp[h][w] = マス[1, 1]からマス[h, w]までの太郎くんの経路のそうパターン数。ans = dp[H-1][W-1]

for h in range(H):
    for w in range(W):
        if field[h][w] == '#': continue

        if h-1 >= 0 and field[h-1][w] == ".":
            dp[h][w] += dp[h-1][w]

        if w-1 >= 0 and field[h][w-1] == '.':
            dp[h][w] += dp[h][w-1]

        dp[h][w] %= 1000000007

print(dp[H-1][W-1])

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  cout<<"ABC";
  ll a; cin >> a;
  fin(a)
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

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

    ll sum = 0;
    ll res = 1;
    rep(i, N - 1) {
        sum += A[i];
        if (A[i + 1] <= sum * 2)
            res++;
        else
            res = 1;
    }

    cout << res << endl;
}

Measured memory_bytes: 1024
<?php
$input = trim(fgets(STDIN));
$num = substr($input, -1);

if($num == 3 ){
    echo "bon";
} elseif($num == 0 || $num == 1 || $num == 6 || $num == 8){
    echo "pon";
}else{
    echo "hon";
}
?>

Measured memory_bytes: 16228
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=998244353;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// xのn乗%modを計算
ll mod_pow(ll x, ll n, ll mod){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res*x%mod;
        x = x*x%mod;
        n >>= 1;
    }
    return res;
}

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    int N,S;
    cin>>N>>S;
    vector<ll> A(N);
    REP(i,N) cin>>A[i];
    vector<vector<ll>> dp(3010,vector<ll>(3010,0));
    
    REP(i,N){
      dp[i+1][A[i]]=mod_pow(2,i,MOD);
    }
    
    REP(i,N){
      REP(j,S+1){
        dp[i+1][j]+=(2*dp[i][j])%MOD;
        if(j-A[i]>=0){
          dp[i+1][j]+=dp[i][j-A[i]];
        }
        dp[i+1][j]%=MOD;
      }
    }
    cout<<dp[N][S]<<endl;
}

Measured memory_bytes: 74252
#include <stdio.h>
#include <math.h>
#include <cmath>
#include <iostream>

using namespace std;
 
int main(void){
    // int n,k;
    int n;
    scanf("%d", &n);
    // scanf("%d", &k);

    int h[n];
    int costs[n];

    for( int i = 0; i < n; ++i ){
        int height;
        scanf("%d", &height);
        h[i] = height;
    }
    for( int i = 0; i < n; ++i ){
        int j = n - i - 1;
        int c;
        if (i == 0) {
            c = 0;
        } else if (i == 1) {
            c = abs(h[j + 1] - h[j]);
        } else {
            c = min(abs(h[j + 1] - h[j]) + costs[j + 1], abs(h[j + 2] - h[j]) + costs[j + 2]);
        }
        costs[j] = c;
    }
    printf("%d", costs[0]);
    return 0;
}


Measured memory_bytes: 1024
from bisect import bisect_left

n = int(input())
a = list(map(int, input().split()))
a.sort()
total = [0] * n
total[0] = a[0]
for i in range(1, n):
    total[i] = a[i] + total[i - 1]
ans = 1
for i in range(n - 1, 0, -1):
    if a[i] <= total[i - 1] * 2:
        ans += 1
    else:
        break

print(ans)

Measured memory_bytes: 20344
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  set<string> s;
  rep(i,n){
    string ss;
    cin>>ss;
    s.insert(ss);
  }
  COUT(sz(s));
}

Measured memory_bytes: 19260
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;cin>>s;
	int n=s.size();
	int cnt=0,f[n]={0},g[n]={0};
	for(int i=0;i<n;i++){
		if(s[i]=='R')f[i]=++cnt;
		else cnt=0;
	}
	cnt=0;
	int ans[n]={0};
	for(int i=n-1;i>=0;i--){
		if(s[i]=='L')g[i]=++cnt;
		else cnt=0;
	}
	//for(int i=0;i<n;i++)cout<<f[i]<<" ";cout<<endl;
	//for(int i=0;i<n;i++)cout<<g[i]<<" ";cout<<endl;
	for(int i=0;i<n-1;i++){
		if(s[i]=='R'&&s[i+1]=='L'){
			int x=f[i]+g[i+1];
			int y=min(f[i],g[i+1]);
			if(x%2==0){
				ans[i]=x/2;
				ans[i+1]=x/2;
			}
			else{
				if(f[i]>g[i+1]&&y%2==0){
					ans[i]=x/2+1;
					ans[i+1]=x/2;
				}
				else if(f[i]>g[i+1]&&y%2==1){
					ans[i]=x/2;
					ans[i+1]=x/2+1;
				}
				else if(f[i]<g[i+1]&&y%2==0){
					ans[i]=x/2;
					ans[i+1]=x/2+1;
				}
				else if(f[i]<g[i+1]&&y%2==1){
					ans[i]=x/2+1;
					ans[i+1]=x/2;
				}				
			}
		}
	}
	for(int i=0;i<n;i++)cout<<ans[i]<<" ";
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
void fast()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
}
int main()
{
    fast();
    long long a,b,c;
    cin>>a>>b>>c;
    if(c-b-a<0)
        cout<<"No";
    else
    {
        if(4*a*b<(c-b-a)*(c-b-a))
            cout<<"Yes";
        else
            cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>

using namespace std;

bool IsIsolatedBlack(vector<string> &vs, int x, int y)
{
  if (vs[x][y] == '.') return false;
  
  int H = vs.size();
  int W = vs[0].size();
  vector<int> dx({-1,+1, 0, 0});
  vector<int> dy({ 0, 0,-1,+1});

  bool isolated = true;
  for (int i = 0; i < 4; ++i) {
    int xx = x + dx[i];
    int yy = y + dy[i];
    if (0 <= xx and xx < H and 0 <= yy and yy < W and
	vs[xx][yy] == '#') {
      isolated = false;
      break;
    }
  }
  
  return isolated;
}

int main()
{
  int H, W;
  cin >> H >> W;
  vector<string> vs;
  for (int i = 0; i < H; ++i) {
    string S;
    cin >> S;
    vs.push_back(S);
  }
  bool ok = true;
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      if (IsIsolatedBlack(vs, i, j)) {
	ok = false;
	break;
      }	
    }
  }
  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n,i,x;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		x=i;
		if(i%3==0){
			printf(" %d",i);
		}else if(i%10==3){
			printf(" %d",i);
		}else{
			for(x=i;x!=0;x/=10){
				
				if(x%10==3){
					printf(" %d",i);
					break;
				}
			}
		}
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2072
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	ar := make([]int, n)
	mi, pl := false, false
	for i := range ar {
		fmt.Scan(&ar[i])
		if ar[i] >= 0 {
			pl = true
		} else {
			mi = true
		}
	}
	sort.Ints(ar)
	if pl && mi {
		ans := 0
		for _, v := range ar {
			if v < 0 {
				ans -= v
			} else {
				ans += v
			}
		}
		fmt.Println(ans)
		plsum := ar[n-1]
		misum := ar[0]
		for i := 1; i < n-1; i++ {
			if ar[i] >= 0 {
				fmt.Println(misum, ar[i])
				misum -= ar[i]
			} else {
				fmt.Println(plsum, ar[i])
				plsum -= ar[i]
			}
		}
		fmt.Println(plsum, misum)
		return
	}
	if pl {
		ans := 0
		min := 999999
		for _, v := range ar {
			ans += v
			if v < min {
				min = v
			}
		}
		fmt.Println(ans - min*2)
		plsum := ar[n-1]
		misum := ar[0]
		for i := 1; i < n-1; i++ {
			fmt.Println(misum, ar[i])
			misum -= ar[i]
		}
		fmt.Println(plsum, misum)
		return
	}
	ans := 0
	min := 999999
	for _, v := range ar {
		ans -= v
		aa := -v
		if aa < min {
			min = aa
		}
	}
	fmt.Println(ans - min*2)
	misum := ar[n-1]
	for i := 0; i < n-1; i++ {
		fmt.Println(misum, ar[i])
		misum -= ar[i]
	}
	return
}


Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
int main(void){
  string s,t;cin>>s>>t;
  int cnt,min=1000;
  int size1=s.size(),size2=t.size();
  for(int i=0; i<(size1-size2+1); ++i){
    cnt=size2;
    for(int j=0; j<size2; ++j) if(s[i+j]==t[j]) --cnt;
    if(min>cnt) min=cnt;
  }
  cout<<min<<endl;
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	ll k,a,b;
	cin >> k >> a >> b;
	if((b-a)%2==0) {
		cout << min((b-a)/2,min(b-1,k-a)) << endl;
		return 0;
	}
	if(a==1||b==k) {
		cout << (b-a+1)/2 << endl;
		return 0;
	}
	ll n = a-1;
	ll m = k-b;
	cout << min(n,m)+1+((b-a-1)/2) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int (i) = 0; i < (n); i++)
#define REP(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define INF LLONG_MAX - 10
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a*b/gcd(a,b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};



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

 	int x, y;
    cin >> x >> y;
    cout << x + y - (gcd(x, y) - 1) << endl;
}



Measured memory_bytes: 3216
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int H=stdIn.nextInt();
		int W=stdIn.nextInt();
		int z=0,y=0;
		z=N-H;
		y=N-W;
		z++;y++;
		System.out.println(z*y);
	}
}

Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

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

    long double a,b;
    cin>>a>>b;
    a = a * b;
    cout<<(ll)a<<endl;


    return 0;
}


Measured memory_bytes: 3748
# B問題

# input parameters
n, m, x, y = map(int, input().split())
xlist = list(map(int, input().split()))
ylist = list(map(int, input().split()))

#compare integers
a = 0
if x < y:
    if max(xlist) < min(ylist):
        if (max(xlist) < y) and (x < min(ylist)):
            print('No War')
        else:
            print('War')
    else:
        print('War')
else:
    print('War')

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

using namespace std;

int main(void){
  string s;
  cin >> s;
  cin >> s;

  int c = 0;
  for (int i = 0; i < s.size() - 2; i++){
    if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
      c++;
  }
  cout << c << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define pb push_back
#define mp make_pair
#define ii pair<int,int>
#define vi vector<int>
#define iii pair<int,pair<int,int>>
#define INF 1<<30

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,m,v,c;
	cin>>n>>m>>v>>c;
	cout<<min(n,m)+min(v,c);
}

Measured memory_bytes: 892
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
#define P pair<int,int>
//printf("%.12Lf\n",);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int max(int a,int b){
	if(a>=b)return a;
	else return b;
}
int min(int a,int b){
	if(a>=b)return b;
	else return a;
}	
int n2[41];		
int nis[41]; 
int nia[41];
int mody[41];
int nn;
int com(int n,int y){
	int ni=1;
	for(int i=0;i<41;i++){
		n2[i]=ni;
		ni*=2;
	}
	int bunsi=1,bunbo=1;
	rep(0,i,y)bunsi=(bunsi*(n-i))%mod;
	rep(0,i,y)bunbo=(bunbo*(i+1))%mod;
	mody[0]=bunbo;
	rep(1,i,41){
		bunbo=(bunbo*bunbo)%mod;
		mody[i]=bunbo;
	}
	rep(0,i,41)nis[i]=0;
	nn=mod-2;
	for(int i=40;i>=0;i-=1){
		if(nn>n2[i]){
			nis[i]++;
			nn-=n2[i];
		}
	}
	nis[0]++;
	rep(0,i,41){
		if(nis[i]==1){
			bunsi=(bunsi*mody[i])%mod;
		}
	}
	return bunsi;
}
int yakuwa(int n){
	int sum=0;
	rep(1,i,sqrt(n+1)){
		if(n%i==0)sum+=i+n/i;
		if(i*i==n)sum-=i;
	}
	return sum;
}	
bool hei(int n){
	rep(0,i,100){
		if(i*i==n){
			return true;
		}
	}
	return false;
}
int pow(int b,int a){	
	int aa=1;
	rep(0,i,a)aa*=b;	
	return aa;
}
int sankaku(int a){
	return a*(a+1)/2;
}
signed main(){
	double n;
	cin>>n;
	double ans=(n*n*n)/27;
	printf("%.12f\n",ans);
}	

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

bool is_sum (vector<int> s, int n){
    if(s.size() == 1) {
        if(s.at(0) == n) return true;
        else return false;
    }
    else{
        int a = s.at(s.size()-1);
        s.pop_back();
        if(is_sum(s,n+a) || is_sum(s,n-a)) return true;
        else return false;
    }

}

vector<string> cal_sum (vector<int> s, int n){
    if(s.size() == 1) return {};
    else{
        int a = s.at(s.size()-1);
        s.pop_back();
        if(is_sum(s,n-a)){
            vector<string> v = cal_sum(s,n-a);
            v.push_back("+");
            return v;
        }
        if(is_sum(s,n+a)){
            vector<string> v = cal_sum(s,n+a);
            v.push_back("-");
            return v;
        }
    }
}

int main(){
    string s ;
    cin >> s;
    vector<int> v(s.size());
    for (int i = 0; i < s.size(); i++)
    {
        v.at(i)  = s.at(i) -48;
    }

    vector<string> sign = cal_sum(v,7);
    cout << s.at(0);
    for (int i = 1; i < 4; i++)
    {
        cout << sign.at(i-1) << v.at(i) ;
    }
    cout << "=7" << endl;
    
}

Measured memory_bytes: 3588
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define pi pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912

const long double PI = acos(-1);
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int GCD(int x,int y){
    return y ? GCD(y,x%y) : x;
}
int N,h[22];
int main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> h[i];
    }
    int mx = h[0];
    int ans = 1;
    for(int i = 1; i < N; i++){
        if(h[i] >= mx){
            ans++;
            mx = h[i];
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>
 
 
int main()
{
    long long int n, k; std::cin >> n >> k;
    long long int ans = 0;
    std::vector<int> h(n);
    for(long long int i=0; i<n; i++) std::cin >> h[i];
    std::sort(h.begin(), h.end(), std::greater<long long int>());

    for(long long int i=0; i<n; i++)
    {
        if(i<k) h[i] = 0;
        ans += h[i];
    }
    
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 1024
from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    #根を返す
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]


n,k,l = inpl()
ro = UnionFind(n)
tr = UnionFind(n)
for i in range(k):
    a,b = inpl()
    ro.union(a-1,b-1)
for i in range(l):
    a,b = inpl()
    tr.union(a-1,b-1)

d = defaultdict(int)
for i in range(n):
    d[(ro.find(i),tr.find(i))] += 1
for i in range(n):
    print(d[(ro.find(i),tr.find(i))])


Measured memory_bytes: 108248
#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 P pair<ll, ll>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 




////////////////////////////////////////////////////////

ll parent[200005];

int main() {
    ll n, m; cin >> n >> m;
    vector<Vl> li(n+1);
    Rep(i, 0, n) parent[i] = -1;
    parent[1] = 0;
    rep(i, 0, m){
        ll a, b; cin >> a >> b;
        li[a].push_back(b);
        li[b].push_back(a);
    }
    queue<ll> qu;
    qu.push(1);
    while(!qu.empty()){
        ll u = qu.front(); qu.pop();
        rep(i, 0, li[u].size()){
            ll v = li[u][i];
            if(parent[v] != -1) continue;
            parent[v] = u;
            qu.push(v);
        }
    }
    Rep(i, 2, n){
        if(parent[i] == -1){
            co("No");
            return 0;
        }
    }
    co("Yes");
    Rep(i, 2, n) co(parent[i]);

    return 0;
}


Measured memory_bytes: 12888
#include<bits/stdc++.h>
using namespace std;
double dp[301][301][301];

int main()
{
   int n;
   cin>>n;
   vector<int>arr(n);
   for(int i=0;i<n;i++)
   {
       cin>>arr[i];
   }

   int a,b,c;
   a=b=c=0;
   for(int i=0;i<n;i++)
   {
       if(arr[i]==1)
            a++;
       if(arr[i]==2)
            b++;
       if(arr[i]==3)
            c++;
   }
    for(int k=0;k<=c;k++)
    {
        for(int j=0;j<=n-k;j++)
        {
            for(int i=0;i<=n-k-j;i++)
            {
                if(i==0 && j==0 && k==0)
                {
                    continue;
                }
                dp[i][j][k]+=n;
                if(i!=0)
                {
                    dp[i][j][k]+=i*dp[i-1][j][k];
                }
                if(j!=0)
                {
                    dp[i][j][k]+=j*dp[i+1][j-1][k];
                }
                if(k!=0)
                {
                    dp[i][j][k]+=k*dp[i][j+1][k-1];
                }
                dp[i][j][k]/=(i+j+k);
            }
        }
    }
    cout.precision(17);
    cout<<dp[a][b][c]<<endl;
return 0;
}


Measured memory_bytes: 213248
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int a,b;
	cin >> a >> b;
	cout << a * b << endl;
	return 0;
}

Measured memory_bytes: 3604
n = int(input())
S = []
check = True
ans = []

for i in range(n):
    data = [x for x in input()]
    data.sort()
    S.append(data)

S.sort(key=len)

for char in S[0]:
    for i in range(1, len(S)):
        if (char in S[i]):
            S[i].remove(char)
        else:
            check = False
    if (check):
        ans.append(char)
    check = True

print(''.join(ans))







Measured memory_bytes: 3064
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> triple;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define f1(i,n)     for(ll i=1;i<=n;i++)
#define fs(i,s)     for(ll i=0;i+1<=s.length();i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define popb()      pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)       cout<<a<<endl
#define pr2(a,b)    cout<<a<<" "<<b<<endl
#define rpr(a)      return cout<<a<<endl,0
#define prY         cout<<"YES"<<endl
#define prN         cout<<"NO"<<endl
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define ast(x,a,b)  assert(x>=a and x<=b)				
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define se          second
#define fi          first 
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll mnz(ll& a,ll b){return a=(a>b?b:a);}
inline ll mxz(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[MAXN+5];

ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c,sum=0,v,t;
	// PROCESS IN HERE
//	sc2(x,y);
//	fu(i,1,100){
//		if(x*i-i+1>=y)re pr(i),0;
//	}
sc(n); n--;
pr((n+1)*n/2);
	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	if(fopen("locin.txt", "r"))INPUT;
	ll JUDGE_ONLINE = 1;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	}
	if (!JUDGE_ONLINE) cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";  
		
}

Measured memory_bytes: 256
using System;

namespace ITP1_4_C
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var input = Console.ReadLine().Split(' ');
                var op = input[1];
                if (op == "?")
                    break;
                var a = int.Parse(input[0]);
                var b = int.Parse(input[2]);
                switch (op)
                {
                    case "+":
                        Console.WriteLine(a + b);
                        break;
                    case "-":
                        Console.WriteLine(a - b);
                        break;
                    case "*":
                        Console.WriteLine(a * b);
                        break;
                    case "/":
                        Console.WriteLine(a / b);
                        break;
                }
            }
        }
    }
}

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

#define pb push_back
#define eb emplace_back
#define mk make_pair
#define fi first
#define se second
#define mset(a, b) memset(a, b, sizeof(a))
#define DBG(x) cout << "[" << #x << "]: " << x << endl
using ll = long long;
using pii = pair<int, int>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<class Ty> Ty randint(Ty a, Ty b) { return uniform_int_distribution<Ty>(a, b)(rng); }
template<class num> inline void rd(num& x) {
	char c; while(isspace(c = getchar()));
	bool neg = false;
	if(!isdigit(c)) neg = (c == '-'), x = 0;
	else x = c - '0';
	while(isdigit(c = getchar())) x = (x << 3) + (x << 1) + c - '0';
	x = neg ? -x : x; }
template <class... Args> inline void rd(Args&... args) { (rd(args), ...); }
template <class... Args> inline void rf(Args&... args) { (cin >> ... >> args); }
template <class... Args> inline void pr(Args&&... args) { (cout << ... << args); }

const int MAXN = 2e5 + 5, INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;

inline int add(int x, int y) {
	x += y;
	if (x >= MOD) x -= MOD;
	return x;
}

inline int sub(int x, int y) {
	x -= y;
	if (x < 0) x += MOD;
	return x;
}

inline int mul(int x, int y) {
	return (1ll * x * y % MOD + MOD) % MOD;
}

int main() {
	int n, k; rd(n, k);
	vector<int> a(n);

	int P = 0, N = 0, Z = 0;
	for (int& i : a) rd(i), P += i > 0, N += i < 0, Z += i == 0;

	int ans = 1;

	bool neg = P < k;
	if (neg && P == 0 && k%2 == 0) neg = false;
	if (neg && P > 0) neg = false;

	if (neg) {
		if (Z) ans = 0;
		else {
			sort(a.rbegin(), a.rend());
			for (int i = 0; i < k; i++)
				ans = mul(ans, a[i]);
		}
	} else {
		sort(a.begin(), a.end());
		
		for (int l = 0, r = n-1; k > 0;) {
			if (k == 1) {
				ans = mul(ans, a[r--]);
				k--;
			} else {
				if (1ll * a[l] * a[l+1] >= 1ll * a[r] * a[r-1]) {
					ans = mul(ans, a[l]);
					ans = mul(ans, a[l+1]);
					l += 2;
					k -= 2;
				} else {
					ans = mul(ans, a[r]);
					r--;
					k--;
				}
			}
		}
	}

	printf("%d\n", ans);

}

Measured memory_bytes: 3980
#include <iostream>
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod = 1e9 + 7;
using namespace std;
void add(int& a , int b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}

int main(){
	IOS;
	int n ; cin >> n ;
	if(log2(n) == (int)log2(n)) return cout << "No" <<"\n" , 0 ;
	cout << "Yes" << endl ;
	cout << n + 1 << " " << n + 2 << endl ;
	for(int i = 2 ; i < n ; i += 2){
			cout << 1 << " " << i << "\n" ;
			cout << 1 <<  " " << n + i + 1 << "\n" ;
			cout << i <<" " << i + 1 << "\n" ;
			cout << n + i <<" " << n + i + 1 << "\n" ;
	}
	if(n % 2 == 0){
		for(int i = 2 ; i <= n ; i++){
			if((n ^ i ^ 1) < n){
				if((n ^ i ^ 1) % 2){
					cout << n << " " << i << endl ;
					cout << n  + (n ^ i ^ 1 )<< " " << 2 * n << endl ;
					return 0 ;
				}
				else{
					cout << n << " " << i << endl ;
					cout <<  (n ^ i ^ 1) << " " << 2 * n << endl ;
				}
				return 0 ;
			}
		}
	}
				
		
	
	
	return 0;
}


Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main()
{
	vector<int> num(1 << 8);

	rep(i, (1 << 8)) {
		num[i] = i * i;
	}

	while (true) {
		int n;

		cin >> n;

		if (n == 0) {
			break;
		}

		int ans = 0;

		for (int i = 1; i < sqrt(n) + 1; i++) {
			if (num[i] == n) {
				ans++;
			}
			else if (num[i] < n) {
				for (int j = i; j < sqrt(n) + 1; j++) {
					if (num[i] + num[j] > n) {
						break;
					}
					else if (num[i] + num[j] == n) {
						ans++;
					}
					else {
						for (int k = j; k < sqrt(n) + 1; k++) {
							if (num[i] + num[j] + num[k] > n) {
								break;
							}
							else if (num[i] + num[j] + num[k] == n) {
								ans++;
							}
							else {
								for (int l = k; l < sqrt(n) + 1; l++) {
									if (num[i] + num[j] + num[k] + num[l] > n) {
										break;
									}
									else if (num[i] + num[j] + num[k] + num[l] == n) {
										ans++;
									}
								}
							}
						}
					}
				}
			}
		}

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

Measured memory_bytes: 3028