akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
using namespace std;
int main()
{
	int A,B,Sn=0;
	scanf("%d %d",&A,&B);
	if(A>B) 
	{
		Sn=Sn+A;
		A=A-1;
		if(A>B) 
		{
			Sn=Sn+A;
			A=A-1;		
		} 
		else if(A==B)
		{
			Sn=Sn+A;
			A=A-1;		
		} 
		else if(A<B)
		{
			Sn=Sn+B;
			B=B-1;		
		}				
	} 
	else if(A==B)
	{
		Sn=Sn+B;
		B=B-1;
		if(A>B) 
		{
			Sn=Sn+A;
			A=A-1;		
		} 
		else if(A==B)
		{
			Sn=Sn+A;
			A=A-1;		
		} 
		else if(A<B)
		{
			Sn=Sn+B;
			B=B-1;		
		}					
	} 
	else if(A<B)
	{
		Sn=Sn+B;
		B=B-1;
		if(A>B) 
		{
			Sn=Sn+A;
			A=A-1;		
		} 
		else if(A==B)
		{
			Sn=Sn+A;
			A=A-1;		
		} 
		else if(A<B)
		{
			Sn=Sn+B;
			B=B-1;		
		}						
	}

	printf("%d",Sn);
}

Measured memory_bytes: 128
// Problem : B - Multiple of 9
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long
#define db double
#define mod 1000000007
#define pb push_back
#define pp pair<int,int>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repe(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=b;i>=a;i--)
#define maxn 200005
#define ss second
#define ff first
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
int inv(int a, int b){
 return 1<a ? b - inv(b%a,a)*b/a : 1;
}
void solve()
{
	string str;
	cin >> str;
	int ans = 0;
	for(char x:str)	
		ans += (x-'0');
	if(ans%9 == 0)
		cout <<"Yes" <<"\n";
	else
	cout <<"No" <<"\n";
}
signed main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t;
    while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 3724
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

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

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


	ll n; cin >> n;
	vector<ll> a(n), b(n), c(n);
	rep(i,n) cin >> a[i];

	rep(i, n) {
		b[i] = a[i] + i;
		c[i] = i - a[i];
 	}

	map<ll,ll> mp;
	rep(i, n) {
		mp[b[i]]++;
	}

	ll ans = 0;
	rep(i, n) {

	  ans += mp[c[i]];
		if (b[i] == c[i]) ans--;
	}
	

	cout << ans << endl;
}


Measured memory_bytes: 30568
n, m = map(int, input().split())
ks_array = [[int(x) for x in input().split()] for y in range(m)]
p_array = [int(x) for x in input().split()]
k_array = [x[0] for x in ks_array]
s_array = [x[1:] for x in ks_array]

comb = 2 ** n
cnt = 0
for i in range(comb):
    now = [False for x in range(n)]
    bit = bin(i)
    for index in range(n):
        if bin(i >> index)[-1] == "1":
            now[index] = True

    flag = True
    for index, ss in enumerate(s_array):
        tmp = 0
        for s in ss:
            if now[s-1]:
                tmp += 1
        if tmp % 2 != p_array[index]:
            flag = False
    if flag:
        cnt += 1
print(cnt)


Measured memory_bytes: 3064
#include<cstdio>
using namespace std;

int search (int A[], int n, int key){
    int i = 0;
    A[n] = key;
    while( A[i] != key) i++;
    return i != n;
}

int main(void){
    int n, q, count = 0, key, i, A[10000 + 1];
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%d", &A[i]);
    }
    scanf("%d", &q);
    for (int i = 0; i < q; i++) {
        scanf("%d", &key);
        if (search(A, n, key)) count++;
    }

    printf("%d\n", count);
    return 0;

}


Measured memory_bytes: 2704
#include <bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=n;++i)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
using namespace std;

int main(){
  int x,a,b;
  cin >> x >> a >> b;
  x-=a,x%=b;
  cout << x << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
XX = [int(i) for i in input().split()]
X = sorted(XX)
ans = {}
value = N//2 - 1
for i in range(N):
    if i <= value:
        ans[X[i]] = X[value+1]
    else:
        ans[X[i]] = X[value]

for i in XX:
    print(ans[i])


Measured memory_bytes: 34448
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  vll x(n), l(n);
  rep(i, n){
    cin >> x[i] >> l[i];
  }
  vp p(n);
  rep(i, n){
    p[i] = {x[i]+l[i], x[i]-l[i]};
  }
  sort(ALL(p));
  ll r = -INF;
  ll ans = 0;
  rep(i, n){
    if(r <= p[i].second){
      ans++;
      r = p[i].first;
    }
  }
  print(ans);
}


