akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T iabs(const T& x) { return max(x, -x); }
// #define abs gabs

int main() {
    int a, b;
    cin >> a >> b;
    vector<string> s(40);
    for (int i = 0; i < 40; ++i) {
        s[i] = string(100, i < 20 ? '#' : '.');
    }

    for (int k = 0; k < 2; ++k) {
        for (int c = 0; c < (k == 0 ? a : b) - 1; ++c) {
            int i = c / 50 * 2 + (k == 1 ? 21 : 0), j = c % 50 * 2;
            s[i][j] = k == 0 ? '.' : '#';
        }
    }

    cout << "40 100\n";
    for (auto t : s) cout << t << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
    int n, m;
    cin >> n >> m;
    pint p[m];
    // 終端でsort
    rep (i, 0, m) cin >> p[i].second >> p[i].first;
    sort (p, p + m);
    int ans = 0, end = 0;
    // 始まる時間が最後の終わる時間より遅ければ＋１する
    rep (i, 0, m) {
        if (p[i].second >= end) {
            end = p[i].first;
            ans++;
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 4372
N = int(input())
a_list = list(map(int,input().split()))
counter = 0

i = 0

while True:
    i = 0
    for w in a_list:

        if a_list[i] % 2 == 1:
            
            break
        else :
            a_list[i] = w / 2
            i += 1
    if N != i:
        break
    else:
        counter += 1
print(counter)


Measured memory_bytes: 2940
#include<cstdio>
#include<cstring>
int main() {
	char s[5];
	scanf("%s",s);
	int len = strlen(s);
	if(len == 2) {
		printf("%s",s);
	}
	else {
		printf("%c%c%c",s[2],s[1],s[0]);
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

struct mint {
    LL x; // typedef long long LL;
    mint(LL x=0):x( x >= 0 ? x%mod : x%mod+mod){}
    mint& operator+=(const mint a) {
      if ((x += a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator-=(const mint a) {
      if ((x += mod-a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator*=(const mint a) {
      (x *= a.x) %= mod;
      return *this;
    }
    mint operator+(const mint a) const {
      mint res(*this);
      return res+=a;
    }
    mint operator-(const mint a) const {
      mint res(*this);
      return res-=a;
    }
    mint operator*(const mint a) const {
      mint res(*this);
      return res*=a;
    }
    mint pow(LL t) const {
      if (!t) return 1;
      mint a = pow(t>>1);
      a *= a;
      if (t&1) a *= *this;
      return a;
    }
   
    // for prime mod
    mint inv() const {
      return pow(mod-2);
    }
    mint& operator/=(const mint a) {
      return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
      mint res(*this);
      return res/=a;
    }
  };

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int N; cin >> N;
    VL C(N);
    REP(i,N){
        cin >> C[i];
    }
    sort(C.begin(),C.end());
    mint ans = 0;
    mint four = 4, two = 2;
    REP(i,N){
        mint tmp = four.pow(i) * 2 * two.pow(N-1-i) * C[i];
        if(N-2-i == -1){
            ans += tmp;
        }else{
            ans += tmp * two.pow(N-2-i) * (N+1-i);
        }
    }
    cout << ans.x << endl;

}


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

int main()
{
	string s;
    cin>>s;
    
    int q;
    cin>>q;
    
    int cntrev=0;
    string front,back;
    for(int i=0;i<q;i++)
    {
		int t;
        cin>>t;
        
        if(t==1) cntrev++;
        else 
        {
            int f;
            cin>>f;
            char c;
            cin>>c;
            if(f==1)
            {
                if(cntrev%2==0)
                    front=c+front;
                else
                {
                    back=back+c;
                }
                
            }
            else
            {
                if(cntrev%2==0)
                	back=back+c;
                else
                {
                    front=c+front;
                }
            }
        }
    }
    if(cntrev%2==1)
    {
        reverse(s.begin(),s.end());
        reverse(front.begin(),front.end());
        reverse(back.begin(),back.end());
        
        s=back+s+front;
    }
    else
    {
        s=front+s+back;
    }
    
    cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 1512
#include<bits//stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n;i++)
int main() {
	string s;cin >> s;bool n = false, S = false, w = false, e = false;
	rep(i, s.size()) {
		if (s[i] == 'N') n = true;
		else if (s[i] == 'S') S = true;
		else if (s[i] == 'W') w = true;
		else e = true;
	}
	if (n == S) n = true;
	else n = false;
	if (w == e) w = true;
	else w = false;
	if (n && w) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

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

    if(a[a.size()-1] == b[0] && b[b.size()-1] == c[0]){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
    
}

Measured memory_bytes: 3620
N = int(raw_input())
A = map(int, raw_input().split())
A = list(sorted(A))

haves = [0] * (len(A) + 1)
for aa in xrange(max(A)+1):
    w = max(max(A) - aa, aa)
    haves[w] += 1

QQ = [0] * (len(A)+1)
for q in A:
    QQ[q] += 1 

Z = [QQ[x] - haves[x] for x in xrange(len(A)+1)]
if min(Z) < 0: print "Impossible"
else:

    waiting = [0] * (len(A) + 1)
    for z in reversed(xrange(len(A))):
        aa = A[z]
        if haves[aa] > 0:
            haves[aa]-=1
        else:
            waiting[aa] += 1



    for a in xrange(len(waiting)):
        if waiting[a] > 0:
            break

    if max(A) % 2 == 0:
        if a <= max(A) / 2:
            print "Impossible"
        else: print "Possible"
    else:
        if a <= (max(A)+1)/2:
            print "Impossible"
        else: print "Possible"



Measured memory_bytes: 2696
import math

n, m = map(int, input().split())

if (abs(n-m) >= 2):
    print(0)
    exit()
elif(abs(n-m) == 1):
    print(math.factorial(n)*math.factorial(m)%(10**9+7))
else:
    print(2*math.factorial(n)*math.factorial(m)%(10**9+7))

Measured memory_bytes: 5192
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define EQ(a,b) (abs((a)-(b))<EPS)
int n;
int p,ans=0;
vector<P> a;
int main()
{
	while(1)
	{
		a.clear();
		cin >> n;
		if(n==0)break;
		ans=0;
		for(int i=1;i<=n;i++)
		{
			cin >> p;
			if(i%2==1)
			{
				if(sz(a)==0)
				{
					a.pb(P(p,1));
				}
				else if(a[sz(a)-1].fi!=p)
				{
					a.pb(P(p,1));
				}
				else
				{
					a[sz(a)-1].sec++;
				}
			}
			else
			{
				if(a[sz(a)-1].fi!=p)
				{
					int k=a[sz(a)-1].sec+1;
					a.pop_back();
					if(a.empty())
					{
						a.pb(P(p,k));
					}
					else
					{
						a[sz(a)-1].sec+=k;
					}
				}
				else
				{
					a[sz(a)-1].sec++;
				}
			}
		}
		for(int i=0;i<sz(a);i++)
		{
			if(a[i].fi==0)ans+=a[i].sec;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
MOD1 = 10**9 + 7
MOD = 2 * MOD1
N = int(input())
A = list(map(int, input().split()))

S_n = 0
for a in A:
    S_n += a
    S_n %= MOD

a_i2 = 0
for a in A:
    a_i2 += a*a
    a_i2 %= MOD

d_ans = pow(S_n, 2 , MOD) - a_i2 + MOD
ans = (d_ans // 2) % MOD1
print(ans)

Measured memory_bytes: 31608
#include<bits/stdc++.h>
using namespace std;
int n,a[100002];
long long dp[3002][3002],s=0;
long long solve(int i,int j){
    if(i>j)
        return 0;
    if(dp[i][j]!=-1){
        return dp[i][j];
    }
    long long ans =-1;
    ans=max(a[i]+min(solve(i+2,j),solve(i+1,j-1)),a[j]+min(solve(i+1,j-1),solve(i,j-2)));
    dp[i][j]=ans;
    return ans;
}
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        s+=a[i];
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            dp[i][j]=-1;
        }
    }
    cout<<2*solve(1,n)-s;

}


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

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

const int INF = 1e9;

int main() {
  int n, m, a, b, ans = 0;
  cin >> n >> m;
  priority_queue<int> A;
  vector<int> B[100001];
  rep(i, n) cin >> a >> b, B[a].push_back(b);
  rep(i, m) {
    for (auto j : B[i + 1]) A.push(j);
    if (!A.empty()) ans += A.top(), A.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
int main(){
  string a,b,c;
  cin >> a >> b >> c;
  cout << char(a[0] + 'A'-'a') << char(b[0] + 'A'-'a') << char(c[0] + 'A'-'a') << endl;
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> s(3);
  for (int i = 0; i < 3; i++) {
    cin >> s.at(i);
  }
  sort(s.begin(), s.end());
  cout << s.at(0) + s.at(1) << endl;
  
  
  return 0;  
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define inf INT_MAX/3
#define INF INT_MAX/3
#define PB push_back
#define pb push_back
#define MP make_pair
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
#define all(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define PII pair<int,int>
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define in scanf
#define out printf
#define LL long long
#define ll long long
#define ULL unsigned long long
#define ull unsigned long long
#define eps 1e-14
#define FST first
#define SEC second

VI a;
int N;

int main(){

	cin >> N;
	int check[9] = {0,0,0,0,0,0,0,0,0};
	REP(i,N){
		int a;
		cin >> a;
		if(a >= 3200)
			check[8]++;
		else
			check[a/400]++;
	}
	int ans = 0;
	REP(i,8){
		if(check[i]!=0)
			ans++;
	}
//	int m = min(ans+check[8],8);
	cout << max(ans,1) << " " << ans+check[8];

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//Remove below header file if c++ version greater than 14
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
using namespace std;
#define ll long long int
#define pb push_back
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl '\n'
#define deb(x) cout << #x << " "<< x << endl;
#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)

const int inf = -1000;
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a /gcd(a, b) *b;
}
typedef pair<int,int> pii;
const int mod = 1e9+7;
int main() {

   int n,m;

   cin>>n>>m;
   int l=0,r = n;

   for(int i=0;i<m;++i){
    int L,R;
    cin>>L>>R;

    l = max(l,L);
    r = min(r,R);
   }

   cout<<(r>=l?r-l+1:0);




























    return 0;

      }


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>

using namespace std;

inline int calc(int Y, int M, int D)
{
    int day = 1;
    for (int y = Y; y < 1000; y++) {
        day += (y % 3 == 0) ? 200 : 195;
    }

    day -= D;
    for (int m = 1; m <= M - 1; m++) {
        day -= (Y % 3 == 0) ? 20 : (m % 2 == 1) ? 20 : 19;
    }
    return day;
}

int main()
{
    int n;
    cin >> n;
    for (int cnt = 0; cnt < n; cnt++) {
        int y, m, d;
        cin >> y >> m >> d;
        cout << calc(y, m, d) << endl;
    }
    return 0;
}

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1 + 4e3;
typedef long long LL;
typedef pair < int, int > II;
typedef pair < int, II > III;

string a, b, res;
int n, m, dp[MAXN][MAXN];
void trace(){
    while(dp[n][m] > 0){
        if (a[n] == b[m]){
            res += a[n];
            n--;
            m--;
            continue;
        }
        if (dp[n-1][m] == dp[n][m])n--;
        else m--;
    }
    reverse(res.begin() , res.end());
}

int main()
{
    #define TASK "ABC"
 //   freopen(TASK".inp","r",stdin);
//    freopen(TASK".out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> a >> b;
    n = a.size(), m = b.size();
    a = " " + a, b = " " + b;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
    {
        if (a[i] == b[j])dp[i][j] = dp[i-1][j-1] + 1;
        else dp[i][j] = max (dp[i-1][j] , dp[i][j-1]);
    }
    trace();
    cout << res << endl;

    return 0;
}




Measured memory_bytes: 47488
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
int main() 
{
    ll p;
    cin>>p;
    ll x=100,c=0;
    while(x<p)
    {
        x+=x/100;
        c++;
    }
    cout<<c;
}

    

Measured memory_bytes: 3612
#include<random>
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<bitset>
#include<utility>
#include<sstream>
#include<iomanip>
#include<ctime>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<fstream>

using namespace std;
typedef long long ll;
#define MP make_pair
#define mod 1000000007

int main(void) {
    int a,b;
    cin>>a>>b;
    a--;
    b--;
    cout<<(b+a-1)/a;
    
    
    return 0;
}

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

using namespace std;

const int N = 112;
const int C = 1103;

int n, c;
int l[N], q[N];
long long f[C][N];

long long solve();

int main() {
  scanf("%d%d", &n, &c);
  for (int i = 1; i <= n; ++i) scanf("%d", &l[i]);
  sort(l + 1, l + n + 1);
  for (int i = 1; i < n; ++i) q[i] = i;
  long double res = 0;
  do { 
    res += solve();
  } while (next_permutation(q + 1, q + n));
  for (int i = 1; i < n; ++i) 
    res /= i * c * 1.0;
  printf("%.12Lf\n", res);
  return 0;
}

long long solve() {
  memset(f, 0, sizeof(f));
  f[n * l[n]][0] = 1;
  for (int i = 0; i < n * c; ++i) {
    if (!(i % n)) continue;
    int x = q[i % n];
    for (int s = 0; s <= (1 << (n - 1)) - 1; ++s) {
      if (s & (1 << (x - 1))) continue;
      for (int j = i; j <= n * c; ++j) {
        f[min(n * c, max(j, i + n * l[x]))]
          [s | (1 << (x - 1))] += f[j][s];
      }
    }
  }
  return f[n * c][(1 << (n - 1)) - 1];
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  ll N;
  scanf("%lld",&N);
  vector<string> S(N);
  for(int i = 0 ; i < N ; i++){
    cin >> S[i];
  }
  for (int i=0; i<N; i++) {
    if (S[i]=="Y") {
      cout << "Four" << endl;
      return;
    }
  }
  cout << "Three" << endl;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll n,ans=0;
void Main(){
    cin>>n;
    if(n==2){
        cout<<2<<endl;
        return;
    }
    for(ll i=n;;i++){
        for(ll j=2;j<sqrt(i)+1;j++){
            if(i%j==0){
                goto end;
            }
        }
        cout<<i<<endl;
        return;
        end:;
    }
}
int main(){
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;

int main() {
  
  ll k, n;
  cin >> k >> n;
  vec1 a(n);
  for(int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  vec1 tmp(n);
  int c = 0;
  for(int i = 0; i < n-1; i++) {
    if(a.at(i) == 0)c++;
    int t = i + 1;
    tmp.at(i) = a.at(t) - a.at(i);
  }
  if(c == 1) {
    tmp.at(n-1) = k - a.at(n-1);
  } else {
    tmp.at(n-1) = (k-a.at(n-1))+a.at(0);
  }
  sort(tmp.begin(),tmp.end());
  ll ans = 0;
  for(int i = 0; i < n-1; i++) {
    ans = ans + tmp.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  set<string> a;
  REP(i,3){
    string s;
    cin>>s;
    a.insert(s);
  }
  cout<<a.size()<<endl;
  return 0;
}


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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }

  int cnt = 0;
  for (int i = 0; i < n - 1; i++) {
    if (p[i] == i + 1) {
      swap(p[i], p[i + 1]);
      ++cnt;
    }
  }
  if (p[n - 1] == n) {
    ++cnt;
  }

  cout << cnt << endl;
}

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

  solve();
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define MOD 1000000007

int main() {
    int N; cin >> N;
    vector<int> A(N);
    int tmp;
    for (int i = 0; i < N; i++){
        cin >> tmp;
        if (tmp % 2 == N % 2) {
            cout << 0 << endl;
            return 0;
        }
        A[tmp] = A[tmp] + 1;
        if (A[tmp] > 2 || A[0] > 1) {
            cout << 0 << endl;
            return 0;
        }
    }
    ll ans = 1;
    for (int i = 0; i < N/2; i++) {
        ans *= 2;
        ans %= MOD;
    }
    cout << ans << endl;
}



Measured memory_bytes: 640
def main():
    mod=1000000007
    s=int(input())
    
    m=s*2
    inv=lambda x: pow(x,mod-2,mod)
    Fact=[1] #階乗
    for i in range(1,m+1):
        Fact.append(Fact[i-1]*i%mod)
    Finv=[0]*(m+1) #階乗の逆元
    Finv[-1]=inv(Fact[-1])
    for i in range(m-1,-1,-1):
        Finv[i]=Finv[i+1]*(i+1)%mod
    def comb(n,r):
        if n<r:
            return 0
        return Fact[n]*Finv[r]*Finv[n-r]%mod
    
    ans=0
    num=s//3
    for i in range(1,num+1):
        n=s-i*3
        ans+=comb(n+i-1,n)
        ans%=mod
    print(ans)
    
if __name__=='__main__':
    main()

Measured memory_bytes: 64712
#include <stdio.h>
#include <vector>

using namespace std;

struct Node{
	Node(){
		brother = parent = -1;
		height = depth = num_of_children = 0;
	}
	int parent,brother,depth,num_of_children,height;
	vector<int> children;
};

void calcDepth(Node nodes[],int root_id){
	for(int i = 0;i < nodes[root_id].num_of_children;i++){
		nodes[nodes[root_id].children[i]].depth = nodes[root_id].depth+1;
		calcDepth(nodes,nodes[root_id].children[i]);
	}
}

void calcHeight(Node nodes[],int height,int parent){
	nodes[parent].height = max(nodes[parent].height,height+1);
	if(nodes[parent].parent != -1) calcHeight(nodes,height+1,nodes[parent].parent);
}

int main(){
	int n,id,left_id,right_id,root_id;
	scanf("%d",&n);
	Node nodes[n];

	for(int i = 0; i < n; i++){
		scanf("%d %d %d",&id,&left_id,&right_id);
		if(left_id != -1){
			nodes[id].children.push_back(left_id);
			nodes[id].num_of_children++;
			nodes[left_id].parent = id;
		}
		if(right_id != -1){
			nodes[id].children.push_back(right_id);
			nodes[id].num_of_children++;
			nodes[right_id].parent = id;
		}
		if(left_id != -1 && right_id != -1){
			nodes[left_id].brother = right_id;
			nodes[right_id].brother = left_id;
		}
	}

	for(root_id = 0; root_id < n; root_id++){
		if(nodes[root_id].parent == -1) break;
	}

	if(n > 1){
		calcDepth(nodes,root_id);

		for(int i = 0; i < n; i++){
			if(nodes[i].num_of_children == 0) calcHeight(nodes,0,nodes[i].parent);
		}
	}

	for(int i = 0; i < n; i++){
		printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d,"
				,i,nodes[i].parent,nodes[i].brother,nodes[i].num_of_children,nodes[i].depth,nodes[i].height);
		if(nodes[i].parent == -1){
			printf(" root\n");
		}else if(nodes[i].num_of_children == 0){
			printf(" leaf\n");
		}else{
			printf(" internal node\n");
		}

	}
}



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

using namespace std;

struct WarshallFloyd {
    WarshallFloyd() {};

    WarshallFloyd(int n) : n(n) { init(); };

    const long long inf = 1001001001010001001ll;
    int n;
    bool NC = false;
    vector<vector<long long>> d;

    void init() {
        d = vector<vector<long long>>(n, vector<long long>(n, inf));
        for (int i = 0; i < n; ++i) d[i][i] = 0;
    }

    void add_edge(int u, int v, long long c) {
        d[u][v] = c;
    }

    bool build() {
        for (int k = 0; k < n; ++k) {
            for (int i = 0; i < n; ++i) {
                if (d[i][k] == inf) continue;
                for (int j = 0; j < n; ++j) {
                    if (d[k][j] == inf) continue;
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }

        bool f = false;
        for (int i = 0; i < n; ++i) {
            if (d[i][i] < 0) f = true;
        }

        return NC = f;
    }

    long long shortestPath(int u, int v) {
        return d[u][v];
    }
};

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

    auto wf = WarshallFloyd(n);
    for (int i = 0; i < m; ++i) {
        int u, v, c;
        cin >> u >> v >> c;

        wf.add_edge(u, v, c);
    }

    if (wf.build()) {
        cout << "NEGATIVE CYCLE" << endl;
        return 0;
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (wf.shortestPath(i, j) == wf.inf) {
                cout << "INF";
            } else {
                cout << wf.shortestPath(i, j);
            }
            cout << ((j + 1 == n) ? "\n" : " ");
        }
    }
}


Measured memory_bytes: 3236
a, b, m = gets.chomp.split(" ").map(&:to_i)
ai = gets.chomp.split(" ").map(&:to_i)
bi = gets.chomp.split(" ").map(&:to_i)
ans = ai.min + bi.min

m.times do
    x, y, c = gets.chomp.split(" ").map(&:to_i)
    ans = [ans, ai[x-1] + bi[y-1] - c].min
end

puts ans

Measured memory_bytes: 19996
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	int a[55],b[55];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		b[i]=a[i];
	}
	sort(b,b+n);
	int cnt=0;
	for(int i=0;i<n;i++){
		if(a[i]!=b[i])cnt++;
	}
	if(cnt>2)cout<<"NO\n";
	else cout<<"YES\n";
	return 0;
}  

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std; 

//しゃくとり方でとく//
int main(void){
 int N,K;

 char S[100050];
 vector<int> A;

 cin>>N>>K;
 cin>>S;

 int cnt=0;
 int now=0;

 for(int i=0; i<strlen(S);i++){
  if(S[i]==('1'-now)){
   cnt++;
  }
  else{
   now=1-now;
   A.push_back(cnt);
   cnt=1;
  }
 }
 A.push_back(cnt);          
 
 if(A.size()%2==0)A.push_back(0);
 
 int sum,left,right,ans,nextleft,nextright;
 sum=0;
 left=0;
 right=0;
 nextleft=0;
 nextright=0;
 ans=0;
 
 for(int i=0; i<A.size();i+=2){
  nextleft=i;
  nextright=min(i+2*K+1,(int)A.size());

  while(nextleft>left){
   sum-=A[left];
   left++;
  }
  while(nextright>right){
   sum+=A[right];
   right++;
  }
  ans=max(sum,ans);
 }

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

Measured memory_bytes: 1020
module Main where

import Control.Applicative
import Numeric
import Data.Char
import Data.List
import Data.Ord

main :: IO ()
main = do
  { l1 <- getLine
  ; l2 <- getLine
  ; let l1' = l1 ++ l1 
  ; if isInfixOf l2 l1' then putStrLn "Yes" else putStrLn "No"
  }

--

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn .unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""



Measured memory_bytes: 3776
a,b,c,d = map(int,input().split())


m1 = (a-1)//c
m2 = (a-1)//d
m3 = b//c
m4 = b//d


def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

m5 = c*d//gcd(max(c,d),min(c,d))

m6 = (a-1)//m5
m7 = b//m5

ans = (b-a+1)-((m3-m1)+(m4-m2)-(m7-m6))
print(ans)


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define Cout(n) cout<<(n)<<endl
#define INF 1000000000000000000LL

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;
typedef vector<string> vs;
const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

int main()
{
	ll n,c,a=0;
	cin >> n;
	rep(i,n){
		cin >> c;
		a^=c;
	}
	cout << (a?"No\n":"Yes\n");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
 
using namespace std;
 
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
 
typedef vector<int> vi;
typedef pair<int,int> pii;
 
int main(void) {
  int i,j,k;
  int n;
  while(1){
    cin>>n;
    if(n==0)break;
    string s;
    cin>>s;
    rep(i,n){
      string tmp;
      int len=s.size();
      rep(j,len){
	rep(k,len-j)
	  if(s[j+k]!=s[j+k+1]){
	    stack<int> st;
	    int a=k+1;
	    while(a){
	      st.push(a%10);
	      a/=10;
	    }
	    while(st.size()){
	      tmp+='0'+st.top();
	      st.pop();
	    }
	    tmp+=s[j];
	    j+=k;
	    break;
	  }
      }
      s=tmp;
    }
    cout<<s<<endl;
  }

}

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

class Hello
{
    static void Main()
    {
        var str = Console.ReadLine();
        int f=str.IndexOf('A');
        int l = str.LastIndexOf('Z');
        Console.WriteLine(str.Substring(f, (l - f)).Length+1);
    }
}



Measured memory_bytes: 3800
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProblemC
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());
            long alphabetNum = 26;
            long numPow = 1;
            long temp = 0;
            var firstNum = N % 26;
            
            var res = firstNum == 0 ? "z" : ((char)(firstNum + 96)).ToString();
            var resAsNum = new long[11];
            int i = 1;
            for (; i < 11; i++)
            {
                numPow *= 26;
                temp += numPow;
                if (N - temp <= 0)
                    break;
                else
                {
                    resAsNum[i] = ((N - temp - 1) / numPow) % alphabetNum;
                }
            }

            for (int j = 1; j < i; j++)
            {
                res = ((char)(resAsNum[j] + 97)).ToString() + res;
            }
            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 27348
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main()
{
  ll n;
  cin >> n;
  map<string, ll> m;
  ll ct = 0;
  for(int i = 0; i < n; i++)
  {
    string s;
    cin >> s;
    m[s]++;
    ct = max(ct, m[s]);
  }
  vector<string> v;
  for(auto i: m)
  {
    if(i.second == ct)
      v.push_back(i.first);
  }
  sort(v.begin(), v.end());
  
  for(auto i: v)
    cout << i << "\n";
    
  
  return 0;
}

Measured memory_bytes: 26868
##
N = int(input())
N_List = list(map(int,input().split()))
Four_List = [i for i in N_List if i % 4 == 0]
Two_List = [i for i in N_List if i % 2 == 0]
if len(Two_List)-len(Four_List) > 0:
    N = N - (len(Two_List) - len(Four_List)) + 1

if N // 2 <= len(Four_List):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 19940
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
using namespace std;
using ll = long long;
using itn = int;
const ll MOD = 1000000007;

int main() {

    int n;
    cin >> n;
    
    int tmp;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> tmp;
        a[i] = tmp - 1;
    }

    int cnt = 1, i = 0;
    while (cnt <= n + 1) {

        if (a[i] == 1) {
            cout << cnt << endl;
            return 0;
        }

        i = a[i];
        cnt ++;
    }
    
    cout << -1 << endl;
    return 0;

}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define MP(a,b) make_pair(a,b)
typedef long long LL;
typedef pair<int, int> PI;
typedef vector<int> VI;
const LL MOD = 1000000007LL;
int cnt[100000];
int main() {
	int N;
	cin >> N;
	rep(i, N) {
		int a;
		cin >> a;
		cnt[a]++;
	}
	int ans = 0;
	rep(i, 100000) {
		int sum = cnt[i];
		if (i > 0) sum += cnt[i - 1];
		if (i < 99999) sum += cnt[i + 1];
		ans = max(ans, sum);
	}
	cout << ans << endl;
}

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

int main() {
  /* 頂点を探索するときに使う(右, 下, 左, 上) */
  const int dx[4] = {1, 0, -1, 0};
  const int dy[4] = {0, 1, 0, -1};

  int h, w;
  int cw, ch;
  int dw, dh;
  std::cin >> h >> w >> ch >> cw >> dh >> dw;
  --cw, --ch, --dw, --dh; // 0-indexed

  std::vector<std::string> maze(h);
  for (int i = 0; i < h; ++i) std::cin >> maze[i];

  const int INF = 1e9;
  
  // 距離と状態を管理
  std::vector<std::vector<int>> dist(h, std::vector<int>(w, INF));
  std::deque<std::pair<int, int>> q;
  
  // スタート地点のノード
  q.push_front(std::make_pair(ch, cw)); 
  dist[ch][cw] = 0;

  while (!q.empty()) {
    std::pair<int, int> v = q.front(); q.pop_front();
    int ci = v.first;
    int cj = v.second;
    int d = dist[ci][cj]; // 現在頂点の始点からの距離

    /* コスト0で行ける頂点を探索 */
    for (int i = 0; i < 4; ++i) {
      int ci_next = ci + dy[i];
      int cj_next = cj + dx[i];
      if (cj_next < 0 || cj_next >= w) continue; // 横方向にはみ出てたらskip
      if (ci_next < 0 || ci_next >= h) continue; // 縦方向にはみ出てたらskip
      if (maze[ci_next][cj_next] == '#') continue; // 壁の場合はskip
      if (dist[ci_next][cj_next] <= d) continue; // 今見ている頂点と同じコスト以下ならskip
      dist[ci_next][cj_next] = d;
      q.push_front(std::make_pair(ci_next, cj_next));
    }

    // 5近傍を探索
    for (int di = -2; di <= 2; ++di) {
      for (int dj = -2; dj <= 2; ++dj) {
        int ci_next = ci + di;
        int cj_next = cj + dj;
        if (cj_next < 0 || cj_next >= w) continue; // 横方向にはみ出てたらskip
        if (ci_next < 0 || ci_next >= h) continue; // 縦方向にはみ出てたらskip
        if (maze[ci_next][cj_next] == '#') continue; // 壁の場合はskip
        if (dist[ci_next][cj_next] <= d+1) continue; // 今見ている頂点と同じコスト以下ならskip
        dist[ci_next][cj_next] = d+1;
        q.push_back(std::make_pair(ci_next, cj_next));
      }
    }
  }

 
  int ans = dist[dh][dw]; 
  if (ans == INF) ans = -1;

  std::cout << ans << std::endl << std::flush;

  return 0;
}


Measured memory_bytes: 9388
n, k, q = gets.split.map(&:to_i)
p = Array.new(n, 0)
for i in 0...q do
  a = gets.to_i
  p[a - 1] += 1
end
for j in 0...n do
  if k + p[j] - q > 0
    puts "Yes"
  else
    puts "No"
  end
end


Measured memory_bytes: 3196
#include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
typedef long long ll;
char s[100010];
int num[100010];
int L[100010];
int R[100010];
int main()
{
	//ios::sync_with_stdio(false);
    scanf("%s",s+1);
    int len=strlen(s+1);
    int pos=0;
    for(int i=1;i<=len;i++)
    {
    	if(s[i]=='R')
    		pos=i;
    	R[i]=pos;
	}
	pos=len;
	for(int i=len;i>=1;i--)
	{
        if(s[i]=='L')pos=i;
        L[i]=pos;
    }
	int step;
	for(int i=1;i<=len;i++)
	{
		if(s[i]=='L')
		{
			step=i-R[i];
			num[R[i]+step%2]++;
		}
		else
		{
			step=L[i]-i;
            num[L[i]-step%2]++;
		}
	}
	for(int i=1;i<=len;i++)
		printf("%d ",num[i]);
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> L(n);
  for(int i = 0;i < n;i++){
    cin >> L.at(i);
  }
  sort(L.begin(),L.end());
  int sum = 0;
  for(int i = 0;i < n-1;i++){
    sum += L.at(i);
  }
  if(L.at(n-1) < sum){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>

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

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

	ll x = n / (a + b);
	ll ans = 0;
	ans += x * a;
	ll y = n % (a + b);
	ans += min(a, y);

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
using namespace std;

#include <iomanip>
int main() {
//    cout << fixed << setprecision(6);
    int r, n;
    while (cin >> r >> n, r) {
        map<int, int> ma;
        ma[r] = ma[-r - 1] = 100;
        while (n--) {
            int xl, xr, h; cin >> xl >> xr >> h;
            for (int x = xl; x < xr; x++) {
                ma[x] = max(ma[x], h);
            }
        }
        double mi = 100;
        for (int x = 0; x <= r; x++) {
            double d = min({ma[x - 1], ma[x], ma[-x], ma[-x - 1]});
            d += r - sqrt(r * r - x * x);
            mi = min(mi, d);
        }
        cout << mi << endl;
    }
    return 0;
}


Measured memory_bytes: 3212
#include <algorithm>
#include <fstream>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

#include <cmath>
#include <climits>
#include <queue>

using namespace std;


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

    int count = 0;
    int i = 0;
    for(i = 0; i < s.size(); ++i){
        if(s[i] == '1'){
            ++count;
        }
        else{
            cout << s[i] << "\n";
            return 0;
        }

        if(count == k){
            cout << 1 << "\n";
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int f_dir[2][4] = {{-1, 0, 1, 0}, {0, 1, 0, -1}}; //↑→↓←
int e_dir[2][8] = {{-1, -1, -1, 0, 0, 1, 1, 1}, {-1, 0, 1, -1, 1, -1, 0, 1}};
bool is_in_field(int y, int x, int h, int w){
  return (y >= 0 && y < h && x >= 0 && x < w);
}

int dfs(int h, int w, int k, int n, vector<string> f){
  if(n == h + w){
    int ret = 0;
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
        if(f[i][j] == '#') ret++;
      }
    }
    return 1 * (ret == k);
  }
  int ret = 0;
  if(n < h){
    vector<string> s = f;
    ret += dfs(h, w, k, n+1, s);
    for(int j = 0; j < w; j++){
      s[n][j] = '.';
    }
    ret += dfs(h, w, k, n+1, s);
  }
  else{
    vector<string> s = f;
    ret += dfs(h, w, k, n+1, s);
    for(int i = 0; i < h; i++) s[i][n-h] = '.';
    ret += dfs(h, w, k, n+1, s);
  }
  return ret;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int h, w; cin >> h >> w;
  int k; cin >> k;
  vector<string> f(h);
  for(int i = 0; i < h; i++){
    cin >> f[i];
  }
  cout << dfs(h, w, k, 0, f) << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>//coded by Nurstan ^_^

#define ll long long
#define pb push_back

#define mp make_pair
#define lb lower_bound
#define ub upper_bound

#define all(x) x.begin(), x.end()
#define F first
#define S second

// fixed << setprecision
// next_permutation(a, a + n)
// set <int> :: iterator it = x.begin(); it != x.end(); it ++

using namespace std;

inline void boost(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}

int main(){
	boost();
	//freopen("input.txt", "r", stdin);
	//freopen("output.txtint n", "w", stdout);
	int a, b;
	cin >> a >> b;
	if(a == 0 || b == 0) {
		cout << "Zero";
		return 0;
	}
	if(a < 0 && b > 0) {
		cout << "Zero";
		return 0;
	} 
	if(a > 0 && b > 0) {
		cout << "Positive";
		return 0;
	}
	else {
		int sum = abs(b) - abs(a) + 1;
		if(sum % 2 == 0) {
			cout << "Positive";
			return 0;
		}	
		else {
			cout << "Negative";
			return 0;		
		}
	}
	exit(0);
}



Measured memory_bytes: 256
#pragma comment(linker,"/stack:16777216")
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=1;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define repr(a,n) for(int a=n-1;a>=0;a--)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

int main(){
	int n,m,p;
	cin>>n>>m>>p;
	cout<<(n+m-1)/m*p;
	return 0;
}

Measured memory_bytes: 3592
def factorint(n):
    d = dict()
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            c = 0
            while n % i == 0:
                c += 1
                n /= i
            d[i] = c
    if n != 1:
        d[n] = 1
    return d

n = int(input())
c = 0
for i, j in factorint(n).items():
    for k in range(j):
        if n % i ** (k + 1) == 0:
            n = n / i ** (k + 1)
            c += 1
        else:
            break
print(c)

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

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}

using namespace std;
// now

struct UnionFind {
    vector<int> d;
    UnionFind(int n=0) : d(n,-1){}
    int Find (int x){//根の番号を探す
        if(d[x] < 0) return x;
        return d[x] = Find(d[x]);
    }
    bool unite (int x, int y){
        x = Find(x); y = Find(y);
        if(x == y ) return false;
        if(d[x] < d[y]){
            swap(x,y);
        }
        d[x] += d[y];
        d[y] = x;
        return true;
    } 

    bool same(int x, int y){
        return Find(x) == Find(y);
    }
    int size(int x) {
        return (-d[Find(x)]);
    }
};


ll nCr (ll n, ll r){
    ll ans = 1;
    for(ll i = n ; i > n-r ; i --){
        ans *= i;
    }
    for(ll i = 1 ; i<= r; i ++){
        ans /= i;
    }
    return ans ;
}

int nPr (int n,int r){
    int ans = 1;
    for(int i = n ; i > n-r ; i --){
        ans *= i;
    }
    return ans ;
}
 ll modd = 1e9+ 7;
ll wa (ll n,ll mi, ll ma){
    ll ans  = n * (mi+ma) /2;
    return ans;
}
ll kw(ll k,ll n){
    
    ll ans  =0;
    ll mi,ma;
    mi= wa(k,0,k-1);
    
    ma = wa(k,n-k+1,n);
    
    return (ma-mi +1)%modd;
}

int main(){
    int x, n;
    cin  >> x >> n;
    if(n ==0){
        cout << x <<endl;
        return 0;
    }
    bool a[105];
    REP(i,105){
        a[i] = true;
    }
    int k,m=0;

    REP(i,n){
        cin >> k;
        m = max(m,k);
        a[k] = false;
    }
    int mii = INF,mi = INF;

    REP(i,m+2){
        if(a[i]){
            if(mi > abs(x-i)){
                mi = abs(x-i);
                mii = i;
            }
        }
    }

    
    cout << mii <<endl;
}





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

int main(){
    long long N;
    cin >> N;
    long long cp_N;
    if(N%2 == 0){
        cp_N = N - 1;
        N /= 2;
    }else{
        cp_N = N - 1;
        cp_N /= 2;
    }
    cout << N * cp_N << endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())

yp_dic={}
yplist=[]
for i in range(M):
  p,y=map(int,input().split())
  if p not in yp_dic:
    yp_dic[p]=[]
  yp_dic[p].append(y)
  yplist.append((y,p))

all_dic={}
for key in yp_dic:
  yp_dic[key].sort()
  for i,y in enumerate(yp_dic[key]):
    all_dic[y]=i+1

#print(all_dic)
for y,p in yplist:
  id="{:0>6}{:0>6}".format(p,all_dic[y])
  print(id)
  #print(y,p,all_dic[p][y])


Measured memory_bytes: 47296
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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



int main(void){

	int A, B; cin >> A >> B;

	cout << (A+B)%24 << endl;


	return 0;

}


Measured memory_bytes: 256