akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
int main( void ){
	// initialize();
	int H, W;
	cin >> H >> W;
	vector <vector <P <bool, ll> > > dp( H, vector <P <bool, ll> >( W, P <bool, ll>{false, 0} ));
	rep( i, 0, H ){
		rep( j, 0, W ){
			char input; cin >> input;
			dp[ i ][ j ].a = ( input == '.' );
		}
	}
	dp[0][0].b = 1;
	rep( i, 0, H ){
		rep( j, 0, W ){
			if (!dp[ i ][ j ].a)
				continue;
			if (i != 0 && dp[ i - 1 ][ j ].a)
				dp[ i ][ j ].b += dp[ i - 1 ][ j ].b;
			if (j != 0 && dp[ i ][ j - 1 ].a)
				dp[ i ][ j ].b += dp[ i ][ j - 1 ].b;
			dp[ i ][ j ].b %= k_mod;
		}
	}
	cout << dp[H-1][W-1].b << endl;
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


Measured memory_bytes: 15872
from collections import deque

S = input()

bs_idx = deque()
areas = []
for idx, s in enumerate(S):
    if s == "\\":
        bs_idx.append(idx)
    if s == "/":
        if bs_idx:
            left_idx = bs_idx.pop()
            areas.append([left_idx, idx - left_idx])

areas.sort()

if not areas:
    print(0)
    print(0)
else:
    ans = []
    i = 0
    while True:
        if i == len(areas):
            break
        area = areas[i][1]
        tmp = areas[i][0] + area
        while True:
            i += 1
            if i != len(areas) and areas[i][0] < tmp:
                area += areas[i][1]
            else:
                ans.append(area)
                break

    print(sum(ans))
    print(len(ans), " ".join(map(str, ans)))



Measured memory_bytes: 7088
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <iomanip>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define tle ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
const int mod = 998244353;
const int mxn = 2e5 +7;
int _,n,m,t,k,u,v,ans,cnt,ok,lim;
ll w[mxn] , cost[mxn] ,  far[mxn] , siz[mxn];
char ch;
#define lc now<<1
#define rc now<<1|1
string str ;
struct node {ll l,r,val,lazy,mx,mn;}p[mxn<<4];
int a[mxn];
int calc()
{

}
int main()
{tle;
    int Case = 1 ;
    cin>>str;
    int ans = count(str.begin(),str.end(),'0');
    cout<<min(ans , (int)str.size()-ans)*2<<endl;
}

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

int main () {
  int k;
  cin >> k;
  long long n=0,i=1,p=7;
  while(true){
    if(i==1000000){
      cout << -1 << endl;
      return 0;
    }
    n=(n+p)%k;
    p=(p*10)%k;
    if(n==0){
      cout << i << endl;
      return 0;
    }
    i++;
  }
}

Measured memory_bytes: 3616
o1=0
o2=0
oo1=0
oo2=0
w,h,n=map(int,input().split())
for i in range(n):
    x,y,a=map(int,input().split())
    if a==1:
        oo1=max(o1+x,oo1)
    elif a==2:
        w=min(x,w)
    elif a==3:
        oo2=max(o2+y,oo2)
    else:h=min(y,h)
if oo1>=w or oo2>=h:
    print(0)
else:print((w-oo1)*(h-oo2))

Measured memory_bytes: 3064
from math import *

N = int(input())
all_input_list = [list(map(int, input().split())) for i in range(N)]
x, y, h = [all_input_list[i] for i in range(N) if all_input_list[i][2] > 0][0]
for cx in range(101):
    for cy in range(101):
        H = h + abs(cx - x) + abs(cy - y)
        #変数を個別に格納しない方が、メモリ節約になる
        for input_list in all_input_list:
            if (input_list[2] != max(H - abs(cx - input_list[0]) - abs(cy - input_list[1]), 0)):
                break
        else:
            print("%s %s %s" % (cx, cy, H))
            exit()

Measured memory_bytes: 3064
N = int(input())
card = {}
for i in range(N):
  S = input()
  card[S] = card.get(S, 0) + 1
 
M = int(input())
for i in range(M):
  S = input()
  card[S] = card.get(S, 0) - 1

tmp = list(card.values())
tmp.append(0)
print(max(tmp))

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


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

    int cur(n), digitSum = 0;
    while(cur > 0){
        digitSum += cur%10;
        cur /= 10;
    }
    if(n % digitSum == 0) cout << "Yes\n";
    else cout << "No\n";
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
        #include<iostream>
        #include<algorithm>
        #include<set>
        #include<map>
        #include<math.h>
        //#include <ttmath.h>
        #define endl '\n'
        #define modulo 1000000007
        #define int long long
        #pragma GCC optimize("-Ofast")
        #define float double
        #define PI 3.141592653589793238462643
        #define sinDegrees(x) sin((x) * PI / 180.0)
        #define tanDegrees(x) tan((x) * PI / 180.0)
        #define atanDegrees(x) atan(x)* 180.0 / PI
        using namespace std;
        int power(int x,int y)
        {
        int temp;
        if(y == 0)
        return 1;
        temp = (power(x, y/2))%modulo;
        if (y%2 == 0)
        return ((temp%modulo)*temp)%modulo;
        else
        return ((x*temp%modulo)*temp)%modulo;
        }
        int inv(int x)
        {
        return (power(x,modulo-2)+modulo)%modulo;
        }
        /*#include "testlib.h"
        int main(int argc, char* argv[])
        {
        iostream::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        registerGen(argc, argv, 1);
        int n,k;
        n=rnd.next(1,50);
        k=rnd.next(1,n);
        cout<<n<<' '<<k;
        }*/
        bool comp(pair<int,int>a,pair<int,int> b)
        {
            return a.second>b.second;
        }
        int32_t main()
        {
            //freopen("output.txt","w", stdout);
            //freopen("input4.txt","r", stdin);
            iostream::sync_with_stdio(0);
            cin.tie(0);
            cout.tie(0);
            int n,maxer=INT_MIN,maxer2=INT_MIN;
            cin>>n;
            int arr[n];
            for(int i=0;i<n;i++){
            cin>>arr[i];
            if(arr[i]>maxer){
            maxer2=max(maxer2,maxer);
            maxer=arr[i];
            }
            else
            maxer2=max(maxer2,arr[i]);
            }
            for(int i=0;i<n;i++){
            if(arr[i]==maxer)
            cout<<maxer2<<endl;
            else
            cout<<maxer<<endl;
            }
            return 0;
        }


Measured memory_bytes: 3200
N,x=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
ans=0
k=0
for i in a:
        if k != N-1:
                if x >= i:
                        x-=i
                        ans+=1
                else:break
        elif x==i:ans+=1
        k+=1
print(ans)

Measured memory_bytes: 3064
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  l=['SUN','MON','TUE','WED','THU','FRI','SAT']
  s=S()
  t=l.index(s)
  return 7-t

# main()
print(main())


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

#define maxn 105
#define N 100000
#define inf (int) 2e9
#define ll long long
#define ii pair <int, int>
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define REP(i, a, b) for(int i = a; i >= b; i--)

int n, W;
int w[maxn], v[maxn];
ll f[N + 5];

int main() {
    //freopen("main.inp", "r", stdin);
    cin >> n >> W;
    FOR(i, 1, n)
        cin >> w[i] >> v[i];
    FOR(j, 1, N) f[j] = inf;
    FOR(i, 1, n)
       REP(j, N, v[i])
          f[j] = min(f[j], f[j - v[i]] + w[i]);
    int ans = 0;
    FOR(j, 0, N)
       if(f[j] <= W) ans = max(ans, j);
    cout << ans;
}


Measured memory_bytes: 4424
x = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input()) - 1
print(x[K])