Measured memory_bytes: 3456
n,x=map(int,input().split())
plist=[1]
blist=[1]
for i in range(n):
  plist.append(plist[-1]*2+1)
  blist.append(blist[-1]*2+3)
def patty(n,x):
  if n==0:
    return 1
  else:
    if x==1:
      return 0
    elif 1<x and x<=blist[n-1]+1:
      return patty(n-1,x-1)
    elif x==blist[n-1]+2:
      return plist[n-1]+1
    elif 2+blist[n-1]<x and 2*blist[n-1]+2>=x:
      return plist[n-1]+patty(n-1,x-2-blist[n-1])+1
    else:
      return plist[n]
print(patty(n,x))


Measured memory_bytes: 3064
#include <iostream>
#include <numeric>
#include <vector>

int main(void) {
    int N, L;
    std::cin >> N >> L;

    std::vector<int> taste(N);
    for (int i = 0; i < N; ++i) {
        taste.at(i) = L + i;
    }

    int sum = std::accumulate(taste.begin(), taste.end(), 0);

    int min_abs_taste = 1000000000;
    for (int i = 0; i < N; ++i) {
        if (abs(taste.at(i)) < abs(min_abs_taste)) min_abs_taste = taste.at(i);
    }

    std::cout << sum - min_abs_taste << '\n';
    return 0;
}

Measured memory_bytes: 256
def solve(N, M, A):

    A = [[int(x[0]), x[1]] for x in A]

    Unsolve = [0]*(N+1)
    Solved = set()
    ac = 0
    wa = 0
    for i in range(M):
        if A[i][0] not in Solved:
            if A[i][1] == 'WA':
                Unsolve[A[i][0]] += 1
            elif A[i][1] == 'AC':
                Solved.add(A[i][0])
                wa += Unsolve[A[i][0]]
                ac += 1

    return ac, wa

