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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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 int MOD = 1e9+7;
const ll LINF = 1e18;

ll n;
ll dp[110][5][5][5];
ll ans=0;

ll dfs(ll cnt,ll a,ll b,ll c){
  if(cnt==n) return 1;
  if(dp[cnt][a][b][c]>0) return dp[cnt][a][b][c];
  
  ll res=0;
  rep(i,4){
    if(b==0&&c==1&&i==2) continue;
    if(b==1&&c==0&&i==2) continue;
    if(b==0&&c==2&&i==1) continue;
    if(a==0&&c==1&&i==2) continue;
    if(a==0&&b==1&&i==2) continue;
    res+=dfs(cnt+1,b,c,i);
    res%=MOD;
  }
  return dp[cnt][a][b][c]=res;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  cin>>n;
  cout<<dfs(0,3,3,3)<<endl;
}

Measured memory_bytes: 384
import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
N = len(s)

data = [0]*N

tmp = 0
for i in range(N):
  if s[i] == "R":
    tmp += 1
    data[i] = tmp
  else:
    tmp = 0

tmp = 0
for i in range(N-1,-1,-1):
  if s[i] == "L":
    tmp += 1
    data[i] = tmp
  else:
    tmp = 0
#print(data)

ans = [0]*N
for i in range(N-1):
  if s[i] + s[i + 1] == "RL":
    num = data[i] + data[i + 1]
    if num%2 == 0:
      ans[i] = num//2
      ans[i + 1] = num//2
    else:
      if data[i]%2 == 0:
        ans[i] = num//2
        ans[i + 1] = num//2 + 1
      else:
        ans[i] = num//2 + 1
        ans[i + 1] = num//2
print(" ".join(map(str, ans)))

Measured memory_bytes: 51824
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define pb push_back

typedef long long ll;
typedef pair<int,int> pi;
const int MAXN = (int)1e6+7;

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

    int a,b;
    cin >> a >> b;
    int ans = (a+b-1)/b;
    cout << ans << endl;
}




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

void chmax(int &a, int b){
    if(a < b)a = b;
}

int main(void){
    int H, W;
    cin >> H >> W;
    
    auto check = [&](int y, int x){
        return (0 <= x && x < W && 0 <= y && y < H);
    };
    
    vector<vector<char>> Lamp(H, vector<char>(W));
    vector<vector<int>> U(H, vector<int>(W, 0));
    vector<vector<int>> D(H, vector<int>(W, 0));
    vector<vector<int>> L(H, vector<int>(W, 0));
    vector<vector<int>> R(H, vector<int>(W, 0));
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> Lamp[i][j];
            if(Lamp[i][j] == '.'){
                if(check(i - 1, j) && Lamp[i - 1][j] == '.')U[i][j] += U[i - 1][j] + 1;
                if(check(i, j - 1) && Lamp[i][j - 1] == '.')L[i][j] += L[i][j - 1] + 1;
            }
        }
    }
    
    int ans = 0;
    for(int i = H - 1; i >= 0; i--){
        for(int j = W - 1; j >= 0; j--){
            if(Lamp[i][j] == '.'){
                if(check(i + 1, j) && Lamp[i + 1][j] == '.')D[i][j] += D[i + 1][j] + 1;
                if(check(i, j + 1) && Lamp[i][j + 1] == '.')R[i][j] += R[i][j + 1] + 1;
                chmax(ans, 1 + U[i][j] + D[i][j] + L[i][j] + R[i][j]);
            }
        }
    }
    
    cout << ans << endl;
    return 0;
}

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