Measured memory_bytes: 3060
function Main(input) {
	const list = input.split("\n");
	const parse = (input) => parseInt(input.trim(), 10);
	let cnt = 0;
	let ans = 'No';
	for(let i = 1; i <= parse(list[0]); i++){
		let D = list[i].split(" ");
		cnt = D[0] == D[1] ? cnt + 1 : 0;
		if(cnt === 3) {
			ans = 'Yes';
			break;
		}
	}
	console.log(ans);
};

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29660
n = int(input())
t = []
i = 0
for _ in range(n):
    x, y = map(int, input().split())
    if x == y:
        i += 1
    else:
        i = 0
    t.append(i)
if(len(list(filter(lambda x: x >= 3, t))) == 0):
    print("No")
else:
    print("Yes")


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n, k, q;
    cin >> n >> k >> q;

    vector<int> p(n, k);
    int c[n] = {};

    rep(i, q)
    {
        int a;
        cin >> a;
        c[--a]++;
    }

    rep(i, n)
    {
        p[i] -= (q - c[i]);
    }

    rep(i, n)
    {
        p[i] > 0 ? OP("Yes") : OP("No");
    }

    return 0;
}

Measured memory_bytes: 1408
//    https://youtu.be/zRIbf6JqkNc

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef long long unsigned llu;
typedef pair<long long, long long> pll;
const long long inf = 2000000000000000000LL;	// 2e18
#define pi                  acos(-1.0)
#define fast                ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define shesh               "\n"
#define ff                  first
#define ss                  second
#define pb                  push_back
#define bp                  pop_back
#define pf                  push_front
#define fp                  pop_front
#define ub                  upper_bound
#define lb                  lower_bound
#define all(x)              x.begin(), x.end()
#define debug(x)            cout<<"debug "<<x<<"\n"
#define mest(a,b)           memset(a,b,sizeof(a))