def main():
    N, M = map(int, input().split())
    A = [list(x for x in input().split()) for _ in range(M)]
    ans = solve(N, M, A)
    print(*ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 49460
import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author rn-sshawish
 */
public class Main{

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        int c = Integer.parseInt(a+""+b);
        double x = Math.sqrt(c);
        double y = (int)x;
        if (x > y) {
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
        
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef long long ll;
using namespace std;
int main(){
  ll x,k,d; cin >> x >> k >> d;
  x = abs(x);

  ll ans = 0;

  ll n = x/d;
  if(x/d==1 && k%2==0 && x%d == 0){
    cout << x << endl;
    return 0;
  }


  if(k<=n) ans = x - d*k;
  else if((k-n)%2==1) ans =  abs(x-d*(n+1));
  else ans = x - d*n;

  cout << ans << endl;
}


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

int main() {
	string A, s, C;
	cin >> A >> s >> C;

	s = s.substr(0, 1);

	cout << "A" << s << "C" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
LL n,large=1000000007;
LL f(vector<LL>&d1,vector<LL>&d2){
if(d1.back()!=d2[0])return 0;
LL res=1;
for(LL i=1;i<n-1;i++){
LL tmp=0;
if(d1[i]>d1[i-1])tmp=1;
else tmp=d1[i];
if(d2[i]>d2[i+1]){if(tmp==1&&d2[i]!=d1[i])return 0;else if(d2[i]>d1[i]) return 0;tmp=1;}
else if(tmp==1&&d1[i]>d2[i])return 0;
else if(tmp!=1)tmp=min(tmp,d2[i]);
res=(res*tmp)%large;
}
return res;
}
int main(){
   while(cin>>n){
   vector<LL>d1(n),d2(n);
   for(int i=0;i<n;i++)cin>>d1[i];
   for(int i=0;i<n;i++)cin>>d2[i];
   cout<<f(d1,d2)<<endl;
}
    
}

Measured memory_bytes: 1920
#include<iostream>
#include<vector>
#include<cmath>
#include<cstdio>
using namespace std;

int main(){
	double a, m;
	int n, i;
	vector<double> s;
	cin >> n;
	while(n != 0){
		a = m = 0;
		s.reserve(n);
		for(i=0;i<n;i++){
			cin >> s[i];
			m += s[i];
		}
		m /= n;
		for(i=0;i<n;i++){
			a += (s[i] - m) * (s[i] - m);
		}
		a /= n;
		a = sqrt(a);
		printf("%.8f\n", a);
		cin >> n;
	}
	return 0;
}

Measured memory_bytes: 1248
#include "bits/stdc++.h"
#define MOD 1000000007
using namespace std;
int f[22][1<<21]={0},a[22][22];
int lowbit(int x)
{
    return x&(-x);
}
int count1(int num)
{
    int ret=0;
    while(num)
    {
	ret++;
	num-=lowbit(num);
    }
    return ret;
}
int main()
{
    int n,ans=0;
    int i,j,l,s,t;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
	for(j=1;j<=n;j++)
	{
	    scanf("%d",&a[i][j]);
	}	
    }
    f[0][0]=1;
    for(i=1;i<=n;i++)
    {
 	s=(1<<i)-1;
	t=s<<(n-i);
	for(j=s;j<=t;j++)
 	{
	    if(count1(j)!=i)
	    {
		continue;
	    }
	    for(l=0;l<=n-1;l++)
	    {
		if(!(j&(1<<l)))
		{
		    continue;
		}
		if(!a[i][n-l])
		{
		    continue;
		}
		f[i][j]=(f[i][j]+f[i-1][(1<<l)^j])%MOD;
	    }
	}
    }
    printf("%d\n",f[n][(1<<n)-1]);
    return 0;
}

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

const int64_t MOD = 1000000007;
typedef int64_t ll;
typedef uint64_t ull;

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  uint64_t g = gcd(m,n);
  if(m%g==0) return (m/g)*n;
  if(n%g==0) return (n/g)*m;
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

/* 
  //エラトステネスのふるい
  int maxNum = 100000;
  char isNotPrime[maxNum+1] = {};
  isNotPrime[0]=isNotPrime[1]=1;
  for(int i=2;i<maxNum;i++){
    if(isNotPrime[i]==1) continue;
    int num = i+i;
    while(num<=maxNum){
      isNotPrime[num]=1;
      num += i;
    }
  }
*/
// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

// 降順ソート vector<int> v;
// sort(v.begin(),v.end(),greater<int>());

// keyが降順ソートされるmap
// map<int, int, std::greater<int>> edges;

signed main() {
  int n;
  cin >> n;
  vector<int> cards(n);
  ll total = 0;
  for(int i=0;i<n;i++){
    cin >> cards[i];
    total += cards[i];
  }
  
  ll x = cards[0];
  ll y = total-cards[0];
  ll minD = abs(x-y);
  for(int i=1;i<n-1;i++){
    x += cards[i];
    y -= cards[i];
    minD = min(minD,abs(x-y));
  }
  cout << minD << endl;
  return 0;
}



Measured memory_bytes: 3976
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
typedef pair<int, int> PII;
typedef long long ll;
template<typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;


ll n, m, cnt, ans;
ll a[100005];
ll b[100005], c[100005];
vector <pair<ll, ll>> vec;
  
int main() {

	cin >> n >> m;
	rep(i, n)cin >> a[i];
	rep(i, m) {
		cin >> b[i] >> c[i];
	}

	rep(i, n)vec.push_back(make_pair(a[i], 1));
	rep(i, m)vec.push_back(make_pair(c[i], b[i]));

	sort(vec.begin(), vec.end());
	reverse(vec.begin(), vec.end());

	int i = 0;
	while (cnt < n) {
		while (cnt < n && vec[i].se > 0) {
			ans += vec[i].fi;
			vec[i].se--;
			cnt++;
		}
		i++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 8304
# include <bits/stdc++.h>
using namespace std;
void check(string s){
	int n = s.size();
	for(int i = 0; i < s.size(); i++){
		if(s[i] != s[n - i - 1]){
			cout << "No\n";
			exit(0);
		}
	}
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s;
	cin >> s;
	int n = s.size();
	check(s);
	check(s.substr(0, (n - 1) / 2));
	check(s.substr((n + 3) / 2 - 1));
	cout << "Yes\n";
}

Measured memory_bytes: 256
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#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> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

int main() {
    long long N,K;cin >> N >> K;
    vector<long long> retu(N);
    for(int i = 0;i<N;i++) cin >> retu.at(i);
    vector<long long> rui(N+1);
    rui.at(0) = 0;
    for(int i = 1;i<=N;i++){
        retu.at(i-1)--;
        rui.at(i) = (rui.at(i-1) + retu.at(i-1)) % K;
    }
    //for(int i = 0;i<=N;i++) cout << rui.at(i) << endl;
    //cout << endl;
    long long ans = 0;
    map<long long,long long> M;
    //Qは常にK-1個以下を管理する
    queue<int> Q;
    for(int i = 0;i<=N;i++){
        ans += M[rui.at(i)];
        Q.push(rui.at(i));
        M[rui.at(i)]++;
        //cout << ans << endl;
        if(Q.size() > K-1){
            int dele = Q.front();
            Q.pop();
            M[dele]--;
        }
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 16640
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.math.BigInteger;

public class Main {
//  ??¨?????????????????????
  static InputReader in;
  static PrintWriter out;
  
  static class Solution {
    void solve() throws IOException {
      int x = in.nextInt();
      out.println(x*x*x);
    }
  }

  public static void main(String[] args) throws IOException {
//    ??????
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
}

  static class InputReader {
//    ??\???
    public BufferedReader br;
    public StringTokenizer st;
    
    public InputReader(InputStream stream) {
//      ?????????????????????
      br = new BufferedReader(new InputStreamReader(stream));
    }
   
//    ????????????????????????
    public int nextInt() throws IOException {
      return Integer.parseInt(next());
    }
    
    public long nextLong() throws IOException {
      return Long.parseLong(next()); 
    }
    
    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }
    
    public double nextDouble() throws IOException {
      return Double.parseDouble(next());
    }
    
  }
  
}

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

#define debug(x) cout << (#x) << " is " << x << endl;
#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;

#define N 200005
vector<int> adj[N];
bool vis[N];

int bfs(int u){
	queue<int> qu;
	qu.push(u);
	vis[u] = 1;
	int ret=0;
	while(!qu.empty()){
		int x = qu.front();
		qu.pop();
		ret++;
		for(int v: adj[x]){
			if(vis[v] == 0){
				qu.push(v);
				vis[v] = 1;
			}
		}
	}
	return ret;
}

int main()
{
    int n, m;
    cin >> n >> m;
    while(m--){
		int x, y;
		cin >> x >> y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	int cnt = 0;
	for(int i=1; i<=n; i++){
		if(vis[i] == 0){
			cnt = max(cnt, bfs(i));
		}
	}
	cout << cnt << endl;
 
    return 0;
}


Measured memory_bytes: 15268
#include <iostream>
#include<bits/stdc++.h>
#define ll long long int
#define lld long double
#define F first
#define S second
#define f(i,a,b) for(int i=a;i<=b;i++)
#define g(i,a,b) for(int i=a;i>=b;i--)
#define mp make_pair
#define pb push_back
#define mh make_heap
#define ph push_heap
#define pq priority_queue
#define bits(x) __builtin_popcountll(x)
#define op(x) cout<<"Case #"<<x<<": "
using namespace std;
ll mod = 1000000007;
ll INF = 1000000000000000000;
ll n;
ll a[100001];

void solve(int t)
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	ll b[n];
	b[0] = 0;
	b[1] = abs(a[1] - a[0]);
	for (int i = 2; i < n; i++)
	{
		b[i] = min(abs(a[i - 1] - a[i]) + b[i - 1], abs(a[i - 2] - a[i]) + b[i - 2]);
	}
	cout << b[n - 1] << endl;


}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
/*
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
*/
	int t = 1;
	//cin >> t;

	for (int i = 1; i <= t; i++)
	{
		solve(i);
	}
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
	int n;
	cin >> n;
	if (n%2)
	{
		printf("%.10f\n", (n/2+1)*1.0/n);
	}
	else
	{
		printf("%.10f\n", (n/2)*1.0/n);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
#define int int64_t
#define itn int
#define fi first
#define se second
vector<int> v[20];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x;
  cin>>x;
  if(x>=30) cout<<"Yes\n";
  else cout<<"No\n";
}


Measured memory_bytes: 3652
#include<stdio.h>

int main()
{
    int a,b,c;
    scanf("%d%d%d", &a, &b, &c);
    if(a!=b&&a!=c)
    printf("%d",a);
    else if(b!=a&&b!=c)
    printf("%d",b);
    else if(c!=a&&c!=b)
        printf("%d",c);
    return 0;

}


Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int n,m,i;
	
	while(scanf("%d",&n),n){
		
		char data[10000000],afch[200]={0};
		bool bech[200]={0};
		char temp,str[5];
		
		for(i=0;i<n;i++){
			scanf("%s",str);
			temp=str[0];
			bech[temp-48]=1;
			scanf("%s",str);
			afch[temp-48]=str[0];
		}
		
		scanf("%d",&m);
		
		for(i=0;i<m;i++){
			scanf("%s",str);
			data[i]=str[0];
		}
		for(i=0;i<m;i++){
			if(bech[data[i]-48]==1)printf("%c",afch[data[i]-48]);
			else printf("%c",data[i]);
		}
		puts("");
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    string s;
    cin >> s;
    set<char> st;
    rep(i, s.length()) {
        st.insert(s[i]);
    }
    if ( st.size() == s.length() ) cout << "yes" << endl;
    else                          cout << "no" << endl;
    return 0;
}


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

using namespace std;

const int MAXN = 302;

int n;
double dp[MAXN][MAXN][MAXN];
bool vis[MAXN][MAXN][MAXN];

double solve(int x, int y, int z) {
  if(vis[x][y][z])
    return dp[x][y][z];
  vis[x][y][z] = 1;

  if(!x && !y && !z)
    return dp[x][y][z] = 0;

  int total = x + y + z;
  dp[x][y][z] = (double)(n - total)/total;

  if (x) dp[x][y][z] += x*((solve(x-1, y, z)+1)/total);
  if (y) dp[x][y][z] += y*((solve(x+1, y-1, z)+1)/total);
  if (z) dp[x][y][z] += z*((solve(x, y+1, z-1)+1)/total);
  return dp[x][y][z];
}

int main() {
  int a[4] = {0,0,0,0};
  cin >> n;
  for(int i=1; i<=n; ++i) {
    int x;
    cin >> x;
    ++a[x];
  }
  cout.precision(10);
  cout << solve(a[1],a[2],a[3]);
  return 0;
}


Measured memory_bytes: 242048
/*input
1729
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=4e3+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=3.14159265358979323846;
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define MP make_pair
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
int c[maxn][maxn];
int main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int s;
    cin>>s;
    c[0][0]=1;
    REP1(i,maxn-1){
        c[i][0]=1;
        REP1(j,i){
            c[i][j]=(c[i-1][j]+c[i-1][j-1])%MOD;
        }
    }
    ll ans=0;
    REP1(i,s/3){
        ans+=c[s-i*3+i-1][s-i*3];
        ans%=MOD;
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 48952
n = int(input())
ans = []
def dfs(x):
    if len(x) == n:
        print(''.join(map(lambda i: chr(ord('a') + i - 1), x)))
        return
    for i in range(max(x)+1):
        y = x.copy()
        y.append(i+1)
        dfs(y)
dfs([1])



Measured memory_bytes: 4404
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

const ll INF = 1LL << 60;

int main(){
  ll n; int k; cin >> n >> k;
  if(k == 0){
    std::cout << n*n << '\n';
    return 0;
  }
  ll ans = 0;
  for (int b = 1; b <= n; b++) {
    //std::cout << ans << '\n';
    if(b <= k) continue;
    int cnt = n/b;
    ans += (b-k)*cnt;
    int num = n%b;
    ans += max(num+1-k, 0);
  }

  std::cout << ans << '\n';
}


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

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    
    rep(i, tx - sx) cout << 'R';
    rep(i, ty - sy) cout << 'U';
    rep(i, tx - sx) cout << 'L';
    rep(i, ty - sy) cout << 'D';
    cout << 'D';
    rep(i, (tx + 1) - sx) cout << 'R';
    rep(i, ty - (sy - 1)) cout << 'U';
    cout << 'L';
    cout << 'U';
    rep(i, tx - (sx - 1)) cout << 'L';
    rep(i, (ty + 1) - sy) cout << 'D';
    cout << 'R';
    cout << endl;
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i,n){
    cin >> s.at(i);
  }
  sort(s.begin(),s.end());
  s.erase(unique(s.begin(),s.end()),s.end());
  cout << s.size() << endl;

}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;

#define rep(a,n) for(ll a = 0;a < n;a++)

static const ll INF = 1e18;
static const ll mod = 1e9+7;

template<typename T>
static inline void chmin(T& ref, const T  value) {
    if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T& ref, const T value) {
    if (ref < value) ref = value;
}

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

ll inv_mod(ll a) { return mpow(a, mod - 2); }

class Factorial {
public:
    ll cmb(ll a, ll b) {
        if (a == 0 && b == 0) return 1;
        if (a < b || a < 0 || b < 0) return 0;
        ll c = 1;
        for (int i = a,j=1; i > a - b; i--,j++) {
            c *= i;
            c /= j;
        }
        return c;
    }
};

int main() {
    ll n, m;
    cin >> n >> m;
    vector<vector<int>> graph(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    vector<int> colors(n, -1);
    std::function<bool(int, int)> dfs = [&](int current, int color) {
        if (colors[current] >= 0) {
            if (colors[current] != color) {
                return false;
            }
            return true;
        }
        colors[current] = color;
        for (auto p : graph[current]) {
            if (!dfs(p, (color + 1) % 2)) {
                return false;
            }
        }
        return true;
    };
    if (!dfs(0, 0)) {
        cout << n * (n - 1) / 2 - m << endl;
        return 0;
    }
    ll white = 0, black = 0;
    for (int i = 0; i < n; i++) {
        if (colors[i])white++;
        else black++;
    }
    cout << white * black - m << endl;
    return 0;
}


Measured memory_bytes: 9556
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

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

    vector<int> dp(n, 0);
    dp[0] = 0;
    dp[1] = abs(h[1]-h[0]);
    for(int i=2;i<n;++i) {
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
    }

    cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
import java.io.*;
import java.util.*;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int M = in.i();

        UnionFind uf = new UnionFind(N);
        for (int i = 0; i < M; i++) {
            uf.unite(in.i() - 1, in.i() - 1);
        }
        int ans = -1;
        for (int i = 0; i < N; i++) {
            if (uf.isRoot(i)) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}

class UnionFind {
    private final int N;
    int[] parent;
    int[] rank;
    int[] size;

    UnionFind(int n) {
        N = n;
        parent = new int[N];
        Arrays.setAll(parent, i -> i);
        size = new int[N];
        Arrays.fill(size, 1);
        rank = new int[N];
    }

    boolean isRoot(int x) {
        return x == parent[x];
    }

    int root(int x) {
        return isRoot(x) ? x : (parent[x] = root(parent[x]));
    }

    boolean same(int x, int y){
        return root(x) == root(y);
    }

    int size(int x) {
        return size[root(x)];
    }

    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if (x != y) {
            if (rank[x] < rank[y]) {
                parent[x] = y;
                size[y] += size[x];
            } else {
                parent[y] = x;
                size[x] += size[y];
                if (rank[x] == rank[y]) {
                    rank[x]++;
                }
            }
        }
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    }

    public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }
}


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

int main(){
    int h, w;
    cin >> h >> w;
    int cnt = 0; char x;
    for (int i = 0; i < h * w; i++) {
        cin >> x;
        if (x == '#') cnt++;
    }
    if (cnt == h + w - 1) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
}

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

using ll = long long;
using p = pair<ll, ll>;
constexpr ll INF = 1LL << 62;

int main(void) {
  ll H, W, K;
  cin >> H >> W >> K;

  vector<string> map(H);

  for (auto&& m : map) {
    cin >> m;
  }

  ll ans = 0;
  
  for (ll s = 0; s < (1 << H); s++) {
    for (ll t = 0; t < (1 << W); t++) {
      auto clone = map;
      for (ll h = 0; h < H; h++) {
        for (ll w = 0; w < W; w++) {
          if (((1 << h) & s) || ((1 << w) & t)) {
            clone[h][w] = '.';
          }
        }
      }

      ll cnt = 0;
      for (auto column : clone) {
        for (auto c : column) {
          if (c == '#') {
            cnt++;
          }
        }
      }

      if (cnt == K) {
        ans++;
      }
    }
  }

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

Measured memory_bytes: 3632
n,x = map(int,input().split())
p=[1]
s=[1]
for i in range(50):
    p.append(p[i]*2+1)
    s.append(s[i]*2+3)

def burger(n,x):
    if n ==0:
        return 1
    elif x == 1:
        return 0
    elif x<=1+s[n-1]:
        return burger(n-1,x-1)
    elif x == 2+s[n-1]:
        return p[n-1] + 1
    elif x <= 2 + s[n-1] * 2:
        return p[n-1] + 1 + burger(n-1,x-s[n-1]-2)
    elif x <= 3 + s[n-1] * 2:
        return 1 + p[n-1] * 2
    else:
        print("ERROR")

print(burger(n,x))

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

int n;
int a[80010];
int dp[80010][11];

int main()
{
	string s;
	while (cin >> s, s != "0"){
		n = s.size();
		for (int i = 0; i < s.size(); i++){
			a[i] = s[i] - '0';
		}
		
		fill_n(*dp, 80010 * 11, 0);
		for (int i = 0; i < n; i++){
			if (a[i]) dp[i + 1][a[i]] += 1;
			for (int j = 0; j < 11; j++){
				dp[i + 1][(j * 10 + a[i]) % 11] += dp[i][j];
			}
		}

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

		cout << res << endl;
	}
}

Measured memory_bytes: 6900
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define INF 1e9+7
#define roop(i,m,n) for(int i=m;i<n;i++)
#define mroop(i,m,n) for(int i=m;i<n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;

//(int)'a'は97 (int)'A'は65
//おまじない



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

	cout << a * a - b << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {


    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int N = Integer.parseInt(scan.next());

        if(N == 1)System.out.println("Hello World");
        if(N == 2){
            int A = Integer.parseInt(scan.next());
            int B = Integer.parseInt(scan.next());
            System.out.println(A + B);
        }
    }
}


Measured memory_bytes: 21844
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

def main():
  n = int(input())
  actions = numpy.array([[float(x) for x in input().strip().split()] for _ in range(n)]).T
  happiness = numpy.zeros((2, 3))
  for i in range(n):
    id = i%2
    happiness[id, 0] = max(happiness[id-1, 1]+actions[1, i], happiness[id-1, 2]+actions[2, i])
    happiness[id, 1] = max(happiness[id-1, 0]+actions[0, i], happiness[id-1, 2]+actions[2, i])
    happiness[id, 2] = max(happiness[id-1, 0]+actions[0, i], happiness[id-1, 1]+actions[1, i])
  print(int(max(happiness[(n-1)%2])))
  pass

if __name__=='__main__':
  main()

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

int main(){
  int a,b,c,sum = 0,i = 1;
  cin >> a >> b >> c;
  while(1){ 
    sum += a;
    if(i % 7 == 0){
      sum +=b;
    }
    if(sum >= c){
      break;
    }
    i++;
  }
  cout<<i<<endl;
  return 0;
}


Measured memory_bytes: 3120
#include<iostream>

using namespace std;

long long n,m,nd;

int main(void)
{
    cin>>n>>m;

    nd=2*n;

    if(nd>m)
		cout<<m/2<<endl;
    else if(nd == m)
		cout<<n<<endl;
    else
	{
        m-=nd;
        m/=4;
        cout<<n+m<<endl;
    }
    return 0;
}

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

const int kCharNum = 26;

bool isAlphabet(char ch)
{
    return 0 <= ch-'A' && ch-'A' < kCharNum;
}

int main()
{
    char ch;
    int charCount[kCharNum] = {0};
    while (cin >> ch)
    {
        if (islower(ch))    ch = toupper(ch);
        if (isAlphabet(ch))
        {
            charCount[ch-'A']++;
        }
    }
    
    for (int i=0; i<kCharNum; ++i)
    {
        cout << static_cast<char>('a'+i) << " : " << charCount[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1144
#include <stdio.h>
#define MAX 500000
#define INFTY 2000000000

void mergesort(int *,int,int);
void merge(int *,int,int,int);

int L[MAX/2+2],R[MAX/2+2];
int count;
int array[MAX];

int main()
{

  int n,i;
  count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&array[i]);
  }

  mergesort(array,0,n);

  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    printf("%d",array[i]);
  }
  printf("\n");
  printf("%d\n",count);

  return 0;
}



void mergesort(int array[],int left,int right)
{
  int mdl;
  if(left+1<right){
    mdl=(left+right)/2;
    mergesort(array,left,mdl);
    mergesort(array,mdl,right);
    merge(array,left,mdl,right);
  }
}

void merge(int array[],int left,int mdl,int right)
{
  int i,j,k,n1,n2;
  n1=mdl-left;
  n2=right-mdl;
  for(i=0;i<n1;i++) L[i]=array[left+i];
  for(i=0;i<n2;i++) R[i]=array[mdl+i];
  L[n1]=INFTY;
  R[n2]=INFTY;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    count++;
    if(L[i]<=R[j]){
      array[k]=L[i];
      i=i+1;
    }
    else {
      array[k]=R[j];
      j=j+1;
    }
  }
}

Measured memory_bytes: 4504
//
// Created by 李青坪 on 2018/11/28.
//

#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>

#define EPSLON 1e-10
#define equals(a, b) (fabs((a) - (b)) < EPSLON)

#define MAXN 10000
#define NIL -1
using namespace std;

// 点
class Point {
public:
    double x;
    double y;

    Point() {}

    Point(double x, double y) : x(x), y(y) {}

    Point operator+(Point a) {
        return Point(x + a.x, y + a.y);
    }

    Point operator-(Point a) {
        return Point(x - a.x, y - a.y);
    }

    Point operator*(double a) {
        return Point(x * a, y * a);
    }

    Point operator/(double a) {
        return Point(x / a, y / a);
    }

    double norm() {
        return x * x + y * y;
    }

    double absVector() {
        return sqrt(norm());
    }

    bool operator==(Point &a) const {
        return equals(x, a.x) && equals(y, a.y);
    }
};

typedef Point Vector;

// 线段
class Segment {
public:
    Point a, b;
};

double dot(Vector a, Vector b) {
    return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
    return a.x * b.y - a.y * b.x;
}

Point projection(Segment s, Point point) {
    Vector base = s.b - s.a;
    double t = dot(point - s.a, base) / base.absVector();
    double r = t / base.absVector();
    Point x = s.a + base * r;
    return x;
}

int n;


int main() {
    Segment s;
    Point p[2];
    scanf("%lf %lf %lf %lf", &p[0].x, &p[0].y, &p[1].x, &p[1].y);
    s.a = p[0];
    s.b = p[1];
    scanf("%d", &n);
    Point point;
    for (int i = 0; i < n; ++i) {
        double x, y;
        scanf("%lf %lf", &x, &y);
        point = Point(x, y);
        Point re = projection(s, point);
        printf("%.10f %.10f\n", re.x, re.y);
    }
}


Measured memory_bytes: 2744
package main

import (
	"fmt"
)

func main() {

	var N, count int
	var counts []int
	fmt.Scan(&N)

	var Hi = make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&Hi[i])
	}

	prev := 0

	for _, H := range Hi {
		if H > prev {
			counts = append(counts, count)
			count = 0
			prev = H
			continue
		}
		count++
		prev = H
	}
	counts = append(counts, count)
	fmt.Println(max(counts))
}

func max(a []int) int {
	max := a[0]
	for _, i := range a {
		if i > max {
			max = i
		}
	}
	return max
}


Measured memory_bytes: 6272
N, A, B = map(int, input().split())

if (B - A) % 2 == 0:
    ans = (B - A) // 2
else:
    ans = min(A - 1 + (B - (A - 1)) // 2, N - B + 1 + (B - A - 1) // 2)

print(int(ans))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

int main() {
    lint n, k;
    cin >> n >> k;
    lint ans;
    if (k % 2 == 0) {
        // x:偶数、y:奇数
        lint x = n / k;
        lint y = n / (k / 2) - x;
        ans = x * x * x + y * y * y;
    } else {
        lint x = n / k;
        ans = x * x * x;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
const int MAXM = 200010;

struct Edge {
	int u, v;

	Edge() {}
	Edge(int u, int v):u(u), v(v) {}
}E[MAXM];

vector<int>to[MAXN];

int n, m, Mark[MAXN];
bitset<MAXN>vis;
bool G1[MAXN][MAXN];
bool G2[MAXN][MAXN];

inline void dfs1(int x, int st) {
	G1[st][x] = 1, vis.set(x);
	for(auto u : to[x]) if(!vis[u]) dfs1(u, st);
}

inline void dfs2(int x, int col, int k, int st) {
	if(k) G2[st][x] = Mark[x] != col;
	else Mark[x] = col; vis.set(x);
	for(auto u : to[x]) if(!vis[u]) dfs2(u, col, k, st);
}

int main() {
	cin >> n >> m;
	for(int i = 1, u, v; i <= m; i++) {
		cin >> u >> v;
		to[u].push_back(v);
		E[i] = Edge(u, v);
	}
	for(int i = 1; i <= n; i++) vis.reset(), dfs1(i, i);
	for(int i = 1; i <= n; i++) {
		vis.reset(), vis.set(i);
		memset(Mark, 0, sizeof(Mark));
		int d = to[i].size();
		for(int j = 0; j < d; j++) if(!vis[to[i][j]]) dfs2(to[i][j], j + 1, 0, i);
		vis.reset(), vis.set(i);
		for(int j = d - 1; ~j; --j) if(!vis[to[i][j]]) dfs2(to[i][j], j + 1, 1, i);
	}
	for(int i = 1; i <= m; i++)
		puts(G1[E[i].v][E[i].u] ^ G2[E[i].u][E[i].v] ? "diff" : "same");
	return 0;
}

Measured memory_bytes: 6272
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    ll a,b,v,w,t;
    cin >> a >> v >> b >> w >> t;
    if(v<=w) {
        cout << "NO" << endl;
    } else if (abs(a-b) > t*(v-w)) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
}


Measured memory_bytes: 3652
n = int(input())
a = list(map(int, input().split()))

a.sort()
acum = [0] * (n+1)

# 累積和は0を含んだ0-basedの半開区間でかく(1-indexed)
for i in range(n):
    acum[i+1] += acum[i] + a[i]

ans = 1  # i = n-1 の時は必ず全て取り込めるので省いておく

for i in reversed(range(n-1)):
    if a[i+1] <= 2 * acum[i+1]:
        ans += 1
    else:
        break

print(ans)


Measured memory_bytes: 14320
import java.util.Scanner;

public class Main{

	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);

		int a = Integer.parseInt(scanner.next());
		int b = Integer.parseInt(scanner.next());
		scanner.close();

		int res = 0;

		if(a < b){
			res += b;
			b--;
		}else{
			res+= a;
			a--;
		}

		if(a < b){
			res += b;
		}else{
			res += a;
		}

		System.out.println(res);
	}
}


Measured memory_bytes: 23764
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

int main() {
    int X;
    cin >> X;
    if(X >= 30)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {
  ll n;
  cin >> n;
  vll a(n);
  rep(i,n) cin >> a.at(i);
  sort(a.begin(),a.end());
  vll b(n);
  rep(i,n) cin >> b.at(i);
  sort(b.begin(),b.end());
  vll c(n);
  rep(i,n) cin >> c.at(i);
  sort(c.begin(),c.end());
  ll ans = 0;
  rep(i,n) {
    ll second = b[i];
    ll first = lower_bound(a.begin(),a.end(),second)-a.begin();
    ll third = n-(upper_bound(c.begin(),c.end(),second)-c.begin());
    ans += first*third;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2560