int main () {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  vector<int> b(M);
  for (int i = 0; i < M; i++) {
    cin >> a.at(i) >> b.at(i);
  }
  for (int i = 1; i <= N; i++) {
    int count = 0;
    for (int j = 0; j < M; j++) {
      if (a.at(j) == i || b.at(j) == i) {
        count++;
      }
    }
    cout << count << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int>a(n, 0);
	rep(i, n) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());

	bool ans = true;

	rep(i, n-1) {
		if (a[i] == a[i + 1]) {
			ans = false;
		}
	}

	if(ans){
		cout << "YES" << endl; 
	}
	else { cout << "NO" << endl; }
	
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
using namespace std;

int main() {
	int n, count, j;
	count = 0;
	int h[20];
	cin >> n;
	REP(i, n) {
		cin >> h[i];
	}
	REP(k, n) {
		if (k == 0) {
			count++;
		}
		else {
			for (j = 0; j <= k; j++) {
				if (h[j] > h[k]) {
					break;
				}
				else {
					if (j == k) {
						count++;
					}
				}
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

main()
{
	int N,K,P,cou1,cou2;
	
	scanf("%d",&N);
	
	for(cou1=1;cou1<=N;cou1++){
		scanf("%d %d",&K,&P);
		
		while(K>0){
			for(cou2=1;cou2<=P;cou2++){
				K--;
				if(K==0){
					break;
				}
			}
		}
		printf("%d\n",cou2);
	}
	
	return 0;
}

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

int main() {
    ll n,p,ans=1; cin>>n>>p;

    if(n == 1) {
        cout<<p<<endl;
        return 0;
    }
    for(ll i=2; i*i<=p; i++) {
        ll num = 0;
        while(p % i == 0) {
            p /= i;
            num++;
            if(num == n) {
                ans *= i;
                num = 0;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

int main(void) {
    int D, T, S;
    cin >> D >> T >> S;

    if ((D + S - 1) / S <= T) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3616
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sx = sc.nextInt();
		int sy = sc.nextInt();
		int tx = sc.nextInt();
		int ty = sc.nextInt();
		
		StringBuilder sb = new StringBuilder();
		append(sb, ty-sy, 'U');
		append(sb, tx-sx, 'R');
		append(sb, ty-sy, 'D');
		append(sb, tx-sx, 'L');

		append(sb, 1, 'L');
		append(sb, ty-sy+1, 'U');
		append(sb, tx-sx+1, 'R');
		append(sb, 1, 'D');
		append(sb, 1, 'R');
		append(sb, ty-sy+1, 'D');
		append(sb, tx-sx+1, 'L');
		append(sb, 1, 'U');
		
		System.out.println(sb.toString());
		sc.close();
	}
	
	static void append(StringBuilder sb, int n, char c) {
		for(int i=0; i<n; i++)
			sb.append(c);
	}
}


Measured memory_bytes: 9812
#include<stdio.h>

int main(){
    int H,W;
    for(int k=0;;k++){

    scanf("%d %d",&H,&W);
        if(H==0 && W==0)break;
    for(int i=0;i<H;i++){
        if(i%2==0){
            for(int j=0;j<W;j++){
                if(j%2==0){
                    printf("#");
                }else{
                    printf(".");
                }
            }
        }else{
            for(int j=0;j<W;j++){
                if(j%2==0){
                    printf(".");
                }else{
                    printf("#");
                }
            }

        
        
        }printf("\n");
    }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned ui;
typedef unsigned long long ul;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef pair<bool, bool> pbb;
typedef vector<int> vi;
#define pb push_back
#define fi first
#define se second
#define mid ((l + r) >> 1)
#define ls (i << 1)
#define rs (i << 1 | 1)
#define enum(i, j, k) for(int i = j; i <= (k); i ++)
#define open(i, j, k) for(int i = j; i <  (k); i ++)
#define dec(i, j, k)  for(int i = j; i >= (k); i --)
#define ae(x) for(node *p = h[x]; p; p = p->nxt)
#define fill(x, k) memset(x, k, sizeof x)
#define copy(x, y) memcpy(x, y, sizeof x)
#define fio(x) freopen(x".in", "r", stdin); freopen(x".out", "w", stdout);
template <class T> bool chkmin(T &x, T y)
{ return y < x ? (x = y , true) : false; }
template <class T> bool chkmax(T &x, T y)
{ return y > x ? (x = y , true) : false; }
void __init()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(16);
    srand(time(0) ^ ui(ul(new char)));
}
/* default code ends here */
const int maxn = 2e3 + 10;
int n, m, q;
int a[maxn][maxn], b[maxn][maxn], c[maxn][maxn];
int main()
{
	__init();
	cin >> n >> m >> q;
	string foo;
	enum(i, 1, n)
	{
		cin >> foo;
		enum(j, 1, m)
			a[i][j] = foo[j - 1] - '0';
	}
	/*enum(i, 1, n)
	{
		enum(j, 1, m)
			cerr << a[i][j] << ' ';
		cerr << endl;
	}*/
	enum(i, 1, n)
		enum(j, 2, m)
			b[i][j] = b[i - 1][j] + b[i][j - 1] - b[i - 1][j - 1] + bool(a[i][j] && a[i][j - 1]);
	/*enum(i, 1, n)
	{
		enum(j, 1, m)
			cerr << b[i][j] << ' ';
		cerr << endl;
	}*/
	enum(i, 2, n)
		enum(j, 1, m)
			c[i][j] = c[i - 1][j] + c[i][j - 1] - c[i - 1][j - 1] + bool(a[i][j] && a[i - 1][j]);
	enum(i, 1, n)
		enum(j, 1, m)
			a[i][j] += a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1];
	int x1, y1, x2, y2;
	while(q --)
	{
		cin >> x1 >> y1 >> x2 >> y2;
		//cerr << (a[x2][y2] - a[x2][y1 - 1] - a[x1 - 1][y2] + a[x1 - 1][y1 - 1]) << ' ' << (b[x2][y2] - b[x2][y1] - b[x1 - 1][y2] + b[x1 - 1][y1]) << ' ' << (c[x2][y2] - c[x2][y1 - 1] - c[x1][y2] + c[x1][y1 - 1]) << endl;
		cout << (a[x2][y2] - a[x2][y1 - 1] - a[x1 - 1][y2] + a[x1 - 1][y1 - 1]) - (b[x2][y2] - b[x2][y1] - b[x1 - 1][y2] + b[x1 - 1][y1]) - (c[x2][y2] - c[x2][y1 - 1] - c[x1][y2] + c[x1][y1 - 1]) << '\n';
	}
	return 0;
}


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

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

#define ll long long
#define vl vector<ll>
#define vll vector<vl>
#define P pair<int, int>

const int INF = 1e9;

int main() {
	int n, k;
	cin >> n >> k;
	int s[110]={};
	rep(i, k)
	{
		int d;
		cin >> d;
		rep(j, d)
		{
			int t;
			cin >> t;
			t--;
			s[t]++;
		}
	}
	int ans = 0;
	rep(i, n) if(s[i] == 0) ans++;
	cout << ans << endl;
	return 0;
}

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

int main () {
    int d, g, p[15], c[15];
    cin >> d >> g;
    for (int i = 0; i < d; i++) cin >> p[i] >> c[i];

    int ans = 1e9;
    for (int i = 0; i < (1 << d); i++) {
        int s = 0, num = 0, rest_max = -1;
        for (int j = 0; j < d; j++) {
            if (i >> j & 1) {
                s += 100 * (j + 1) * p[j] + c[j];
                num += p[j];
            }
            else rest_max = j;
        }
        if (s < g) {
            int s1 = 100 * (rest_max + 1);
            int need = (g - s + s1 - 1) / s1;
            if (need >= p[rest_max]) {
                continue;
            }
            num += need;
        }
        ans = min(ans, num);
    }

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

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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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

const ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 1000001;

int H, W;
char grid[20][20];
int group[20][20];

int dy[4] = {0, -1, 0, 1};
int dx[4] = {1, 0, -1, 0};

int ans = 0;

void solve() {
	cin >> H >> W;
	bool wrong = false;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {	
			cin >> grid[i][j];
			if (grid[i][j] == '#') wrong = true;
		}
	}
	
	if (!wrong) {
		cout << H + W - 2;
		return;
	}
	
	int curr = 0;
	for (int r = 0; r < H; r++) {
		for (int c = 0; c < W; c++) {
			curr++;
			if (grid[r][c] == '.') {
				queue<pair<l_l, int>> q;
				q.push({{r, c}, 0});
				while (!q.empty()) { 
					pair<l_l, int> v = q.front();
					group[v.first.first][v.first.second] = curr;
					q.pop();
					chmax(ans, v.second);
					for (int i = 0; i < 4; i++) {
						int a = v.first.first + dy[i], b = v.first.second + dx[i];
						if (a < 0 || a >= H || b < 0 || b >= W) continue;
						if (group[a][b] == curr) continue;
						if (grid[a][b] != '.') continue;
						q.push({{a, b}, v.second + 1});
					}
				}
			}
		}
	}
	cout << ans;
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#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 ALL(a) (a).begin(), (a).end()

int main() {
    int N, X, T;
    cin >> N >> X >> T;
    cout << (N + X - 1) / X * T << endl;
    return 0;
}

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

template <typename T>
T BinarySearch(T lo, T hi, std::function<bool(T)> pred) {
  while (lo + 1 < hi) {
    T mid = (hi - lo) / 2 + lo;
    if (pred(mid)) {
      lo = mid;
    } else {
      hi = mid;
    }
  }
  return lo;
}

template <typename T>
class SegmentTree {
 public:
  using Operation = std::function<T(T, T)>;
  SegmentTree(int size, Operation operation, T identity = T())
      : operation_(operation), identity_(identity) {
    int two = 1;
    while (two < size) {
      two <<= 1;
    }
    v_.resize(two * 2 - 1, identity_);
  }
  void Set(int i, T v) {
    int index = v_.size() / 2 + i;
    while (true) {
      v_[index] = v;
      if (index == 0) break;
      v = operation_(v, v_[index + (index % 2 == 0 ? -1 : 1)]);
      index = (index - 1) / 2;
    }
  }
  T Get(int i) const { return Aggregate(i, i + 1); }
  T Aggregate(int begin, int end) const {
    std::function<T(int, int, int)> rec = [&](int cbegin, int cend, int index) {
      if (begin <= cbegin && cend <= end) {
        return v_[index];
      }
      if (cend <= begin || end <= cbegin) {
        return identity_;
      }
      int cmid = (cbegin + cend) / 2;
      return operation_(rec(cbegin, cmid, index * 2 + 1),
                        rec(cmid, cend, index * 2 + 2));
    };
    return rec(0, (v_.size() + 1) / 2, 0);
  }

 private:
  const Operation operation_;
  const T identity_;
  std::vector<T> v_;
};

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(int, n, m);
  in(string, s);

  vector<int> v;
  int i = n;
  while (true) {
    int ni = max(0, i - m);
    while (s[ni] == '1' && ni < i) ++ni;
    if (ni == i) {
      cout << -1 << endl;
      return 0;
    }
    v.push_back(i - ni);
    i = ni;
    if (i == 0) {
      reverse(all(v));
      rep(i, v.size()) {
        if (i) cout << " ";
        cout << v[i];
      }
      cout << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 1144
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque
import math
import pprint
# stdin = open("sample.txt")

def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

N = int(stdin.readline().rstrip())
now = 1
ans = 0

while now <= N:
    if now%3 != 0 and now%5 != 0 and now%15 != 0:
        ans += now
    now += 1

print(ans)

Measured memory_bytes: 9840
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

        int n = Integer.parseInt(scan.next());
        int m = Integer.parseInt(scan.next());

        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(scan.next());
        }

        scan.close();

        int sum = 0;

        for (int i : a) {
            sum += i;
        }

        double border = (double) sum / (4 * m);

        Arrays.sort(a);

        for (int i = 0; i < m; i++) {
            if (a[n - 1 - i] < border) {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }

}


Measured memory_bytes: 23252
#include <stdio.h>
int a[200000] = {};
int dis[200000] = {};
int main() {
	int k, n;
	scanf("%d%d", &k, &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < n; i++) {
		if (i == n - 1) {
			dis[i] = k - a[i] + a[0];
		} else {
			dis[i] = a[i + 1] - a[i];
		}
	}
	int max = 0;
	for (int i = 0; i < n; i++) {
		//printf("dis[%d]:%d ", i,dis[i]);
		if (max < dis[i]) {
			max = dis[i];
		}
	}
	printf("%d\n", k - max);
	return 0;
}

Measured memory_bytes: 1664
// Daniel Grzegorzewski
// while (clock()<=69*CLOCKS_PER_SEC)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define int long long

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

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

int a, b, c;

signed main() {
  // init_ios();
  scanf("%lld", &a);
  scanf("%lld.%lld",&b,&c);
  c *= a;
  c /= 100;
  b *= a;
  printf("%lld\n", b+c);
}

Measured memory_bytes: 3804
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int a = s.length();
        for(int i=0; i<a; i++) {
            String s1 = s.substring(i, i +1);
            if(s1.matches("[A-Z]")){
                System.out.print(s1.toLowerCase());
            } else if(s1.matches("[a-z]")) {
                System.out.print(s1.toUpperCase());
            } else {
                System.out.print(s1);
            }
        }
        System.out.println();
    }
}


Measured memory_bytes: 30208
import sys

input = sys.stdin.readline

def main():
    ans = 1000
    s = 0
    n = int(input())
    a = list(map(int, input().split()))
    b = [""]*n
    for i in reversed(range(n)):
        if a[i]>a[i-1]:
            b[i]="sell"
        elif a[i]<=a[i-1]:
            b[i]="buy"
    if a[0] <= a[1]:
      b[0] = "buy"
    elif a[0] > a[1]:
      b[0] = "sell"
    for i in range(n):
        if b[i] == "sell" and (i==n-1 or b[i+1] != "sell"):
            ans += s*a[i]
            s = 0
        elif b[i] == "buy" and i != n-1 and b[i+1] != "buy":
            s += ans//a[i]
            ans -= ans//a[i]*a[i]
    
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9180
#include <iostream>

using namespace std;

int main(){
    int X;
    cin >> X;
    int sum = 0;
    
    int i = 1;
    while(1){
        sum += i;
        
        if(sum >= X){
            break;
        }
        
        i++;
    }
    
    cout << i << endl;
}

Measured memory_bytes: 256
import Data.Char

decider::Int->Int->Int->Bool
decider a b n = let m = (sum.(map digitToInt).show) n in
                (a<=m)&&(m<=b)

naive_solver::Int->Int->Int->Int
naive_solver n a b = sum (filter (decider a b) [1..n])

main::IO()
main=do
  nabc<-getLine
  let n:a:b:[]=map read (words nabc)
  print (naive_solver n a b)

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

int main() {
  int X;
  int T;
  int N;
  
  cin >> N >> X >> T;
  
  if(N%X==0){
    cout << (N/X)*T << endl; 
  }
  
  else{
    cout << (N/X)*T+T << endl;
  }
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define int long long 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) a.begin(),a.end()
#define ld long double
#define ub upper_bound
#define lb lower_bound
#define pii pair<int,int>
using namespace std;
signed main(){
    fast;
    string s;
    cin>>s;
    int n = s.size();
    string t ="hihihihihi";
    int i = 0;
    int j = 0;
    if(n&1){
        cout<<"No";
        return 0;
    }
    while(i<n){
        if(s[i]!=t[j]){
            cout<<"No";
            return 0;
        }
        i++,j++;
    }
    cout<<"Yes";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;

int H, W;
char A[9][9];

int main()
{
    cin >> H >> W;

    rep(i, H) {
        rep(j, W) cin >> A[i][j];
    }

    int x = 0, y = 0;
    A[y][x] = 0;
    while (1) {
        if (x + 1 >= W && y + 1 >= H) break;
        if (A[y + 1][x] == '#') {
            y++;
            A[y][x] = '.';
        }
        else if (A[y][x + 1] == '#') {
            x++;
            A[y][x] = '.';
        }
        else break;
    }

    rep(i, H) {
        rep(j, W) {
            if (A[i][j] == '#') {
                cout << "Impossible" << endl;
                return 0;
            }
        }
    }

    cout << "Possible" << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
if n ==0:
    print(0)
else:
    f = 1
    res = ""
    while n != 0:
        if n% (2**f) != 0:
            res = "1"+res
            n -= (-2)**(f-1)
        else:
            res = "0"+res
        f += 1
    print(res)

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

template <typename T>
void print_vec(const vector<T>& v, bool is_reverse=false, ll num=0){
  if(num == 0) num = (ll)v.size();
  cout << endl; cout << "i=  ";for(ll i=0; i<num; i++) cout << i << "   ";cout << endl;  
  cout << "    ";
  if(is_reverse) for(ll i=num-1; i>=0; i--){ cout<<v[i]; if(i!=0) cout<<"   ";}
  else for(ll i=0; i<num; i++){ cout<<v[i]; if(i!=num-1) cout<<"   ";}
  cout << endl;
}

// template <typename T>
// void print_pairvec(const vector<T> &v, ll num=0){
//   if(num == 0) num = (ll)v.size();
//   cout << endl; for(ll i=0; i<num; i++){ cout << v[i].first << " " << v[i].second << endl;}
// }
template <typename T>
void print_pairvec(const T &_pair, ll num=0){
  cout << endl; for(pair<ll, int> x: _pair){ cout << x.first << " " << x.second << endl;}
}

template <typename T>
void print_vec2(const vector<vector<T>>& v){
  cout << endl; cout << "       ";
  for(ll i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(ll i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(ll j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

int main(){
  int N, K;
  cin >> N >> K;
  vector<bool> snuke(N, false);
  for(int i=0; i<K; i++){
    int d;
    cin >> d;
    for(int i=0; i<d; i++){
      int a;
      cin >> a;
      snuke[a-1] = true;
    }
  }

  int ans = 0;
  for(bool is : snuke) if(is==false) ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

int n;
double w,h;

int main(){
	int flag=0;
	while(scanf("%d,%lf,%lf",&n,&w,&h)!=EOF){
		if(w/h/h>=25){cout<<n<<endl;flag=1;}
	}
	if(flag==0)cout<<"ツ該ツ督鳴づ按つオ"<<endl;
}

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

#define ll long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;

ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
int main() {
    //COMint();
    int N=in();
    ll A[N];
    ll sum_w;sum_w=0;
    ll sum_w_even;sum_w_even=0;
    REP(i,N){
        cin>>A[i];
        sum_w+=A[i];
        if(i%2==1){
            sum_w_even+=A[i];
        }
    }
    ll w[N];
    
    w[0]=sum_w-2*sum_w_even;
    cout<<w[0]<<" ";
    REP(i,N-1){
        w[i+1]=(A[i]-w[i]/2)*2;
        cout<<w[i+1];
        if(i<N-2)cout<<" ";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 2816
#include<cstdio>
#include<iostream>
#include<unordered_set>
#include<string>
#define MAX 200001
int mem[MAX]={0};
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<n;i++){
		int temp;
		cin>>temp;
		mem[temp]+=1;
	}
	for(int i=1;i<=n;i++){
		cout<<mem[i]<<endl;
	}
	return 0;
} 

Measured memory_bytes: 4336
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
//#include<cstdio>//"scanf("%lf",&(double));printf("%f",(double));"
//#include<iomanip>//"cout<<fixed<<setprecision(n)<<sth<<endl;"
//#include<string>//"reverse(s's it,s's it)"
//#include<functional>//"greater<T>" "sort(a,a+n,greater<int>());""
//#include<cmath>//"abs" "sqrt"
//#include<numeric>//"accumulate(inputit,inputit,init,(optional) object)"
//#include<algorithm>//"lower_bound(it,it,v)" "next_permutation(a,a+n)"
//"reverse(v's it,v's it)"(v: vector)
//#include<cassert>//"assert(cond);": error if cond doesn't hold.
using namespace std;
#define pb push_back//also for STRING
#define fi first
#define sc second
#define mp make_pair
#define is insert//also use as v.is(v's it,w's it,w's it);//Be careful in topcoder
#define ps push//stack,(priority) queue,//Be careful in topcoder.
#define fr front//queue//for priority, use top().//Be careful in topcoder.
typedef long long ll;//not necessarily//Be careful in topcoder.
typedef pair<int,int> pii;//Be careful in topcoder.

set<int> nonprime;
void sieve(){
    int n = 1000000;
    nonprime.is(0);
    nonprime.is(1);
	int m=sqrt(n);
	for(int i=2;i<=m;++i) if(nonprime.find(i)==nonprime.end()){
		for(int j=i*i;j<=n;j+=i) nonprime.is(j);
	}
	return;
}

long long pow(long long x,long long n){
	long long ret=1;
	for(;n>0;x=(x*x),n>>=1) if(n&1) ret=ret*x;
	return ret;
}

int main(){
    ll n,p,ans = 1;
    cin>>n>>p;
    for(ll i = 2;i<=1000000;++i) if(nonprime.find((int)i)==nonprime.end()){
        int cnt = 0;
        while(p%i == 0){
            p/=i;
            ++cnt;
        }
        ans *= pow(i,cnt/n);
    }
    if(p>1 && n == 1) ans *= p;
    printf("%lld\n",ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e6+5;
#define mod 2147483648
#define inf 0x7fffffff
int main(){
    int n,k;
    scanf("%d %d",&n,&k);
    int a[n+5];
    for(int i = 1;i <= n;i++){
        scanf("%d",&a[i]);
    }
    n-=k;
    for(int i = 1;i <= n;i++) {
        if(a[i] < a[i+k]) printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 4576
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
  while True:
    n = int(input())
    if(n == 0):
      break
    w = list(map(int, input().split()))
    dp = [[0] * (n+1) for _ in range(n+2)]
    for gap in range(2,n+1):
      for l in range(n-gap+1):
        r = l+gap
        if(dp[l+1][r-1] == gap-2):
          if(abs(w[l]-w[r-1]) <= 1):
            dp[l][r] = gap
            continue
        for k in range(l, r):
          if(dp[l][r] < dp[l][k]+dp[k][r]):
            dp[l][r] = dp[l][k]+dp[k][r]
    print(dp[0][n])
    
if __name__ == '__main__':
  main()


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

int main() {
    int n; cin >> n;
    vector<int> h(n); rep(i, n) cin >> h[i];
    vector<int> t = h;
    sort(h.begin(), h.end());

    string res = "Yes";
    rep(i, n) {
        if (abs(h[i] - t[i]) > 1) res = "No";
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include<set>
#include <algorithm>
#define ll long long 
#include <string.h>
#define pb push_back
#define mp make_pair
# define pi 3.14159265358979323846
using namespace std;
int main()
{
	ll int h,w,k;
	cin>>h>>w>>k;
	char s[h][w];
	ll int ans=0;
	
	ll int i,j;
	for(i=0;i<h;i++)
	{
	for(j=0;j<w;j++)
	{
		cin>>s[i][j];
		
	}
	}
	ll int l,m;
	ll int c=0;
	for(i=0;i<1<<h;i++)
	{
		for(j=0;j<1<<w;j++)
		{
			c=0;
			for(l=0;l<h;l++)
			{
				for(m=0;m<w;m++)
				{
					if (((i>>l)&1)||(((j>>m)&1)))
					continue;
					
				    if (s[l][m]=='#')
					c++;
				}
			}
			
			if (c==k)
			ans++;
		}
	}
	cout<<ans<<endl;
	
	
}

    
	
		

	
			

		


 






Measured memory_bytes: 3604
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

bool can(llint A, llint B, llint C, llint D) {
  if (D < B || A < B) return false;
  if (C >= B - 1) return true;

  A %= B;
  llint g = __gcd(D, B);

  A += ((C+1 - A + g-1) / g) * g;
  A %= B;

  return A <= C;
}

int main(void) {
  int T;
  scanf("%d", &T);
  while (T--) {
    llint A, B, C, D;
    scanf("%lld %lld %lld %lld", &A, &B, &C, &D);
    puts(can(A, B, C, D) ? "Yes" : "No");
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value
int N;
pair<ll, ll> task[200020];

void solve() {

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> task[i].scd >> task[i].fst;
	}

	sort(task, task + N);

	ll time = 0;
	for (int i = 0; i < N; i++) {
		time += task[i].scd;
		if (time > task[i].fst) {
			cout << "No" << endl;
			return;
		}
	}

	cout << "Yes" << endl;

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 3328
def main():
    N = int(input())
    d = {}
    m = 0
    for n in range(N):
        s = input()
        d[s] = d.setdefault(s, 0) + 1
        if d[s] > m:
            m = d[s]
    keys = [k for k, v in d.items() if v == m]
    print('\n'.join(sorted(keys)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 34140
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a "=" << (a) << endl)
#define DUMP(list) cout << "{"; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

vector<vector<int>> A;
vector<vector<int>> B;
vector<vector<int>> C;
int H,W,h,w;

bool check(int offset_h, int offset_w) {
	rep(i, h) {
		rep(j, w) {
			if(B[i + offset_h][j + offset_w] != C[i][j]) return false;
		}
	}
	return true;
}

int calc(int offset_h, int offset_w) {
	int ret = 0;
	rep(i, h) {
		rep(j, w) {
			ret += A[i + offset_h][j + offset_w];
		}
	}
	return ret;
}

int main() {
	cin >> H >> W;
	A.assign(H,vector<int>(W,0));
	B.assign(H,vector<int>(W,0));
	rep(i,H) rep(j, W) cin >> A[i][j];
	rep(i,H) rep(j, W) cin >> B[i][j];
	
	cin >> h >> w;
	C.assign(h,vector<int>(w,0));
	rep(i,h) rep(j,w) cin >> C[i][j];
	
	int ans = -1000000000; bool is_na = true;
	rep(i, H - h + 1) {
		rep(j, W - w + 1) {
			if(check(i, j)) {
				ans = max(ans, calc(i, j));
				is_na = false;
			}
		}
	}
	
	if(is_na) {
		cout << "NA" << endl;
	} else {
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

void yes() {
  cout << "Yes" << endl;
  exit(0);
}

void no() {
  cout << "No" << endl;
  exit(0);
}

int main() {
  ll n;
  cin >> n;
  string s;
  cin >> s;
  if (n % 2 == 1) {
    no();
  }

  REP(i, n / 2) {
    if (s[i] != s[n / 2 + i]) no();
  }
  yes();
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

struct node{
    int index,cost;
    node(int index,int cost):index(index),cost(cost){}
    bool operator<(const node& other)const{
        return cost>other.cost;
    }
};
const int MAX=INT_MAX/10;
int main(){
	int n,m;
	cin>>n>>m;
	vvi g(n,vi(n));
	REP(i,m){
		int a,b,c;
		cin>>a>>b>>c;
		g[a][b]=-c;
	}
    priority_queue<node> q;
    q.push(node(0,0));
    vi cost(n,MAX);
    cost[0]=0;
    while(!q.empty()){
        node cnode=q.top();q.pop();
        if(cost[cnode.index]<cnode.cost){
            continue;
        }
        REP(i,n){
            if(i!=cnode.index&&g[cnode.index][i]){
				int newcost=cnode.cost+g[cnode.index][i];
				if(cost[i]>newcost){
					cost[i]=newcost;
					q.push(node(i,newcost));
				}
            }
        }
    }
    cout<<-cost[n-1]<<endl;
}

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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {

    int num;
    cin >> num;

    string ans;
    for (int i = num; i <= 999; i++) {
        string tmp = to_string(i);
        if (tmp[0] == tmp[1] && tmp[1] == tmp[2]) {
            ans = tmp;
            break;
        }
    }
    print(ans);
}

signed main() {
    solve();
}


Measured memory_bytes: 256
n = int(input())
l = list(map(int,input().split()))
k = 0
for i in range(1,n-1):
  p_1 = l[i-1]
  p_2 = l[i]
  p_3 = l[i+1]
  _ = [p_1,p_2,p_3]
  if (min(_)==p_1 and max(_)==p_3) or (min(_)==p_3 and max(_)==p_1):
    k +=1
print(k)

Measured memory_bytes: 3060
import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\ALDS1_6_A-in9.txt"));

		int n = scan.nextInt();
		long[] f = new long[n + 1];

		System.out.println(Fib(n, f));

		scan.close();
		System.exit(0);
	}

	private static long Fib(int n, long[] f) {
		if (n <= 1)
			return 1;
		if (f[n] != 0)
			return f[n];
		f[n] = Fib(n - 2, f) + Fib(n - 1, f);
		return f[n];
	}
}

Measured memory_bytes: 26352
s = input()

flag = True

if s[0] != "A":
    flag = False

if not "C" in s[2:-1] or not s[2:-1].count("C") == 1:
    flag = False
    
if s.replace("A", "").replace("C", "").islower() == False:
    flag = False

if flag:
    print("AC")
else:
    print("WA")

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
using namespace std;

int main() {

	string a;
	int b;
	int b2;
	string c;

	while (cin >> a, a != "-") {

		cin >> b;

		for (int i = 0; i < b; i++) {
			//c = istringstream(b);
			//int num = atoi(b.c_str());
			//c >> num;
			cin >> b2;
			a = a + a.substr(0, b2);
			a.erase(0, b2);
		}

		//c = c + a + "\n";
		cout << a << endl;

	}

	//cout << c << endl;

	return 0;
}


Measured memory_bytes: 3176
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using llong = long long;
using ullong = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()
#define loop(i, times) for (llong i = 0; i < times; i++)
#define rloop(i, times) for (llong i = times -1; 0 <= i; i--)

std::chrono::system_clock::time_point  start;

void TimeStart(void)
{
	start = std::chrono::system_clock::now();
}

void TimeEnd(void)
{
	auto time = std::chrono::system_clock::now() - start;
	auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count();
	cerr << endl << msec << " msec " << endl;
}

#endif

int main(void)
{
	llong a;  cin >> a;
	llong b;  cin >> b;
	llong t;  cin >> t;

	cout << t / a * b;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion
#pragma region chminmax
template <typename T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> c(m);
    rep(i, m) cin >> c[i];

    vector<vector<int>> dp(m + 1, vector<int>(n + 1, n + 5));
    rep(i, n + 1) dp[0][i] = i;

    rep(i, m)
    {
        rep(j, n + 1)
        {
            // no use
            chmin(dp[i + 1][j], dp[i][j]);

            // use
            if (j - c[i] >= 0)
            {
                chmin(dp[i + 1][j], dp[i + 1][j - c[i]] + 1);
            }
        }
    }

    cout << dp[m][n] << endl;

    return 0;
}


Measured memory_bytes: 7132
import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

A, B, C = inpl()
k = int(input())

while A >= B:
    k -= 1
    if k < 0:
        print('No')
        sys.exit()
    B *= 2
while B >= C:
    k -= 1
    if k < 0:
        print('No')
        sys.exit()
    C *= 2

print('Yes')



# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)


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

#define rep(i,b) for(long long i = 0; i < (b); i++)
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
using ll = long long;

ll lcm(ll a,ll b){
	
	return (a*b)/(__gcd(a,b));
}

void solve() 
{ 
int n;
cin>>n;


vector<int> p(n);
vector<int> q(n);
rep(i,n){
	cin>>p[i];
}

rep(i,n){
	cin>>q[i];
}
vector<int> v;
rep(i,n){
	v.push_back(i+1);
}
int a=0;
int b=0;
int i=1;
while(next_permutation(all(v)))
{
	if(v==p){
		a=i;
	}
	if(v==q){
		b=i;
	}
	i++;
}
cout<<abs(a-b);

}
 

int main(){


		solve();
		cout<<endl;
	

	
					
}
		

	

		

 



Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
int N,M,R,Q;
int use[10010][1270] = {};

int main(){
	while(cin >> N >> M && N>0){
		cin >> R;
		int t,n,m,s;
		for(int i=1;i<=M;i++){
			for(int j=540;j<=1260;j++){
				use[i][j] = 0;
			}
		}
		for(int i=0;i<R;i++){
			cin >> t >> n >> m >> s;
			if(s==1) use[m][t]++;
			else use[m][t]--;
		}
		for(int i=1;i<=M;i++){
			for(int j=540;j<=1260;j++){
				use[i][j] += use[i][j-1];
			}
		}
		cin >> Q;
		int ts,te;
		for(int i=0;i<Q;i++){
			cin >> ts >> te >> m;
			int ans = 0;
			for(int j=ts;j<te;j++){
				if(use[m][j]>=1) ans++;
			}
			cout << ans << endl;
		}
	}
}


Measured memory_bytes: 51068
a1 = [int(i) for i in input().split()]
a2 = [int(i) for i in input().split()]
a3 = [int(i) for i in input().split()]



a = a1+a2+a3
n = int(input())
ans = [int(input()) for _ in range(n)]

aa = [0] * 9
for i in ans:
    for ind,j in enumerate(a):

        if i==j:

            aa[ind]=1

f=0
if aa[0]==1 and	aa[1]==1 and aa[2]==1:
    f=1
elif aa[0]==1 and aa[3]==1 and aa[6]==1:
    f=1
elif aa[3]==1 and aa[4]==1 and aa[5]==1:
    f=1
elif aa[6]==1 and aa[7]==1 and aa[8]==1:
    f=1
elif aa[7]==1 and aa[4]==1 and aa[1]==1:
    f=1
elif aa[2]==1 and aa[5]==1 and aa[8]==1:
    f=1
elif aa[6]==1 and aa[4]==1 and aa[2]==1:
    f=1
elif aa[0]==1 and aa[4]==1 and aa[8]==1:
    f=1
if f==1:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 3064
n,k=map(int,input().split())
mod=10**9+7
ans=0
for i in range(k,n+2):
  down=i*(i-1)//2
  up=n*(n+1)//2-(n-i)*(n-i+1)//2
  ans+=up-down+1
  ans%=mod
print(ans)

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

int main()
{
	string t;
	int A = 0, B = 0, AB = 0, O = 0;

	while (cin >> t)
	{
		while (true)
		{
			t.erase(0, 1);
			if (t[0] == ',') break;
		}
		t.erase(0, 1);

		if (t == "A") A++;
		if (t == "B") B++;
		if (t == "AB") AB++;
		if (t == "O") O++;
	}

	cout << A << endl;
	cout << B << endl;
	cout << AB << endl;
	cout << O << endl;

	return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n;
    scanf("%d",&n);
    char a[n];
    scanf("%s",a);
    int i=0,j=n-1;
    int count=0;
    while(i<j)
    {
        while(a[j]=='W'&&i<j)
            j--;
        while(a[i]=='R'&&i<j)
            i++;
        if(i<j)
        {
            count++;
            j--,i++;
        }
    }
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 4012