int main(){
    fast;
    ll t,n,m,i,j,k,temp,flag,ans;
    cin>>n>>k;
    ll a[n];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    for(i=0,ans=0;i<n-k;i++){
        ans+=a[i];
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 1792
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int score = 0;
    set<int> s;
    for(int i = 1; i <= n; i++){
        score += i;
        s.insert(i);
        if(score >= n){
            if(score != n) s.erase(score-n);
            break;
        }
    }
    for(auto p : s) cout << p << endl;
	return 0;
}

Measured memory_bytes: 512
!
! --------------------------------
PROGRAM SumofTwoIntegers
 IMPLICIT NONE
 INTEGER::N,a
 INTRINSIC MOD
 READ(*,*)N
  IF(MOD(N,2)==0)THEN
  a=(N-2)/2
  WRITE(*,*)a
  ELSE
  a=(N-1)/2
  WRITE(*,*)a
  END IF
END PROGRAM SumofTwoIntegers

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

int main(){ 
    int n;
    string s,t;
    cin >> n >> s >> t;
    string ans;
    rep(i,n){
        ans += s[i];
        ans += t[i];
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    long long s, i(1);
    scanf("%lld", &s);
    vector<long long> memo(1000100, -1);
    while(1){
        if(memo[s] >= 0)return 0 & printf("%lld", i);
        memo[s] = i;
        if(s & 1)s = 3 * s + 1;
        else s >>= 1;
        ++i;
    }
}

Measured memory_bytes: 8064
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
#define int lint
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(), (x).end()
#define pb push_back
int n, x;
vi len(51, INF);
vi pa(51, INF);
int length(int n)
{
    if (len[n] != INF)
    {
        return len[n];
    }
    if (n == 0)
    {
        return len[n] = 1;
    }
    return len[n] = 2 * length(n - 1) + 3;
}
int pati(int n)
{
    if (pa[n] != INF)
    {
        return pa[n];
    }
    if (n == 0)
    {
        return pa[n] = 1;
    }
    return pa[n] = 1 + pati(n - 1) * 2;
}
int solve(int n, int x)
{
    if (x == length(n))
    {
        return pati(n);
    }
    if (x == 1 || x == 0)
    {
        return 0;
    }
    if (x == length(n) / 2 + 1)
    {
        return solve(n - 1, length(n - 1)) + 1;
    }
    else if (x > length(n) / 2 + 1)
    {
        return +solve(n - 1, x - length(n) / 2 - 1) + solve(n - 1, length(n - 1)) + 1;
    }
    else
    {
        return solve(n - 1, x - 1);
    }
}

signed main()
{
    cin >> n >> x;
    int ans = solve(n, x);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>


using namespace std;

int main(){

    int A, B;
    cin >> A >> B;
    
    int ans = 0;
    
    for (int i = 0; i < 2; i++) {
        if (A >= B) {
            ans = ans + A;
            A = A - 1;
            
        }else{
            ans = ans + B;
            B = B - 1;
            
            
        }
    }
   
    cout << ans << endl;
    
    
    
    
    
    return 0;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


int main() {
  int N, K;
  string S;
  cin >> N >> K >> S;
  int a = 0;
  for (int i = 0; i + 1 < N; ++i) if (S[i] != S[i+1]) ++a;
  cout << N - 1 - max(a - K*2, 0) << endl;
}

Measured memory_bytes: 512
/*
 * cpp_filepath
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


void solve() {
  int n, m;
  cin >> n >> m;
  cout << (n-1)*(m-1) << endl;
}


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

int main() {
 int thp,tatk,ehp,eatk;
  cin >> thp >> tatk >> ehp >> eatk;
  bool t_death = false;
  bool e_death = false;
  while (true) {
    ehp -= tatk;
    if (ehp < 1) {
      e_death = true;
      break;
    }
      thp -= eatk;
      if (thp < 1) {
        t_death = true;
        break;
      }
  }
  if (e_death) {
    cout << "Yes" << endl;
  }
  if (t_death) {
    cout << "No" << endl;
  }
    
        
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n, d;
	cin >> n >> d;
	
	cout << (n + 2 * d) / (2 * d + 1) << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
#include <iomanip>
#include <climits>
#include <utility>
#include <queue>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

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

ll fact(ll n)
{
    if (n == 0)
    {
        return 1;
    }
    if (n == 1)
    {
        return 1;
    }
    return n * fact(n - 1) % MOD;
}

ll pow_fast(ll n, ll k)
{
    if (k == 0)
    {
        return 1;
    }
    if (k == 1)
    {
        return n;
    }

    if (k % 2 == 0)
    {
        ll tmp = pow_fast(n, k / 2LL);
        return tmp * tmp % MOD;
    }
    else
    {
        ll tmp = pow_fast(n, k / 2LL);
        tmp *= tmp;
        tmp %= MOD;
        return tmp * n % MOD;
    }
}

int main()
{
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,k;
	cin >> n >> k;
	if(n>k){
		cout << 0 << endl;
	}else{
		cout << 1 << endl;
	}
}


Measured memory_bytes: 3156
#include <iostream>
#include <string>
//#include <math.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
typedef long long ll;

/*
ll pow(ll a,ll n){
ll ret=1;
rep(i,n)ret=ret*a;
return ret;
}
*/
ll pow(ll x, ll n) { //x^n 計算量O(logn)
	ll ans = 1;
	while (n > 0) {
		if ((n & 1) == 1) {
			ans = ans * x;
		}
		x = x * x; //一周する度にx, x^2, x^4, x^8となる
		n >>= 1; //桁をずらす n = n >> 1
	}
	return ans;
}


int main()
{
	ll n ,p;cin >> n >> p;
	int ans;
	//cout<<pow(4 ,2)<<endl;

	if(n==1)
	{
		cout<<p<<endl;
		return 0;
	}
	if(n>41||p==1)
	{
		cout<<1<<endl;
		return 0;
	}
	if(n==39)
	{
		cout<<2<<endl;
		return 0;
	}
	
	/*
	if(n>p){
		cout<<1<<endl;
		return 0;
	}
	*/
	//rep(i,100)cout<<pow(i,2)<<endl;
	/*if(n==2)
	{
		for(int i=1;i*i<p;++i)if(p%(i*i)==0)ans=i;
		cout<<ans<<endl;
		return 0;

	}
	*/
//cout<<pow(2,2)<<endl;
	for(int i=1;p>=pow(i,n);i+=ans)
	{
		//cout<<pow(i,n)<<endl;
		if( ! ( p%pow(i,n) )  )
		{
			ans=i;
			i=ans;
		}
	
	//cout << i<<endl;
	}
	//cout<<pow(2,3)<<endl;
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

int main() {
  string str;
  int num = 0;
  int a = 0, b = 0, o = 0, ab = 0;
  while(cin >> num >> str) {
    if(str == ",A") {
      a++;
    }else if(str == ",B") {
      b++;
    }else if(str == ",O") {
      o++;
    }else if(str == ",AB") {
      ab++;
    }
  }

  cout << a << endl;
  cout << b << endl;
  cout << ab << endl;
  cout << o << endl;
  return 0;
}

Measured memory_bytes: 3016
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;


typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;


void solve(){
	int n;
	cin >>n;
	ll a[n];
	forn(i,0,n) cin >> a[i];
	ll b[n-1];
	b[0] = a[0]^a[1];
	for(int i =1;i<n-1;i++){
		b[i] = a[1]^a[i+1];
	}
	ll wholexor = 0;
	for(int i =0;i<n-1;i++)
		wholexor ^= b[i];

	for(int i =0;i<n;i++){
		cout << (wholexor^a[i]) << " ";
	}
	cout << endl;
}

int main(){
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	// int t;cin >> t;while(t--)
		solve();
}


Measured memory_bytes: 6676
import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
atoe = [a, b, c, d, e]
for _ in range(5):
    for i in range(4):
        if atoe[i]<atoe[i+1]:
            atoe[i+1] = atoe[i]

print(   math.ceil(n/min(atoe))+4    )

Measured memory_bytes: 3064
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *X = map(int, read().split())

    X = [(x, i) for i, x in enumerate(X)]

    X.sort()

    ans = [0] * N
    for i, (x, j) in enumerate(X):
        if i < N // 2:
            ans[j] = X[N // 2][0]
        else:
            ans[j] = X[N // 2 - 1][0]

    print(*ans, sep='\n')
    return


if __name__ == '__main__':
    main()


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

int main(){
  int n;
  cin >> n;
  vector<double> a(n);
  rep(i,n){
    cin >> a[i];
  }
  double ans = 0;
  rep(i,n){
    ans += 1/a[i];
  }
  double ans1 = 1/ans;
  
  printf("%.10f\n",ans1);
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int result = 100000;
	int n;

	cin >> n;

	for (int i = 0; i < n; ++i) {
		result += (result * 5) / 100;
		if (result % 1000) {
			result -= result % 1000;
			result += 1000;
		}
	}

	cout << result << endl;
	return 0;
}

Measured memory_bytes: 1160
//Zory-2018
//*******************头文件*******************
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
//*******************全局常量*******************
const int MAXN=210000;
//*******************全局定义*******************
ll q[MAXN],w[MAXN];
ll bin[35];
int n;
//*******************实现*******************
int f;
bool cmp(ll a,ll b)
{
	return (a%bin[f+1])<(b%bin[f+1]);
}
ll w2[MAXN];
int find1(ll d)//第一个>=d的
{
	if(d<0) return 1;
	if(d>w2[n]) return n+1;
	
	int l=1,r=n,ans=-1;
	while(l<=r)
	{
		int mid=(l+r)>>1;
		if(w2[mid]>=d) ans=mid,r=mid-1;
		else l=mid+1;
	}
	if(ans<0) return n+1;
	return ans;
}
int find2(ll d)//最后一个<=d的
{
	if(d<0) return 0;
	if(d>w2[n]) return n;
	
	int l=1,r=n,ans=-1;
	while(l<=r)
	{
		int mid=(l+r)>>1;
		if(w2[mid]<=d) ans=mid,l=mid+1;
		else r=mid-1;
	}
	if(ans<0) return 0;
	return ans;
}
//*******************主函数*******************
int main()
{
	bin[0]=1;for(int i=1;i<=32;i++) bin[i]=bin[i-1]<<1;
	
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&q[i]);
	for(int i=1;i<=n;i++) scanf("%lld",&w[i]);
	
	ll ans=0;
	for(f=0;f<=29;f++)
	{
		for(int i=1;i<=n;i++) w2[i]=w[i]%bin[f+1];sort(w2+1,w2+1+n);
		//sort(w+1,w+1+n,cmp);
		
		ll t=0;
		for(int i=1;i<=n;i++)
		{
			ll now=q[i]%bin[f+1],ss=0;
			ll l,r;
			int bf;
			
			l=bin[f];r=bin[f+1]-1;
			l=find1(l-now);r=find2(r-now);
			bf=r-l+1;if(bf>0) ss+=bf;
			
			l=bin[f+1]+bin[f];r=bin[f+2]-1;
			l=find1(l-now);r=find2(r-now);
			bf=r-l+1;if(bf>0) ss+=bf;
			
			t=(t+ (ss&1) )&1;
		}
		ans+=(t<<f);
	}
	printf("%lld",ans);
}


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

int main() {

	int N, K;
	cin >> N >> K;
	multiset<int> P;
	for (int i = 0; i < N; i++) {
		int p;
		cin >> p;
		P.insert(p);
	}
	int s = 0;
	for (auto it = P.begin(); K > 0; it++) {
		s += *it;
		K--;
	}
	cout << s << endl;
	return(0);
}


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



using ll=long long;

int main(){
	//freopen("input.txt","r",stdin);
	int n,i,c=0;
	string s;
	cin>>n>>s;
	for(i=0;i+2<n;i++){
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')c++;
	}
	cout<<c;
}

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

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

    int n = ( a + d-1)/d;
    int m = ( c + b -1)/b; 

    if(m > n)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(){
	int H, W, D, Q; 
	cin >> H >> W >> D; 
	int A[90010][3] = {};
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			int B; 
			cin >> B; 
			A[B][0] = i, A[B][1] = j; 
		}
    }
	int B[90010] = {}; 
	for(int i = D + 1; i <= H * W; i++){
		B[i] = B[i - D] + abs(A[i][0] - A[i-D][0]) + abs(A[i][1] - A[i-D][1]); 
	}
    cin >> Q; 
	for(int j = 0; j < Q; j++){
	int L, R; 
	cin >> L >> R; 
	cout << B[R] - B[L] << endl; 
	}
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1e09+7;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back





int main(){

    int n;

    cin>>n;

    vector<ll> data(n);

   
    
    rep(i,n){
        ll tmp;
        cin>>tmp;
        data.at(i)=tmp;
    }

     sort(ALL(data));
    reverse(ALL(data));
    

  


    ll answer=1;

    rep(i,n){
        if (data.at(i)==0){
            answer=0;
            break;
        }
        
    }


    long long x=pow(10,18);


    rep(i,n){
        if (answer==0){
            break;
        }

        if (data.at(i)>(x/answer)){
            answer=-1;
            break;
        }
      
      answer*=data.at(i);
      
      
    }

    cout<<answer<<endl;

   







}

Measured memory_bytes: 4052
N, T = map(int, input().split())
min = 100000
flg = False
for i in range(N):
    min_temp, T_temp = map(int, input().split())
    if min_temp < min and T_temp <= T:
        min = min_temp
        flg = True
print(min if flg == True else "TLE")


Measured memory_bytes: 2940
N = gets.to_i

ans = 0
for i in 1..N
  if i >= 1 && i < 10
    ans += 1
  end

  if i >=100 && i < 1000
    ans += 1
  end

  if i >= 10000 && i < 100000
    ans += 1
  end
end

puts ans


Measured memory_bytes: 1788
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c;
    cin>>a>>b>>c;
    if(a>b){
        swap(a,b);
    }
    if(b>c){
        swap(b,c);
    }
    if(a>b){
        swap(a,b);
    }
    cout<<a<<" "<<b<<" "<<c<<endl;
}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string T;
  cin >> T;

  for(int i=0;i<T.size();i++){
    // cout << T.at(i) << endl;
    if(T.at(i)=='?') T.at(i)='D';
  }

  cout << T << endl;

}


Measured memory_bytes: 3724
program min
  implicit none
  integer(8) :: l, r, lmod, ans, rmod, i, j
  integer(8),parameter :: a = 2019
  
  read *, l, r 
  lmod = mod(l,a)
  rmod = mod(r,a)
  if (r >= (l/a+1)*a) then
    ans = 0
  else 
    do i = l, r 
      do j = i+1, r
        if (mod(i*j,a) < ans) ans = mod(i*j,a)
      end do
    end do
  end if
  print '(i0)', ans
  stop
end program min


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

int main(void)
{
	//変数の宣言
	int n;
	int k,s;
	long long int temp;
	long long int temp1;
	long long int temp2;
	int i,j;
	double sunuke1,sunuke2;
	int count;
	
	//データの読み込み
	scanf("%d",&n);
	
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	count=0;
	k=1;
	s=1;
	while(count<9){
		count++;
		printf("%d\n",count);
		if(count==n) return 0;
	}
	while(1){
		if(k%10!=0){
			k=k+1;
			temp=k;
			for(i=0;i<s;i++){
				temp=temp*10;
			}
			printf("%lld\n",temp-1);
		}else{
			temp=k+1;
			for(i=0;i<s;i++){
				temp=temp*10;
			}
			temp=temp-1;
			temp1=temp;
			j=0;
			while(temp>0){
				j=j+temp%10;
				temp=temp/10;
			}
			sunuke1=(double)temp1/j;
			
			temp=k/10+1;
			for(i=0;i<s+1;i++){
				temp=temp*10;
			}
			temp=temp-1;
			temp2=temp;
			j=0;
			while(temp>0){
				j=j+temp%10;
				temp=temp/10;
			}
			sunuke2=(double)temp2/j;
			
//			printf("temp1=%lld,sunuke1=%lf,temp2=%lld,sunuke2=%lf\n",temp1,sunuke1,temp2,sunuke2);
			
			if(sunuke1<=sunuke2){
				k=k+1;
				printf("%lld\n",temp1);
			}else{
				k=k/10+1;
				s=s+1;
				printf("%lld\n",temp2);
			}
		}
		count++;
		if(count==n) return 0;
	}
	
	
//	printf("計算部分終了\n");
	
	//出力
	
//	printf("結果の出力終了\n");
	
}



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

#define ll long long
#define vi vector<int>
#define ii pair<int, int>
#define vii vector<ii>
#define mp make_pair
#define pb push_back

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int k;
	string s;
	cin >> k;
	cin >> s;
	int n = (int)s.size();
	if (n <= k) cout << s << "\n";
	else {
		for (int i = 0; i < k; i++) {
			cout << s[i];
		}
		cout << "...\n";
	}
	return 0;
}

Measured memory_bytes: 3636
n=int(input())
s=[None]*n
for i in range(n):
  s[i]=input()
m=int(input())
t=[None]*m
for i in range(m):
  t[i]=input()
ans=0
a=[0]*n
for i in range(n):
  for j in range(n):
    if s[i]==s[j]:
      a[i]+=1
    else:
      pass
for i in range(n):
  for j in range(m):
    if s[i]==t[j]:
      a[i]-=1
    else:
      pass

b=max(a)
print(max(ans,b))
  
  


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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n,a;cin>>n>>a&&n;){
		cout<<n*n-a<<endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define ll long long
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define abs(a,b) (a-b>0?a-b:b-a)


int main(){
    string a,b,c;
    cin >> a >> b >> c;
    
    cout << ((a.at(a.size()-1)==b.at(0)&&b.at(b.size()-1)==c.at(0))?"YES":"NO") << endl;

}








Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long a,b;
    cin >>a>>b;
    long long memo[1000];
    for (int i = 1; i < 1000; i++) {
        memo[i]=memo[i-1]+i;
    }
    std::cout << memo[b-a]-b << std::endl;
}



Measured memory_bytes: 256
N,M = list(map(int,input().split()))
a = [list(map(int,input().split())) for _ in range(N)]
b = [int(input()) for _ in range(M)]
for i in range(N):
    num = 0
    for j in range(M):
        num += a[i][j]*b[j]
    print(num)


Measured memory_bytes: 6012
MAX = 105000

is_prime = [True for _ in range(MAX)]
is_prime[0] = is_prime[1] = False
for i in range(2, int(MAX ** (1 / 2)) + 1):
  if is_prime[i]:
    for j in range(i ** 2, MAX, i):
      is_prime[j] = False

primes = [i for i in range(MAX) if is_prime[i]]

while True:
  n = int(input())
  if not n:
    break
  print(sum(primes[:n]))


Measured memory_bytes: 6880
import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner (System.in);
	int MAX_VALUE = 1000000;
	boolean[] isPrime = new boolean[MAX_VALUE];
	for (int i = 2; i < MAX_VALUE; i++) {
	    isPrime[i] = true;
	}
	for (int i = 2; i < MAX_VALUE; i++) {
	    if (isPrime[i]) {
		for (int j = 2; i*j < MAX_VALUE; j++) {
		    isPrime[i*j] = false;
		}
	    }
	}
	int n, cnt;
	while (scan.hasNext()) {
	    n = Integer.parseInt(scan.nextLine());
	    cnt = 0;
	    for (int i = 2; i <= n; i++) {
		if (isPrime[i]) {
		    cnt++;
		}
	    }
	    System.out.println(cnt);
	}
    }
}

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

