akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)

int cnt = 0;

void merge(int A[], int left, int mid, int right){
    int n1 = mid - left;
    int n2 = right - mid;
    vector<int> L(n1+1), R(n2+1);
    rep(i, n1)
        L[i] = A[left + i];
    rep(i, n2)
        R[i] = A[mid + i];
    
    L[n1] = INT_MAX;
    R[n2] = INT_MAX;
    int i = 0;
    int j = 0;
    for(int k = left; k < right; k++){
        cnt++;
        if(L[i] <= R[j]){
            A[k] = L[i];
            i++;
        }
        else{
            A[k] = R[j];
            j++;
        }
    }
}

void mergeSort(int A[], int left, int right){
    if(left+1 < right){
        int mid = (left + right)/2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main()
{
    int n;
    cin >> n;
    int s[500000];
    rep(i, n){
        cin >> s[i];
    }

    mergeSort(s, 0, n);

    rep(i, n){
        if(i != n-1)
            cout << s[i] << " ";
        else
            cout << s[i] << endl;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 6768
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define INF 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;
typedef pair<int, int> P;

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

	int H,W;
	cin >> H >> W;
	int cnt = 0;
	rep(i,H){
		rep(j,W){
			char a;
			cin >> a;
			if(a == '#') cnt++;
		}
	}

	if(cnt == H + W - 1) cout << "Possible" << endl;
	else cout << "Impossible" << endl;

	return 0;
}

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

using namespace std;
using ll = long long;

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount


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

    for (int i = sz(s)-1; i >= 0; i--) {
        s.erase(i);
        if(i%2==0){
            if(s.substr(0, i/2)==s.substr(i/2)){
                cout << i << endl;
                return 0;
            }
        }
    }

    return 0;
}

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

int main(){
	int n;
	string s;
	cin >> n >> s;
	long long g =0,
	 r =0,
	 b =0,
	 ans=0;
	for(int i=0; i<n;i++){
		if(s[i] == 'R') r++;
		else if(s[i] == 'G') g++;
		else b++;
	}
	ans = r * g * b;
	int tmp =0;
	for(int i=0; i< n; i++){
		for(int j=i+1; j < n; j++){
			int k = 2*j-i;
			if(k>=n) continue;
			if(s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) tmp++;
		}
	}
	cout << ans - tmp << endl;
	return 0;
}


Measured memory_bytes: 3616
def solve():
    s = input()
    ans_l = [1] * len(s)

    for i in range(len(s)-2):
        if s[i] == 'R' and s[i+1] == 'R':
            ans_l[i+2] += ans_l[i]
            ans_l[i] = 0

    for i in range(len(s)-1, 1, -1):
        if s[i] == 'L' and s[i-1] == 'L':
            ans_l[i-2] += ans_l[i]
            ans_l[i] = 0

    print(' '.join(map(str, ans_l)))


if __name__ == '__main__':
    solve()

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

#define f(i, a, b, c) for(int i = a ; i < b ; i += c)
#define fr(i, a, b, c) for(int i = a ; i >= b ; i -= c)
#define fit(it, v) for(auto it = v.begin() ; it != v.end() ; ++it)
#define frit(it, v) for(auto it = v.rbegin() ; it != v.rend() ; ++it)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define eb emplace_back
#define pb push_back
#define lli long long int
#define PI 3.14159265358979
#define modn 1000000007
#define NL '\n'

using namespace std;

typedef vector< int > vi;
typedef vector< char > vc;
typedef vector< bool > vb;
typedef vector< string > vs;
typedef vector< lli > vli;
typedef vector< vector< char > > vvc;
typedef vector< vector< int > > vvi;
typedef pair< int, int > ii;
typedef vector< ii > vii;
typedef pair< lli, int> pli;
typedef pair< lli, lli> pll;
typedef set< int > si;
typedef set< ii > sii;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	#ifdef LOCAL_TEST
		clock_t z = clock();
    	ifstream h("in");
	    ofstream g("out");
	#else
	    #define h cin
	    #define g cout
	#endif // LOCAL_TEST
	
	int a, b, c;
	h >> a >> b >> c;
	if (a == b && b == c)
		g << "No";
	else if (a != b && b != c && a != c)
		g << "No";
	else
		g << "Yes";
	
	#ifdef LOCAL_TEST
		cerr << "Time taken is: " << double(clock() - z) / CLOCKS_PER_SEC << NL;
		h.close();
		g.close();
	#endif // LOCAL_TEST
}

Measured memory_bytes: 256
N = int(input())
T,A = (int(i) for i in input().split())
p = float('inf')
for i,h in enumerate([int(i) for i in input().split()]):
    tmp = T-h*0.006
    if p > abs(A-tmp):
        p = abs(A-tmp)
        ans = i+1
print(ans)


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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> stick;
  for(int i = 0; i < N; i++){
    int x;
    cin >> x;
    stick.push_back(x);
  }
  sort(stick.begin(), stick.end());
  int sum = 0;
  for(int i = 0; i < K; i++){
    sum += stick.at(N - 1 - i);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
import heapq
import bisect
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [(-x, x) for x in A]
heapq.heapify(A)
for i in range(M):
    P = heapq.heappop(A)
    p = P[1] // 2
    heapq.heappush(A, (-p, p))
s = 0
for i in range(N):
    s += A[i][1]
print(s)

Measured memory_bytes: 79980
n= int(input())
words=[input() for i in range(n)]
flag="Yes"
if len(words)!=len(set(words)):
  print("No")

else:
  for i in range(n-1):
    if words[i][-1]==words[i+1][0]:
      pass
    else:
      flag="No"
      break
  print(flag)

Measured memory_bytes: 3060
#include <iostream>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=1e5+3;

int main(){
	lli N;
	cin>>N;
	lli h[MAX];
	rep1(i,N){cin>>h[i];}
	lli co[MAX];
	co[0]=MAX;
	co[1]=0;
	for(int i=2;i<=N;i++){
		lli fi=co[i-1]+abs(h[i]-h[i-1]);
		lli se=co[i-2]+abs(h[i]-h[i-2]);
		co[i]=min(fi,se);
	}
	cout<<co[N];
}

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

fun main (args : Array <String>) {
  val input = Scanner(System.`in`)
  
  while (input.hasNext()) {
    val N = input.nextInt()
    val M = input.nextInt()
    val penalty = IntArray(N + 1)
    val ACProb = HashSet<Int>()
    
    for (i in 1..M) {
      val p = input.nextInt()
      val S = input.next()
      
      if (S.equals("WA") && ACProb.contains(p) == false) {
        ++penalty[p]
      } else if (S.equals("AC")) {
        ACProb.add(p)
      }
    }
    
    for (i in 1..N) {
      if (ACProb.contains(i) == false ) {
         penalty[i] = 0
      }
    }
    
    println("${ACProb.size} ${penalty.sum()}")
  }
}

Measured memory_bytes: 67228
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;

ll com[52][52];
ll c[52][52];

int main()
{
    int n, k, s, t;
    cin >> n >> k >> s >> t;
    int a[52];
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if((a[i] & t) < a[i] || (a[i] | s) > a[i]){
            i--;
            n--;
        }
    }
    com[0][0] = 1;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            com[i + 1][j] += com[i][j];
            com[i + 1][j + 1] += com[i][j];
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= i; j++){
            c[i][j] = c[i][j - 1] + com[i][j];
        }
    }
    int l = 0;
    int r[52]{0};
    for(int i = 0; i < 18; i++){
        if(((s >> i) & 1) == 1 && ((t >> i) & 1) == 0){
            cout << 0 << endl;
            return 0;
        }
        if(((s >> i) & 1) == 0 && ((t >> i) & 1) == 1){
            for(int j = 0; j < n; j++){
                if((a[j] >> i) & 1) r[j] += (1 << l);
            }
            l++;
        }
    }
    ll ans = 0;
    for(int b = 0; b < (1 << l); b++){
        map<int, int> mp;
        int d[52]{0};
        ll p = 0;
        for(int j = 0; j < l; j++){
            if((b >> j) & 1){
                p++;
                for(int i = 0; i < n; i++){
                    if((r[i] >> j) & 1) d[i] += (1 << j);
                }
            }
        }
        for(int i = 0; i < n; i++) mp[d[i]]++;
        ll s = 0;
        for(auto itr = mp.begin(); itr != mp.end(); itr++){
            s += c[itr->second][min(itr->second, k)];
        }
        if(p % 2) ans -= s;
        else ans += s;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3672
#include <stdio.h>
#include <stdlib.h>

int main(){
	int i, x=0, y=0, idxa=0, idxb=0, idxc=0;
	char s[3][101]; //0:a, 1:b, 2:c
	for(i=0; i<3; i++){
		scanf("%s", s[i]);	
	}
	
	while(1){
		if(s[x][y]=='a'){
			x=0;
			if(s[x][idxa]=='\0') break;
			y=idxa++;
		}
		else if(s[x][y]=='b'){
			x=1;
			if(s[x][idxb]=='\0') break;
			y=idxb++;
		}
		else{
			x=2;
			if(s[x][idxc]=='\0') break;
			y=idxc++;
		}
	}

	switch(x){
		case 0: {
			printf("A\n");	
			break;
		}
		case 1: {
			printf("B\n");
			break;
		}
		case 2: {
			printf("C\n");	
			break;
		}
	}
}

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

#ifdef _PRINTDEBUG
  #include "lib/printdebug.hpp"
#else
  #define printdebug(...) 1
#endif
#define MOD_1_000_000_007 (1000000007)
#define IINF (1<<28)
#define LINF (1LL<<60)
#define rep(i, n)      REP(i, 0, (n))
#define repc(i, n)     REPC(i, 0, (n))
#define REP(i, n, m)   for (int i = (int)(n); i <  (int)(m); i++)
#define REPC(i, n, m)  for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
#define yesno(cond)       YESNO((cond), "Yes", "No")
#define YESNO(cond, a, b) cout << ((cond) ? (a) : (b)) << "\n"

namespace solver {
  using namespace std;
  typedef long long ll;

  static const int MAX = 100010;
  int N, as[MAX];

  void init() {
    cin >> N;
    rep(i, N) {
      cin >> as[i];
    }
  }

  void solve() {
    rep(i, N) if(as[i]%2) {
      cout << "first" << "\n";
      return;
    }
    cout << "second" << "\n";
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  solver::init();
  solver::solve();
  return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


int go(int n)
{
    return ((n*(n+1)))/2;
}

void solve()
{
   int n;
    cin >> n;
    
   cout << go(n) - go(n/3)*3 - go(n/5)*5 + go(n/15)*15;
    
    
}

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

Measured memory_bytes: 3644
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

N, M = map(int, readline().split())
xy = map(int, read().split())

ball = [1] * (N + 1)
red = [False] * (N + 1)
red[1] = True

for x, y in zip(xy, xy):
    if red[x]:
        red[y] = True

    ball[x] -= 1
    ball[y] += 1

    if ball[x] == 0:
        red[x] = False

print(sum(red[1:]))

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

#define ll long long
#define vl vector<ll>
#define vvl vector<vector<ll>> //vvl data(10, vector<ll>(10);
#define fo(i,a,b) for(ll i=a; i<b; i++)

int main(){
    long double a, b;
    cin >> a >> b;
    //printf("%.16f\n", floor(a*b));
    cout << fixed << setprecision(0) << floor(a*b) << endl;
}

/*
　 ◇　　　　 ミ ◇
　◇◇　 /￣|　 ◇◇
◇◇＼　 L＿| ◇◇
　　彡Ｏ(・＿・)/
　 　　ヽ Ｐ`Ｏ
　　 ／彡#_|ミ＼
　　　 </LL凵>
　　　　∪ ∪
pass system test !!
*/

Measured memory_bytes: 3784
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define  ll  long long
#define  pii pair<int,int>
#define  pll pair<ll , ll>
#define  debug cout << "this far" << endl;
#define  For(i, n) for(int i = 0; i < (n); ++i)
#define  lsb(x) ((x) & (-x))
#define  PI acos(-1)
#define  line cout << endl;
#define  getbit(n, i) (((n) & (1LL << (i))) != 0)
#define  resetbit(n, i) ((n) & (~(1LL << (i))))
#define  setbit(n, i) ((n) | (1LL << (i)))
#define  togglebit(n, i) ((n) ^ (1LL << (i)))
#define  gap " "
#define  ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
using namespace std;
const int N = 5e5 + 4;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int x ; cin >> x ;
    if(x >= 30) cout << "Yes" << endl ;
    else cout << "No"<< endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,l;
  cin >> a>>b>>c;
  l = a+b+1;
  if(c<=l){
    cout<<c+b<<endl;
  }
  else{
    cout<<a+b+1+b<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n,m,X,Y;
  cin>>n>>m>>X>>Y;
  
  vector<int> x(n+1),y(m+1);
  for(int i=0;i<n;i++){
    cin>>x[i];
  }
  x[n]=X;
  for(int i=0;i<m;i++){
    cin>>y[i];
  }
  y[m]=Y;
  
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  
  int max_x = x[n];
  int min_y = y[0];
  if(min_y-max_x>0){
    cout << "No War" <<endl;
  }else{
    cout<< "War" <<endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define rep(i,j,k) for(int i=j;i<k;i++)
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
const int  COMMAX = 510000;

long long fac[COMMAX], finv[COMMAX], inv[COMMAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < COMMAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct UnionFind {
  vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
  vector<int> rank;
  int num;
  UnionFind(int N) : par(N) , rank(N) { //最初は全てが根であるとして初期化
    num = N;
    for(int i = 0; i < N; i++){
      par[i] = i;
      rank[i] = 0;
    }
  }

  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
    if(rank[rx] < rank[ry]){
      par[rx] = ry;  
    }else{
      par[ry] = rx;
      if(rank[rx] == rank[ry])rank[rx]++;
    }
    num--;
  }

  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    return root(x) == root(y);
  }
};

const int MS = 2;
const long long mod[] = {999999937LL, 1000000007LL}, base = 9973;
struct rolling_hash {
    int n;
    vector<long long> hs[MS], pw[MS];
    rolling_hash(){}
    rolling_hash(const string &s) {
        n = s.size();
        for (int i = 0; i < MS; i++) {
            hs[i].assign(n+1,0);
            pw[i].assign(n+1,0);
            hs[i][0] = 0;
            pw[i][0] = 1;
            for (int j = 0; j < n; j++) {
                pw[i][j+1] = pw[i][j]*base%mod[i];
                hs[i][j+1] = (hs[i][j]*base+s[j])%mod[i];
            }
        }
    }

    long long hash(int l, int r, int i) { return ((hs[i][r]-hs[i][l]*pw[i][r-l])%mod[i]+mod[i])%mod[i]; }

    bool match(int l1, int r1, int l2, int r2) {
        bool ret = 1;
        for (int i = 0; i < MS; i++) ret &= hash(l1,r1,i)==hash(l2,r2,i);
        return ret;
    }

    bool match(int l, int r, long long h[]) {
        bool ret = 1;
        for (int i = 0; i < MS; i++) ret &= hash(l,r,i)==h[i];
        return ret;
    }
};

int main(){
  int n;
  cin >> n;
  LL res = 0;
  rep(i,1,10){
    rep(j,1,10){
      int a=0;
      int b=0;
      int e=1;
      rep(k,1,n+1){
        if(k >= e * 10)e *= 10;
        int c = k / e;
        int d = k % 10;
        if(c == i and d == j)a++;
        if(c == j and d == i)b++;
      }
      res += a*b;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
s=gets.chomp.split("").map{|s| s.to_i}
a=s[0]*10+s[1]
b=s[2]*10+s[3]
u,v=0,0
if a<=12 && a!=0
  u=1
end

if b<=12 && b!=0
  v=1
end

if u==1 && v==1
  puts "AMBIGUOUS"
elsif u==1 && v==0
  puts "MMYY"
elsif u==0 && v==1
  puts "YYMM"
elsif u==0 && v==0
  puts "NA"
end

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <assert.h>
#include <map>
#include <set>
#include <bitset>
#include <iomanip>
#include <stack>
// #include <unordered_map>
#include <cmath>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
// #define INF 0x7f7f7f7f  //2139062143
#define INF1 0x3f3f3f3f //1061109567
#define INF2 2147483647
#define llINF 9223372036854775807
#define pi 3.14159265358979323846264338327950254
#define pb push_back
#define ll long long
#define debug cout << "debug\n";
#define STDIN                      \
    freopen("in.txt", "r", stdin); \
    freopen("out.txt", "w", stdout);
#define IOS                      \
    ios::sync_with_stdio(false); \
    cin.tie(NULL);
#define scai(x) scanf("%d", &x)
#define sca2i(x, y) scanf("%d %d", &x, &y)
#define scaf(x) scanf("%lf", &x)
#define sca2f(x, y) scanf("%lf %lf", &x, &y)
#define For(m, n) for (int i = m; i < n; i++)
#define PII pair<int, int>
#define PLL pair<long, long>
#define ft first
#define sd second
#define pb push_back
#define ST(x, y, z) sort(x + y, x + z);
#define lson o << 1, l, mid
#define rson o << 1 | 1, mid + 1, r
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define ROF(i, a, b) for (int i = (a); i >= (b); i--)
#define MEM(x, v) memset(x, v, sizeof(x))
#define rep(i, a, b) for (register int i = a; i <= b; i++)
#define rrep(i, a, b) for (register int i = a; i >= b; i--)
#define PIII pair<int, PII>
#define re read()
#define case  \
    int T;    \
    cin >> T; \
    rep(_,1,T)
// #define int ll
#define LL long long
#define int ll
inline int read()
{
    char tempt = getchar();
    int x = 0, f = 0;
    while (tempt < '0' || tempt > '9')
        f |= tempt == '-', tempt = getchar();
    while (tempt >= '0' && tempt <= '9')
        x = x * 10 + tempt - '0', tempt = getchar();
    return f ? -x : x;
}

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

const int N =  100+5;
int a[N];
int dp[N][N];

int st[27][N];
signed main()
{
    //STDIN
    int n; n = re;
    cout << n + n*n + n*n*n << endl;
}

Measured memory_bytes: 3592
from collections import Counter
from functools import reduce
# import statistics
import bisect
import copy
import fractions
import math
import pprint
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v):
    # ノードに訪れた
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  # そもそもvとv2が辺でつながっていない
            continue
        if visited[v2] == True:  # もう見た
            continue
        dfs(v2)


n = II()
a = LI()
colors = [0] * 9
for rate in a:
    if 1 <= rate <= 399:
        colors[0] += 1
    elif 400 <= rate <= 799:
        colors[1] += 1
    elif 800 <= rate <= 1199:
        colors[2] += 1
    elif 1200 <= rate <= 1599:
        colors[3] += 1
    elif 1600 <= rate <= 1999:
        colors[4] += 1
    elif 2000 <= rate <= 2399:
        colors[5] += 1
    elif 2400 <= rate <= 2799:
        colors[6] += 1
    elif 2800 <= rate <= 3199:
        colors[7] += 1
    else:
        colors[8] += 1
ans = sum(colors[i] >= 1 for i in range(8))
if ans != 0:
    print(str(ans) + ' ' + str(ans + colors[8]))
else:
    print(str('1') + ' ' + str(colors[8]))


Measured memory_bytes: 5452
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int a, b, h; cin >> a >> b >> h;
  cout << (a+b)*h/2 << endl;
  system("pause");
}

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

namespace AizuOnLine_Lesson
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> data = Program.GetData();

            int result = 0;
            foreach (int num in data)
            {
                double sqrtNum = Math.Sqrt((double)num);

                bool flag = true;
                for (int i = 2; i <= sqrtNum; i++)
                {
                    if (num % i == 0)
                    {
                        flag = false;
                        break;
                    }
                }

                result += flag ? 1 : 0;
            }

            Console.WriteLine(result);
        }

        private static List<int> GetData()
        {


            List<int> data = new List<int>();

            int count = Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i < count; i++)
            {
                data.Add(Convert.ToInt32(Console.ReadLine()));
            }

            return data;
        }
    }
}

Measured memory_bytes: 5948
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
	i += 1
	parent = int(i / 2)
	left = i * 2
	right= i * 2 + 1
	t = "node {}: key = {}, ".format(i, A[i - 1])
	if i > 1:
		t += "parent key = {}, ".format(A[parent - 1])
	if left <= N:
		t += "left key = {}, ".format(A[left - 1])
	if right <= N:
		t += "right key = {}, ".format(A[right- 1])
	print(t)

Measured memory_bytes: 7604
#include <iostream>
using namespace std;
int main(void){
    int x1,x2;
    cin>>x1>>x2;
    if(x1>x2){
        cout<<x1-x2<<endl;
    }
    else if(x1<x2){
        cout<<x2-x1<<endl;
    }
    else if(x1==x2){
        cout<<"0"<<endl;
    }
    }


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
map<ll,ll> mp;
bool isprime(ll n){
	if(n==1) return false;
	for(ll i=2;i*i<=n;i++){
		if(n%i==0){
			return false;
		}
	}
	return true;
}
int main(){
	ll n;
	cin>>n;
	ll nn = n;
	for(ll i=2;i*i<=nn;i++){
		while(n%i==0){
			n/=i;
			mp[i]++;
		}
	}
	//cout<<mp[2]<<mp[5];
	ll ans = 0;
	for(auto i:mp){
		//cout<<i.first<<" "<<i.second<<endl;
		ll tmp = i.second;
		ll cnt = 0;
		ll ct = 1;
		while(cnt<=tmp){
			cnt += ct++; 
		}
		ct -= 2;
		ans += ct;
	}
	if(isprime(n)) ans++;  //wa点 做不下去时要判断是不是质数 如果是质数那么z可以等于这个数 即答案+1 
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;
long long int MOD = 1000000000 + 7;
using ll = long long;

int main() {
	double h, w, n;
	cin >> h >> w >> n;
	double x = h < w ? w : h;
	cout << ceil(n / x) << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

while True:
    a,L = map(int,input().split(" "))
    if a == 0 and L == 0:
        break
    a_set = dict()
    a_set[a] = 0
    a = str(a)
    a = a + '0' * ( L - len(a))
    i = 1
    while True:
        a = int(''.join(reversed(sorted(a)))) - int(''.join(sorted(a)))
        if a in a_set:
            break
        else:
            a_set[a] = i
        a = str(a)
        a = a + '0' * (L-len(a))
        i += 1
    print(a_set[a],a,i-a_set[a])

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

int main(void) {
  int H, W;
  cin >> H >> W;
  string s;
  string edge(W + 2, '#');
  cout << edge << endl;
  for (int i = 0; i < H; i++) {
    cout << "#";
    cin >> s;
    cout << s;
    cout << "#" << endl;
  }
  cout << edge << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using product = pair<ll,ll>;
using graph = vector<vector<ll>>;
using vll = vector<ll>;

bool second_compare(pair<ll,ll> a,pair<ll,ll> b)
{
    return a.second < b.second;
}

int main(){
    ll N;
    cin>>N;
    vector<product> robots(N);
    for(ll i=0;i<N;i++)
    {
        ll x,l;cin>>x>>l;
        ll start=x-l;
        ll terminal=x+l;
        robots[i]=make_pair(start,terminal);
    }
    sort(robots.begin(),robots.end(),second_compare);
    ll res=0;
    ll cur=LLONG_MIN;
    for(auto p:robots)
    {
        if(cur<=p.first)
        {
            res++;
            cur=p.second;
        }
    }
    cout<<res;
    return 0;
}

Measured memory_bytes: 4848
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=200010;
int d1[N],d2[N],n;
int main()
{
    IO;
    int T=1;
    //cin>>T;
    while(T--)
    {
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            int x,y;
            cin>>x>>y;
            d1[i]=x+y;
            d2[i]=x-y;
        }
        sort(d1+1,d1+1+n);
        sort(d2+1,d2+1+n);
        cout<<max(d1[n]-d1[1],d2[n]-d2[1])<<'\n';
    }
    return 0;
}


Measured memory_bytes: 5200
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
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;
}
int main(){
    ll k, a, b;
    cin >> k >> a >> b;
    ll ans = 0;
    ll bis = 1;
    ll money = 0;
    if (b - a <= 2){
        cout << k + 1 << endl;
        return 0;
    } else {
        for (ll i = 0; i < k;i++){
            if (bis < a) bis++;
			else {
                if (i ==k-1) {
                    bis++;
                }
                else{
                    bis -= a;
                    bis += b;
                    i++;
                }
            }
        }
    }
    cout << bis << endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <utility>
using namespace std;

int main() {
    int64_t x, y, z, k;
    cin >> x >> y >> z >> k;
    vector<int64_t> xs(x), ys(y), zs(z);
    for (int i = 0; i < x; i++) {
        cin >> xs[i];
    }
    for (int i = 0; i < y; i++) {
        cin >> ys[i];
    }
    for (int i = 0; i < z; i++) {
        cin >> zs[i];
    }
    vector<int64_t> x_plus_y(x*y);
    for (int i = 0; i < x; i++) {
        for (int j = 0; j < y; j++) {
            x_plus_y[i*x+j] = xs[i] + ys[j];
        }
    }
    sort(x_plus_y.begin(), x_plus_y.end(), greater<int64_t>());
    priority_queue<pair<int64_t, pair<int64_t, int>>> q;
    for (int i = 0; i < z; i++) {
        q.push(make_pair(zs[i] + x_plus_y[0], make_pair(zs[i], 0)));
    }
    for (int i = 0; i < k; i++) {
        auto v = q.top();
        q.pop();
        cout << v.first << endl;
        v.second.second++;
        if (v.second.second < x_plus_y.size()) {
            v.first = v.second.first + x_plus_y[v.second.second];
            q.push(v);
        }
    }
}

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

int main(){
    int n1,n2,n3,n;
    cin >> n;
    n1 = n%10;
    n3 = n/100;
    int x = n3 * 100;
    n2 = n - n1 - x;
    int ans = 0;
    if(n1 == 1)
        ans += 1;
    if(n2/10 == 1)
        ans += 1;
    if(n3 == 1)
        ans += 1;
    
    cout << ans << endl;    


    return 0;
}

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

using namespace std;
using ll = long long;

#define INF (1LL << 60)
#define MOD 1000000009

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back


int main()
{
    ll N, M;
    cin >> N >> M;
    vector<vector<ll>> G(N*3);
    ll u, v;
    REP(i,0,M) {
        cin >> u >> v;
        --u; --v;
        G[u*3].pb(v*3+1);
        G[u*3+1].pb(v*3+2);
        G[u*3+2].pb(v*3);
    }
    ll S, T;
    cin >> S >> T;
    S = (S - 1) * 3;
    T = (T - 1) * 3;

    queue<ll> Q;
    vector<ll> dist(N*3, -1);
    Q.push(S);
    dist[S] = 0;

    while(!Q.empty()) {
        v = Q.front();
        Q.pop();
        FORR(nv,G[v]) {
            if(dist[nv] == -1) {
                dist[nv] = dist[v] + 1;
                Q.push(nv);
            }
        }
    }
    
    ll ans = dist[T];
    if(ans == -1) _PR(-1);
    else _PR(ans/3);

    return 0;
}

/*



*/

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 200005;

int main(){
  FASTER;
  int n;
  cin >> n;
  int sum = 0;
  for (int i = 0; i < n; i++){
    int x;
    cin >> x;
    sum += (x - 1);
  }
  cout << sum << '\n';
  return 0;
}

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

#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;


void solve() {
    int a, b;
    cin >> a >> b;
    if (b > 4 * a || b % 2 || b < 2 * a) {
        cout << "No\n";
        return;
    }
    cout << "Yes\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	vector<ll> a(n),sum(n+1,0);
	rep(i,n){
		cin>>a[i];
		sum[i+1]=sum[i]+a[i];
	}
	rep(i,n+1){
		sum[i]=(sum[i]-i+k)%k;
	}
	map<ll,ll> mp;
	ll ans=0;
	mp[0]++;
	ll l=0;
	FOR(r,1,n+1){
		if(r-l==k){
			mp[sum[l]]--;
			l++;
		}
		ans+=mp[sum[r]];
		mp[sum[r]]++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 15872
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
using namespace std;
#define eps 0.000001
#define LONG_INF 10000000000000
#define GOLD 1.61803398874989484820458
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
int main() {
	int h, w, n;
	cin >> h >> w >> n;
	int start_x, start_y;
	cin >> start_x >> start_y;
	string a, b;
	cin >> a >> b;
	int now[4] = {};
	now[0] = start_x;
	now[1] = start_x;
	now[2] = start_y;
	now[3] = start_y;
	int lose = 0;
	//L と R はy軸
	for (int i = 0; i < a.length(); ++i) {
		if (a[i] == 'L') {
			now[2]--;
		}
		if (a[i] == 'R') {
			now[3]++;
		}
		if (a[i] == 'U') {
			now[0]--;
		}
		if (a[i] == 'D') {
			now[1]++;
		}
		if (now[0] <= 0) lose = 1;
		if (now[1] > h) lose = 1;
		if (now[2] <= 0) lose = 1;
		if (now[3] > w) lose = 1;
		if (b[i] == 'L') {
			now[3]--;
			now[3] = max(now[3], 1);
		}
		if (b[i] == 'R') {
			now[2]++;
			now[2] = min(now[2], w);
		}
		if (b[i] == 'U') {
			now[1]--;
			now[1] = max(now[1], 1);
		}
		if (b[i] == 'D') {
			now[0]++;
			now[0] = min(now[0], h);
		}
	}
	if (lose == 1) {
		cout << "NO" << endl;
	}
	else cout << "YES" << endl;
}

Measured memory_bytes: 776
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	vector< int > A(N);
	rep(i, N) cin >> A[i];
	set< int > s;
	rep(i, N) {
		if (s.find(A[i]) == s.end()) {
			s.insert(A[i]);
		} else {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

const int POOL_SIZE = 11;

ll k;
int digit = 0;

ll nextLunlun(ll num)
{
	// num は lunlun の前提
	if ((int)log10(num) < (int)log10(num + 1))
	{
		return num + 1;
	}

	int a = num % 10;
	num /= 10;
	int b = num % 10;

	int loop_cnt = 0;
	while(num)
	{
		if (a - b < 1 && a * b != 81)
		{
			break;
		}

		a = b;
		num /= 10;
		b = num % 10;		
		loop_cnt++;
	}

	num = num * 10 + a + 1;
	for(int i = 0; i < loop_cnt; ++i)
	{
		num = num * 10 + a;
		a = max(0, a - 1);
	}
	return num;
}

void solve()
{
	cin >> k;
	//cout << nextLunlun(k) << endl;
	//return;

	ll cnt = 1;
	ll i = 1;
	
	while(i <= 3234566667)
	{
		if (cnt == k)
		{
			cout << i << endl;
			return;
		}
		i = nextLunlun(i);
		++cnt;
	}
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 640
from collections import defaultdict as DD
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

D = DD(int)
D["s"] = R
D["p"] = S
D["r"] = P

ans = 0
C = [0 for i in range(N)]
for i in range(N):
  if i < K:
    ans +=  D[T[i]]
    C[i] = 1    
  elif T[i-K] == T[i]:
    if C[i-K] != 1:
      ans +=  D[T[i]]
      C[i] = 1
  else:
      ans +=  D[T[i]]
      C[i] = 1    
print (ans)

Measured memory_bytes: 4624
/*  ex4_2
    kosaq       */

#include <stdio.h>
#include <math.h>//数学関数を使用

double distance(int centi_hour, int centi_minute, int h_hour, int m_minute);//プロトタイプ宣言をする。

int main(void){
    int centi_A, centi_B, hour, minute;//それぞれ、時針の長さ、分針の長さ、現在の時間H時M分を定義
    scanf("%d %d %d %d", &centi_A, &centi_B, &hour, &minute);//時針の長さ、分針の長さ、現在の時間H時M分を入力
    double ans;//出力する答え（二本の針の固定されていない端点の間の長さ）

    ans = distance(centi_A, centi_B, hour, minute);//ansに関数から得られる値を代入
    printf("%.20f\n", ans);//答えを出力。誤差を10^-9以下にする為に余裕を持った長さで出力
    return 0;

}

/*
以下は関数の定義*/

double distance(int centi_hour, int centi_minute, int h_hour, int m_minute){//関数を定義する。
    double h_radian, m_radian;//12時を0ラジアンとして、それぞれ時針と分針の角度（単位はラジアン）
    double rad_difference;//時針と分針の角度の差（単位はラジアン）
    double distance;//二本の針の固定されていない端点の間の長さ

    h_radian = 2 * M_PI * ((double)h_hour + (double)m_minute / 60) / 12;//１周2πラジアンに対し、((double)h_hour + (double)m_minute / 60) / 12　周する。
    m_radian = 2 * M_PI * (double)m_minute / 60;//１周2πラジアンに対し、(double)m_minute / 60　周する。
    rad_difference = fabs(h_radian - m_radian);//時針と分針の角度の差の絶対値

    distance = sqrt(pow(centi_hour, 2) + pow(centi_minute, 2) - 2 * centi_hour * centi_minute * cos(rad_difference));//余弦定理を用いて値を出す。

    return (distance);//返り値の値をreturnで返す。
}

Measured memory_bytes: 2580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    ll x[a][a]={};
    pair<ll,ll> y[b];
    pair<ll,ll> z[c];
    for(int i=0;i<b;i++){
        cin>>y[i].first>>y[i].second;
        x[y[i].first-1][y[i].second-1]++;
    }
    for(int i=0;i<a;i++){
        for(int j=1;j<a;j++){
            x[i][j]+=x[i][j-1];
        }
    }
    for(int i=1;i<a;i++){
        for(int j=0;j<a;j++){
            x[i][j]+=x[i-1][j];
        }
    }
    for(int i=0;i<c;i++){
        cin>>z[i].first>>z[i].second;
        z[i].first--;
        z[i].second--;
        if(z[i].first) cout<<x[z[i].second][z[i].second]-x[z[i].first-1][z[i].second]-x[z[i].second][z[i].first-1]+x[z[i].first-1][z[i].first-1]<<endl;
        else cout<<x[z[i].second][z[i].second]<<endl;
    }
    return 0;
}


Measured memory_bytes: 7552
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處

LL a[100005];

int main() {
    LL n, m, v, p;
    cin >> n >> m >> v >> p;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a, a + n, [](LL x, LL y) { return x > y; });
    // for (int i = 0; i < n; i++) {
    //     printf("%lld ", a[i]);
    // }
    // puts("");
    LL ans;
    LL agg = 0;
    for (ans = p; ans < n; ans++) {
        // 前後都還夠塞
        LL les = n - ans;
        LL re = v - (p - 1) - les;
        agg += a[ans - 1];
        if (re <= 0) {
            if (a[p - 1] <= a[ans] + m) {
                continue;
            } else {
                break;
            }
        } else {
            // 要開始塞中間了
            LL space = (ans - p + 1) * (a[ans] + m) - agg;
            LL vote = re * m;
            // printf("ans = %lld, re = %lld, space = %lld, vote = %lld\n", ans, re, space, vote);
            if (a[p - 1] <= a[ans] + m && space >= vote) {
                continue;
            } else {
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4360
n,X= list(map(int, input().split()))
x= list(map(int, input().split()))
x.append(X)
x.sort()
init=x.pop(0)
li=[]
for i in x:
    li.append(i-init)
    init=i
li.sort()
flag=0
mini=li[0]

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort(reverse=True)
    return divisors

for i in make_divisors(mini):
    if flag==0:
        check=0
        for j in li:
            ans=i
            if j%i==0:
                check+=1
        if check==len(li):
            print(ans)
            exit(0)

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

int main() {
  int N,count=0;
  cin >> N;
  
  for(int i=0;i<N;i++){
    int C=log10(i+1)+1;
    if(C%2==1){
      count++;
    }
  }
  cout << count << endl;
}     

Measured memory_bytes: 3932
#include <stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h> 
#define ll long long
#define length 100000   //10万
int compare(const int*a,const int *b);
/*
qsort(array,length,sizeof(int),(int(*)(const int*, const int*))compare);
使う時これ移動
*/
int main(){
    int array[length],N,K;
    int *aryp;
    ll sum=0;
    char chara1[20],chara2[20];
    scanf("%s",chara1);
  scanf("%s",chara2);
  if(chara1[0]==chara2[0])sum++;
  if(chara1[1]==chara2[1])sum++;
  if(chara1[2]==chara2[2])sum++;
  printf("%d",sum);
    return 0;
}
int compare(const int*a,const int *b){
    if(*a<*b)
      return -1;
    else if(*a>*b)
      return 1;
    return 0;
}

Measured memory_bytes: 128
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| min!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| max!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let a: i64 = sc.cin();
    let b: i64 = sc.cin();
    let c: i64 = sc.cin();
    put!(max!(0, b+c-a));
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++ i)
#define reps(i, s, n) for (int i = s; i < (n); ++ i)
#define LL long long

int main()
{
  int n;
  cin >> n;
  
  LL snuke_pow = 1;
  for (int i = 1; i < n + 1; i ++)
  {
    snuke_pow *= i;
    snuke_pow %= 1000000007LL;
  }
  
  cout << snuke_pow;

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    ll N, M;
    cin >> N >> M;
    if(N == 1 && M == 1)
        cout << 1 << endl;
    else if(N == 1)
        cout << M - 2 << endl;
    else if(M == 1)
        cout << N - 2 << endl;
    else
        cout << max(0LL, (N - 2) * (M - 2)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int&
#define I inline
#define W while
#define N 100
using namespace std;
int n,a[N+5],s[N+5];
int main()
{
	RI i,j,t;for(scanf("%d",&n),i=1;i<=n;++i) scanf("%d",a+i);for(i=1;i<=n;++i)
	{
		for(t=0,j=1;j<=n-i+1;++j) a[j]==j&&(t=j);if(!t) return puts("-1"),0;
		for(s[n-i+1]=t;t^(n-i+1);++t) a[t]=a[t+1];
	}
	for(i=1;i<=n;++i) printf("%d\n",s[i]);return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	long long n = s.length();
	map<char, long long> cnt;
	long long ans = 0;
	for(int i = n-1; i >= 0; i--){
		ans += n-1-i-cnt[s[i]];
		cnt[s[i]]++;
	}
	cout << ans+1 << endl;
	return 0;
}

Measured memory_bytes: 720