ll f(ll n) { return n * (n + 1) / 2; }

int main() {
	int n;
	ll ans = 0;
	cin >> n;
	vector<int> d(n + 1);

	for (int i = 1; i <= n; i++) {
		for (int j = i; j <= n; j += i) d[j]++;
	}

	REP(i, 1, n) ans += ll(i) * d[i];

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

Measured memory_bytes: 42180
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    int arr[10] ;
    for(int i=0 ; i<10 ; i++)
        cin>>arr[i] ;
    sort(arr,arr+10) ;
    cout<<arr[9] <<endl ;
    cout<<arr[8] <<endl ;
    cout<<arr[7] <<endl ;
    return 0 ;
}

Measured memory_bytes: 1176
n,k=map(int,input().split())
ans=0
if n==k:
    ans+=2**20
    c=0
    for i in range(1,n):
        order=0
        c+=i
        while i<k:
            i*=2
            order+=1
        ans+=2**(20-order)
        c=0
    print(ans/(n*(2**20)))
    
    
    
elif n<k:
    c=0
    for i in range(1,n+1):
        order=0
        c+=i
        while i<k:
            i*=2
            order+=1
        ans+=2**(20-order)
        c=0
    print(ans/(n*(2**20)))
    
    
elif n>k:
    ans+=(n+1-k)*(2**20)
    c=0
    for i in range(1,k):
        order=0
        c+=i
        while i<k:
            i*=2
            order+=1
        ans+=2**(20-order)
        c=0
    print(ans/(n*(2**20) ))       
    
                    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    int k,n;cin>>n>>k;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    int res=0;
    rep(i,k)res+=a[i];
    cout<<res<<endl;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <functional>
#include <list>
#include <iostream>

using namespace std;

int main()
{
	const int LENGTH = 10;

	int mountain[LENGTH];
	for(auto& i : mountain)
		cin >> i;

	sort(mountain, mountain+LENGTH, greater<int>());

	for(int i = 0; i < 3; i++)
		cout << mountain[i] << endl;
	
	return 0;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,a,b;cin>>n>>a>>b;
    if(n==1){
        if(a!=b)cout<<0<<endl;
        else cout<<1<<endl;
    }else{
        if(a>b)cout<<0<<endl;
        else cout<<(b-a)*(n-2)+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

#define REP(i, n) for(int i = 0; i < n; i++)
                                                                       
using namespace std;

int main(){
    char c; cin >> c;
    REP(i, 3){ 
        char x; cin >> x;
        if(c == x){ 
            cout << "Bad"; return 0;
        }c = x;
    }cout << "Good";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    string s;
    cin >> s;
    int dp[15][2][8];
    memset(dp, 0, sizeof(dp));
    dp[0][1][0] = 1;
    int t[] = {3, 5, 7, 0};
    rep(i, s.size())rep(j, 2)rep(l, 8){
        if(dp[i][j][l] == 0) continue;
        int range = ((i < s.size()-3 && l == 0) ? 4 : 3);
        if(j){
            rep(k, range){
                int mask = 1<<k;
                if(k == 3) mask = 0;
                if(s[i]-'0' < t[k]) continue;
                if(s[i]-'0' == t[k]) dp[i+1][1][l|mask] += dp[i][1][l];
                else dp[i+1][0][l|mask] += dp[i][1][l];
            }
        }else{
            rep(k, range){
                int mask = 1<<k;
                if(k == 3) mask = 0;
                dp[i+1][0][l|mask] += dp[i][0][l];
            }
        }
    }
    cout << dp[s.size()][0][7] + dp[s.size()][1][7] << endl;
}

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

int main() {
	
	int h,w,i,j,mod=1e9+7;
	cin>>h>>w;
	
	char arr[h][w];
	
	for(i=0;i<h;i++)
	    for(j=0;j<w;j++)
	        cin>>arr[i][j];
	
	long long dp[h][w]={0};
	
	for(int i=0;i<h;i++)
	{
	    for(int j=0;j<w;j++)
	    {
	        if(i==0&&j==0)
    	        dp[0][0]=1;
    	        
	        else if(arr[i][j]=='#')
	            dp[i][j]=0;
	            
	        else if(i==0)
    	        dp[i][j]=dp[i][j-1];
    	        
	        else if(j==0)
    	        dp[i][j]=dp[i-1][j];
    	        
	        else 
    	        dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
	    }
	}
	cout<<dp[h-1][w-1];
	
	
	return 0;
}

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

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

    int n;
    cin >> n;
    
    int p[25] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
    vector<int> d(25);
    for(int i = 2; i <= n; i++){
        int a = i, j = 0;
        while(a > 1){
            if(a % p[j]){
                j++;
                if(j > 25) break;
            }else{
                a /= p[j];
                d[j]++;
            }
        }
    }

    int ans = 0;
    for(int i = 0; i < 25; i++){
        if(d[i] >= 74) ans++;
        for(int j = i + 1; j < 25; j++){
            if(i == j) continue;
            if(d[i] >= 4 and d[j] >= 14) ans++;
            if(d[i] >= 14 and d[j] >= 4) ans++;
            if(d[i] >= 2 and d[j] >= 24) ans++;
            if(d[i] >= 24 and d[j] >= 2) ans++;            
            for(int k = j + 1; k < 25; k++){
                if(i != k and d[i] >= 2 and d[j] >= 4 and d[k] >= 4) ans++;
                if(i != k and d[i] >= 4 and d[j] >= 2 and d[k] >= 4) ans++;
                if(i != k and d[i] >= 4 and d[j] >= 4 and d[k] >= 2) ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

bool comp(int a, int b){
    return (a<b);
}

int main(){
    int a, b; cin >> a >> b;
    cout << max({a+b, a-b, a*b},comp) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  if(n%2==0){
    cout<<n/2.0000000/n<<endl;
  }
  if(n%2==1){
    cout<<((n-1)/2.0000000+1.0000000)/n;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int father[100500];
int dis[100500];
int find_father(int x) {
	if(father[x]==x)return x;
	int a1=father[x];
	int a2=find_father(father[x]);
	father[x]=a2;
	dis[x]=dis[x]+dis[a1];
	return a2;
}
int find(int x) {
	if(father[x]==x)return 0;
	return find(father[x])+dis[x];
}
int main() {
	int n,m,L,R,D;
	cin>>n>>m;
	for(int i=0; i<=n; i++)
	{
		father[i]=i;
		dis[i]=0;
	}
	while(m--) {
		cin>>L>>R>>D;
		int fl=find_father(L);
		int fr=find_father(R);
		if(fl==fr) {
			if(dis[L]+D!=dis[R]) {
				cout<<"No"<<endl;
				return 0;
			}
		} else {
			father[fr]=fl;
			dis[fr]=find(L)-find(R)+D;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

using namespace std;

const double PI = 3.141592653589;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define ll long long
#define ll long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define INF LLONG_MAX
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
//  


int32_t main()
{
    fastio;
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    int n, m, x;
    cin >> n >> m >> x;
    int a[n][m];
    int c[n];
    for(int i=0;i<n;i++)
    {
    	cin >> c[i];
    	for(int j=0;j<m;j++)
    		cin >> a[i][j];
    }
    int ans = M;
    for(int mask=1;mask < (1<<n); mask++)
    {
    	int z[m];
    	int cost = 0;
    	memset(z, 0, sizeof(z));
    	for(int i=0;i<n;i++)
    	{
    		if(mask&(1<<i))
    			cost += c[i];
    		for(int j=0;j<m;j++)
    		{
	    		if(mask&(1<<i))
	    		{
	    			z[j] += a[i][j];
	    		}
	    	}
    	}
    	bool check = true;
    	for(int i=0;i<m;i++)
    	{
    		if(z[i] < x)
    		{
    			check = false;
    			break;
    		}
    	}
    	if(check) ans = min(ans, cost);
    }
    if(ans == M) ans = -1;
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 3640
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>

#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {


	int n,maxi = 0;
	cin >> n;

	int sum = 0;
	for (int i = 0; i < n; i++) {
		int p;
		cin >> p;

		CHMAX(maxi,p);
		sum += p;
	}

	COUT(sum - maxi / 2);

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){

    char S[101];

    scanf("%s",S);

    for(int i=0;i<sizeof(S);i++){
        if(S[i] != '\0'){
            S[i] = 'x';
        }
    }
    printf("%s\n",S);

    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		int N = fs.nextInt(), K = fs.nextInt();
		
		int initial_edge = N-1; 
		int dec = (N-1)*(N-2)/2 - K;
		if(dec < 0) {
			System.out.println(-1);
			return;
		}
		int M = initial_edge + dec;
		//まず頂点1を中心とする放射状のグラフを作る
		StringBuilder sb = new StringBuilder();
		sb.append(M + "\n");
		for(int i=2;i<=N;i++) {
			int u = 1 ,v = i;
			sb.append(u + " " + v + "\n");
		}
		for(int i=2;i<=N;i++) {
			for(int j=i+1;j<=N;j++) {
				if(dec == 0)break;
				dec --;
				sb.append(i + " " + j + "\n");
			}
		}
		System.out.println(sb.toString());
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 22740