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

int main(){
  static const double pi = 3.14159265358979323846;
  double A, B, H, M;
  double Ta, Tb, ans, x, y;
  
  std::cin >> A >> B >> H >> M;
  
  Ta = 30 * H + 0.5 * M;
  Tb = 6 * M;
  x = std::abs(A * std::sin(pi * Ta / 180) - B * std::sin(pi * Tb / 180));
  y = std::abs(A * std::cos(pi * Ta / 180) - B * std::cos(pi * Tb / 180));
  ans = sqrt(std::pow(x,2) + std::pow(y,2));
  
  std::cout << std::fixed;
  std::cout << setprecision(20) << ans << std::endl;
}
  

  
  

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

// Trie
// 遷移テーブルによる実装 prefixで検索
// 単語の開始終了が分からなくても探索できる(O(|S|*m))
// この実装はメモリバカ食いする 特に疎(少単語数長単語長)の場合に無駄が多い
// 1node=4*27B~=100B 単語数W=10^3 単語長L=10^3 -> 10^8 Byte あたりが限界
// verified: https://atcoder.jp/contests/tenka1-2016-final-open/submissions/6394152
struct alphabetToIndex { constexpr int operator ()(char c) const { return c - 'a'; } };
template<typename T = char, int N = 26, class F = alphabetToIndex>
struct Trie {
    struct Node {
        T lavel; array<int, N> children; int id;
        Node(T c) : lavel(c), id(-1) { fill(children.begin(), children.end(), -1); }
    };
    const F f = F();
    vector<Node> v;
    Trie() { v.emplace_back('^'); } // ('^') ←かわいい
    template<class U> int add(U&& s, int id = 0) {
        int index = 0;
        for (int i = 0; i < s.size(); ++i) {
            int k = f(s[i]);
            if (~v[index].children[k]) {
                index = v[index].children[k];
                continue;
            }
            v[index].children[k] = v.size();
            index = v.size();
            v.emplace_back(s[i]);
        }
        v[index].id = id;
        return index;
    }
    template<class U> int search(U&& s) {
        int index = 0;
        for (int i = 0; i < s.size(); ++i) {
            int k = f(s[i]);
            if (~v[index].children[k]) {
                index = v[index].children[k];
                continue;
            }
            return -1;
        }
        return index;
    }
    template<class U> int exactMatchSearch(U&& s) {
        int index = search(s);
        return v[index].id < 0 ? -1 : index;
    }
};

constexpr int N_CHAR = 'T' - 'A' + 1;
struct BaseToIndex {
    constexpr int operator ()(char c) const { return c - 'A'; }
};

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

    Trie<char, N_CHAR, BaseToIndex> trie;
    for (int i = 0; i < N; ++i) {
        string q, s;
        cin >> q >> s;
        if (q == "insert") {
            trie.add(s);
        }
        else {
            int ret = trie.exactMatchSearch(s);
            cout << (ret < 0 ? "no" : "yes") << endl;
        }
    }
}


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

int main()
{
  int a, b, x;
  long double radian;
  cin >> a;
  cin >> b;
  cin >> x;

  long double len = ((long double)(2 * x) / (a * a)) - b;
  if (len > 0)
  {
    radian = atan2l((long double)a, b - len);
  }
  else
  {
    len = (long double)(2 * x) / (a * b);
    radian = atan2l(len, (long double)b);
  }
  long double degree = radian * 180 / M_PI;
  printf("%Lf\n",90-degree);
}


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

int main() {
  int n, m;
  while(cin>>n>>m, n+m) {
    vector<int> a;
    a.push_back(0);
    for (int i=0; i<n; i++) {
      int tmp;
      cin >> tmp;
      a.push_back(tmp);
    }
    for (int i=0; i<m; i++) {
      int tmp;
      cin >> tmp;
      a.push_back(tmp);
    }
    int ans=0;
    sort(a.begin(), a.end());
    for(int i=1; i<a.size(); i++) {
      ans =max(ans, a[i]-a[i-1]);
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 0
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    X, Y, Z = map(int, input().split())
    print(str(Z) + " " + str(X) + " " + str(Y))


if __name__ == '__main__':
    main()

Measured memory_bytes: 66028
#include <stdio.h>
#include <string.h>
#define N 100005

typedef struct {
	char name[100];
	int t;	
}P;

P Q[N];
int head,tail,n;

void enqueue(P x){
	Q[tail] = x;
	tail = (tail + 1) % N;
}

P dequeue(){
	P x = Q[head];
	head = (head + 1) % N;
	return x;
}

int min(int a, int b){
	return a<b?a:b;
}

int main(){
	int elaps = 0,c;
	int i,q;
	P u;

	scanf("%d %d",&n,&q);

	for(i=1;i<=n;i++){
		scanf("%s %d",Q[i].name,&Q[i].t);
	}

	head = 1;
	tail = n + 1;

	while(head != tail){
		u=dequeue();
		c = min(q,u.t);
		u.t-=c;
		elaps += c;
		if(u.t > 0) enqueue(u);
	else{
		printf("%s %d\n",u.name,elaps);
	}
	}
	return 0;
}


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

int main() {
  string s;
  cin >> s;
  ll k;
  cin >> k;
  int n = s.size();
  string t = s + s;
  string u = s;
  bool a = true;
  rep(i,n-1) {
    if(s.at(i)!=s.at(i+1)) a = false;
  }
  if(a) {
    cout << n*k/2 << endl;
    return 0;
  }
  ll cnt1 = 0;
  rep(i,n-1) {
    if(s.at(i)==s.at(i+1)) {
      s.at(i+1) = 'A';
      cnt1++;
    }
  }
  ll cnt2 = 0;
  rep(i,t.size()-1) {
    if(t.at(i)==t.at(i+1)) {
      t.at(i+1) = 'A';
      cnt2++;
    }
  }
  if(u.at(0)==u.at(n-1)) cout << cnt1 + (cnt2-cnt1)*(k-1) << endl;
  else cout << cnt1 * k << endl;
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

class State {
public:
  int pos;
  int cost;
  int prev_hand;
  int prev_pos;
  State(int _p,int _c) : pos(_p),cost(_c),prev_hand(-1000),prev_pos(-1000) {}
  State(int _p,int _c,int _ph,int _pp) : pos(_p),cost(_c),prev_hand(_ph),prev_pos(_pp) {}
  bool operator<(const State& s) const{
    return cost < s.cost;
  }
  bool operator>(const State& s) const{
    return cost > s.cost;
  }
};

struct DP{
  int cost;
  int prev_hand;
  int prev_pos;
  DP(int _c,int _ph,int _pp) : cost(_c),prev_hand(_ph),prev_pos(_pp){}
  DP() : cost(INF),prev_hand(-1000),prev_pos(-1000){}
};

int main(){
  int total_cells;
  while(~scanf("%d",&total_cells)){
    int dice[7];
    for(int i=1;i<=6;i++){
      scanf("%d",dice + i);
    }
    int start,goal;
    scanf("%d %d",&start,&goal);
    int stage[303];
    for(int i=1;i<=total_cells;i++){
      scanf("%d",stage + i);
    }
    
    priority_queue<State,vector<State>,greater<State> > que;
    que.push(State(start,0,-1000,-1000));

    DP dp[303];

    while(!que.empty()){
      State s = que.top();
      que.pop();

      if(dp[s.pos].cost <= s.cost) continue;

      dp[s.pos].cost = s.cost;
      dp[s.pos].prev_hand = s.prev_hand;
      dp[s.pos].prev_pos = s.prev_pos;

      for(int i=1;i<=6;i++){
            int dx1 = s.pos + dice[i];
            int dx2 = s.pos - dice[i];

            if(1 <= dx1 && dx1 <= total_cells){
              dx1 += stage[dx1];
              que.push(State(dx1,s.cost + 1,i,s.pos));
            }
            if(1 <= dx2 && dx2 <= total_cells){
              dx2 += stage[dx2];
              que.push(State(dx2,s.cost + 1,-i,s.pos));
            }
      }
    }

    vector<int> hands;
    int prev_x = goal;
    for(int round = 0;round <= 3000;round++){
      hands.push_back(dp[prev_x].prev_hand);
      prev_x = dp[prev_x].prev_pos;
      if(prev_x == start) break;
    }

    reverse(hands.begin(),hands.end());

    int hand_idx = 0;
    for(int round = 0;round <= 3000;round++){
      int num;
      scanf("%d", &num);
      
      if(num != abs(hands[hand_idx])){
            printf("0\n"); fflush(stdout);
      }

      else if(num == abs(hands[hand_idx])){
            if(hands[hand_idx] > 0){
              printf("1\n"); fflush(stdout);
            }
            else{
              printf("-1\n"); fflush(stdout);
            }
            hand_idx++;
      }

      if(hand_idx >= hands.size()) break;
    }
  }
}

Measured memory_bytes: 1308
/*

  _|_|                              _|  _|    _|
_|    _|  _|  _|_|  _|_|_|_|        _|  _|  _|
_|    _|  _|_|          _|          _|  _|_|
_|    _|  _|          _|      _|    _|  _|  _|
  _|_|    _|        _|_|_|_|    _|_|    _|    _|

*/
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
//#define ls (rt<<1)
//#define rs (rt<<1|1)
#define vi vector<int>
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define rep(i,a,b) for(int i=(a),i##end=(b);i<=i##end;i++)
#define fi first
#define se second
typedef long long ll;
using namespace std;
const int maxn=3*5005;
char s[maxn],t[maxn];
vi marks,markt;
int a[maxn],b[maxn];
int main(){
    int n;scanf("%d%s%s",&n,s+1,t+1);
    if(s[1]=='1')marks.pb(0);
    rep(i,1,n-1)if(s[i]!=s[i+1])marks.pb(i);
    if(s[n]=='1')marks.pb(n);
    if(t[1]=='1')markt.pb(0);
    rep(i,1,n-1)if(t[i]!=t[i+1])markt.pb(i);
    if(t[n]=='1')markt.pb(n);
    int cnts=marks.size(),cntt=markt.size(),add=cntt-cnts;
    int ans=1e9+100;
    rep(i,1,cnts)a[i+cntt]=marks[i-1];
    rep(i,1,cntt)a[i+cnts+cntt]=n;
    for(int i=0;i<=cnts+cntt;i+=2){
        int tmp=0;
        rep(j,1,i)b[j]=0;
        //cout<<markt[0]<<endl;
        rep(j,1,cntt)
        b[i+j]=markt[j-1];
        rep(j,1,cnts+cntt-i)b[j+i+cntt]=n;
        rep(j,1,cnts+cntt*2)tmp+=abs(a[j]-b[j]);
        ans=min(ans,tmp);
    }
 /*   rep(i,-cnts,cnts+add){//从开头通过的
        int tmp=0;
        int but=add-i;//从结尾通过的
        if(i<0){
            rep(j,1,-i)tmp+=abs(s[i-1]-0);
            rep(j,-i+1,cnts)tmp+=abs(s[i-1]-t[j+i-1]);
            rep(j,cnts+i+1,cnts)tmp+=abs(n-t[j-1]);
        }
        else{
            rep(j,cnts+but+1,cnts)tmp+=abs(s[i-1]-n);
            for(int j=cnts+but;j>=i;j--)tmp+=abs(s[i-1]-t[i-1]);
            rep(j,1,i)tmp+=t[i];
        }
        ans=min(ans,tmp);
        cout<<tmp<<endl;
    }*/
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3952
#include <cstdio>
#include <cctype>
#include <utility>
#include <string>
using namespace std;

#define _gp(l) const auto gcu{getchar##l}; const auto pcu{putchar##l}
#ifdef __linux
_gp(_unlocked);
#else
_gp();
#endif
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template<typename T>
#define _HT template<typename H,typename... T>
_T _DEF(T,in,int c){T n{};int m{1};while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int,in,){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_SCAN(char &c){c=gcu();gcu();return c!=EOF;}
_T _SCAN(T &n){int c{gcu()};return c==EOF?false:(n=in<T>(c),true);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=(char)c;}}
_OUT(string s){for(char c:s)pcu(c);}
#endif
_OUT(const char *s){while(*s)pcu(*s++);}
_T _OUT(T n){static char b[20];char *p{b};T m=n<0?pcu('-'),-1:1;if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}
struct range{int e,b{0},s{1};range(int _b,int _e,int _s):e(_e),b(_b),s(_s){}range(int _b,int _e):e(_e),b(_b){}range(int _e):e(_e){}
	struct it{int v,s;it(int _v,int _s):v(_v),s(_s){}operator int()const{return v;}operator int&(){return v;}int operator*()const{return v;}it& operator++(){v+=s;return *this;}};
	it begin(){return{b, s};}it end(){return{e,s};}};

int main() {
	const string s {"thufrisatsunmontuewed"};
	outl(s.substr(in() % 7 * 3, 3));
}


Measured memory_bytes: 2760
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int DX[] = {0, 1, 0, -1};
const int DY[] = {-1, 0, 1, 0};


//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

	for(int n, s; cin >> n  >> s, n | s;){
		// 0~100, , それまで合計
		vector<vector<vector<LL> > > dp(101 + 1,  vector<vector<LL> >(n + 1, vector<LL>(s + 1)));
		dp[0][0][0] = 1;
		REP(i, 101){
			REP(j, n + 1){
				REP(k, s + 1){
					if(j + 1 <= n && k + i <= s){
						dp[i + 1][j + 1][k + i] += dp[i][j][k];
					}
					dp[i + 1][j][k] += dp[i][j][k];
				}
			}
		}
		cout << dp[101][n][s] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 8536
import math
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
mod = 10**9 + 7

#maincode-------------------------------------------------

n = ini()
ans = 0

for i in range(1,n):
    ans += int((n-1)/i)

print(int(ans))

Measured memory_bytes: 9308
#include <bits/stdc++.h>
//#include <complex>
#define INF 1000000021
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222
#define fauto(it, c) for(__typeof((c).begin())  it=(c).begin();it!=(c).end();it++)

using namespace std;
//using namespace __gnu_pbds;
 
typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}
 
//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

ll MOD = 1000000007ll;
string s;
int n;
ll dp[N][20];
ll f(int id, int x)
{
	if(id == n)
		return (x == 5);
	if(dp[id][x] != -1)
		return dp[id][x];
	ll ans = 0;
	if(s[id] != '?')
	{
		int q = x;
		q *= 10;
		q += (s[id] - 48);
		q %= 13;
		ans = f(id +1, q);
	}
	else
	{
		for(int i = 0; i <= 9; i ++)
		{
			int q = x;
			q *= 10;
			q += i;
			q %= 13;
			ans = (ans + f(id + 1, q)) % MOD;
		}
	}
	return dp[id][x] = ans % MOD;
}

int main()
{
	memset(dp, -1, sizeof dp);
	cin >> s;
	n = s.size();
	cout << f(0, 0);


		

}

















Measured memory_bytes: 43008
#include <stdio.h>
int main(){

int i,a,b,j;
while(1){
    scanf("%d%d",&a,&b);
    if(a==0&&b==0){break;}
    for(i=1;i<=a;i++){
        for(j=1;j<=b;j++){
            if(i>1&&i<a&&j>1&&j<b)printf(".");
            else printf("#");
        }printf("\n");
    }printf("\n");
}







return 0;}



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

int main() {
  int n;
  cin >> n;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    if (i % 2 == 1 && a % 2 == 1) cnt++;
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    string s, t = "";
    cin >> s;
    for(int i = 0; i < s.length(); i++){
        if(s[i] == '0') t += "0";
        else if(s[i] == '1') t += "1";
        else{
            if(t.size() != 0) t.erase(t.end()-1);
        }
    }
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
	map<int, int>ans;
	int now = 2;
	while (now * now <= x) {
		if (x % now == 0) {
			x /= now;
			ans[now]++;
		}
		else now++;
	}
	if (x != 1) ans[x]++;
	return ans;
}
int comb(int n, int k) {
	k = min(k, n - k);
	int x = 1, y = 1;
	rep(i, k) {
		y *= i + 1;
		y %= MOD;
	}
	for (int i = n - k + 1; i <= n; i++) {
		x *= i;
		x %= MOD;
	}
	return x * modinv(y, MOD) % MOD;
}

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

	int n, s;
	int ans = 0;
	int a[3005];
	cin >> n >> s;
	rep(i, n) {
		cin >> a[i];
	}
	int dp[3005][3005];
	rep(i, n + 1) {
		rep(j, s + 1) {
			dp[i][j] = 0;
		}
	}
	rep(i, n) {
		dp[i][0] = 1;
	}
	rep(i, n) {
		rep(j, s + 1) {
			dp[i + 1][j] += dp[i][j];
			dp[i + 1][j] %= 998244353;
		}
		for (int j = 0; j <= s - a[i]; j++) {
			if (j == s - a[i]) {
				ans += dp[i][j] * (n - i);
				ans %= 998244353;
			}
			else {
				dp[i + 1][j + a[i]] += dp[i][j];
				dp[i + 1][j + a[i]] %= 998244353;
			}
		}
	}
	/*rep(i, n + 1) {
		rep(j, s + 1) {
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}*/
	cout << ans << endl;

	return 0;
}


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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef long long ll;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define fi first
#define se second

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

    ll n;
    cin >> n;

    string res = "";
    
    int duz = 1;
    ll temp = 26;

    while(n > temp)
    {
        n -= temp;
        temp *= 26LL;
        ++duz;
    }

    --n;

    for(int i = 0; i < duz; ++i)
    {
        res += ('a' + n % 26);
        n /= 26;
    }

    reverse(all(res));

    cout << res << '\n';

    return 0;
}



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

int count_abc(int N, string S){
    int count = 0;
    int judge = 0;
    for(int i = 0; i < N; i++){
        if(S.at(i) == 'A'){
            judge = 1;
        }
        else if(judge == 1 && S.at(i) == 'B'){
            judge++;
        }
        else if(judge == 2 && S.at(i) == 'C'){
            count++;
            judge = 0;
        }
        else{
            judge = 0;
        }
    }
    return count;
}

int main() {
    int N;
    string S;
    cin >> N >> S;

    cout << count_abc(N, S) << endl;

    return 0;
}

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

bool f(string str){
	int size = str.size();
	for(int i=0;i<size;++i){
		if(str[i] != str[size - 1 - i]){
			return false;
		}
	}
	int x = (size-1)/2;
	for(int i=0;i<x;++i){
		if(str[i] != str[x - 1 - i]){
			return false;
		}
	}
	int y = (size+3)/2;
	for(int i=y-1;i<x;++i){
		if(str[i] != str[x - 1 - i]){
			return false;
		}
	}
	return true;
}

int main(){
	string str;
	cin >> str;
	string ans = (f(str))?"Yes":"No";
	cout << ans;
	return 0;
}

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

int main() {
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    vector< int> a(n), b(m);
    for (int &i : a) cin >> i;
    for (int &i : b) cin >> i;

    for(int i = x + 1; i <= y; ++i) {
        bool ok = true;
        for(int j: a) if(j >= i) ok = false;
        for(int j: b) if(j < i) ok = false;
        if(ok) return !printf("No War");
    }

    puts("War");

}

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

const int MAXN = 1005;
const int MAXV = MAXN * (MAXN - 1) /2;
vector<int> to[MAXV];
int id[MAXN][MAXN];

int toId(int i, int j) {
    if (i > j) swap(i, j);
    return id[i][j];
}

bool visited[MAXV];
bool calced[MAXV]; // 計算中のunvisitedに当たったらループしている.
int dp[MAXV];
// dfsをしながらトポロジカルソート
int dfs(int v) { // dp[v] の値を返す
    if (visited[v]) {
        if (!calced[v]) return -1;
        return dp[v];
    }
    visited[v] = true;
    dp[v] = 1;
    for (int u : to[v]) {
        int res = dfs(u);
        if (res == -1) {
            return -1;
        }
        // 行先から先に詰め込んでいく.
        // 一つ先の行き先は, 一日後にしておく.
        // すべてのそこからいける頂点に対して, 
        dp[v] = max(dp[v], res + 1);
    }
    calced[v] = true;
    return dp[v];
}

signed main() {

    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    // A_(j, i + 1) の試合は A(j, i)の試合が行われてから行わなければならない
    // AをやってからBをやらなくてはいけないときに, A->B (今回はA -> B)という風にする
    // この時のグラフがDAGになっていないといけない(ループがないグラフ)
    // DAGになっていないとき, 上流の辺から番号を続かないように割り当てていけばいい
    // トポロジカルソート i -> jのとき A_i < A_jになるように並べる. これはDAGだったらできる.
    // 
    
    /*
        トポロジカルソートはノードと編の数に対して, $O(V + E)$ の線形な時間を必要とする.

        * まず入力編を持たない開始ノードを探して, それを集合Sに追加する.
        グラフに閉路がなければ, 少なくとも1つはそういうノードが存在する.
        すべての頂点に対して入力辺があれば, 開始点がなくてループしている. -> DAGではないなぁ

        vector<Node> L(N) // トポロジカルソートをした結果
        queue<Node> s;
        while (!s.empty()) {
            Node n = s.top();
            s.pop();
            L.push_back(n);
            for (Node& e: n.to) {
                e.from.remove(n);
                if (e.from.empty()) {
                    s.push_back(n.to)
                }
            }
        }
        if (グラフに片が残っている) {
            閉路がありDAGではないのでちゅだん
        }

        # 深さ優先探索版
        vector<Node> L(N) // トポロジカルソートをした結果
        void visit(Node n) {
            if (visited[n]) return;
            visited[n] = true;
            for (Node & e : n.to) {
                visit(m);
            }
            L.push_back(N);

        }


    */

    int n;
    cin >> n;
    vector<vector<int>> a(n, vector<int>(n - 1));
    for (int i = 0; i < n; i ++) {
        for (int j = 0; j < n - 1; j++){
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    int V = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i < j) {
                id[i][j] = V++;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n - 1; j++) {
            // a[i][j]をiの人のj番目の対戦者から
            // iの人のj番目の対戦の番号に変換する
            a[i][j] = toId(i, a[i][j]);
        }
        for (int j = 0; j < n - 2; j++) {
            // 対戦番号のノードに順に突っ込む
            // 
            to[a[i][j + 1]].push_back(a[i][j]);
        }
        // これで例のグラフは完成
    }
    int ans = 0;
    for (int i = 0; i < V; i++) {
        // dfs(i) 何日目にそれをやるか.
        int day = dfs(i);
        if (day == -1) {
            cout << -1 << endl;
            return 0;
        }
        ans = max(ans , dfs(i));
    }
    cout << ans << endl;
}

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

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

    cout << (n == 100 ? 101 : n);

    if(d==0){
        cout << endl;
        return 0;
    } else if (d==1) {
        cout << "00";
    } else if (d==2) {
        cout << "0000";
    } else {
        cout << "000000";
    }

    cout << endl;

    return 0;
}

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int arr[N + 2];
long double pi = 3.14159265;

void solve()
{
	double n;
	cin >> n;
	cout << fixed << setprecision(12) << 2 * pi*n << endl;

}

int32_t main()
{
	ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);


	cout << setprecision(9) << fixed;
	clock_t z = clock();

	// cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);
	int test = 1;
	// cin >> test;
	while (test--)solve();


}





Measured memory_bytes: 3808
def getlcm(a,b):
    aa=a
    bb=b
    while aa!=0:
        [aa,bb]=[bb%aa,aa]
    return a*b/bb

while(1):
    [n,a,b]=[int(x) for x in raw_input().split()]
    if n==0:
        break
    else:
        [a,b]=[min(a,b),max(a,b)]
        LCM=getlcm(a,b)
        #able=[]
        able=-1
        for i in range(LCM/a):
            for j in range((n-a*i)/b+1):
                able+=1
        ans=n-able
        print ans

Measured memory_bytes: 14776
#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;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll ans = 0;
    for(int i = 1; i <= n; i++) {
        ll m = n / i;
        ans += m * (m + 1) * i / 2;
    }
    cout << ans << endl;
}

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

int main() {
    int n;
    ll k;
    cin >> n >> k;
    ll a[n], x = 0;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 60; i >= 0; i--) {
        int c = 0;
        for (int j = 0; j < n; j++) {
            if (a[j] >> i & 1) c++;
        }
        if (c * 2 <= n && (x + (1LL << i)) <= k) x += (1LL << i);
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) ans += a[i] ^ x;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
use io::*;
use std::*;

fn solve(N: i64, K: i64, l: Vec<i64>) {
    let mut v = l;
    v.sort_by(|a, b| b.cmp(a));
    let ans: i64 = v[0..K as usize].iter().sum();
    println!("{}", ans)
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
fn main() {
    let con = read_string();
    let mut scanner = Scanner::new(&con);
    let mut N: i64;
    N = scanner.next();
    let mut K: i64;
    K = scanner.next();
    let mut l: Vec<i64> = vec![0i64; (N) as usize];
    for i in 0..(N) as usize {
        l[i] = scanner.next();
    }
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(move || solve(N, K, l)).unwrap().join().unwrap();
}

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Measured memory_bytes: 8572
var input = ""
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});

process.stdin.on('end', function() {
  input = input.split("\n");
  i = 0
  while (input[i] != 0) {
    arr = input[i].split(" ");
    sum = 0;
    arr[0] = Number(arr[0]);
    arr[1] = Number(arr[1]);

    console.log(Math.floor(arr[0] / arr[1]));
    console.log(arr[0] % arr[1]);
    console.log((arr[0] / arr[1]).toFixed(10));

    i++;
  }
});

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

struct Node {
  int key;
  Node *parent, *left, *right;
};

Node* NIL;

int m;
Node* root;

void init() {
  NIL = new Node;
  NIL->parent = NIL;
  NIL->left = NIL;
  NIL->right = NIL;
  root = NIL;
}

void insert(Node* z) {
  Node* y = NIL;
  Node* x = root;
  while (x != NIL) {
    y = x;
    if (z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;

  if (y == NIL) root = z;
  else if (z->key < y->key) y->left = z;
  else y->right = z;
}

void preParse(Node* u) {
  if (u == NIL) return;
  cout << " " << u->key;
  preParse(u->left);
  preParse(u->right);
}

void inParse(Node* u) {
  if (u == NIL) return;
  inParse(u->left);
  cout << " " << u->key;
  inParse(u->right);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  init();
  cin >> m;
  rep(i, m) {
    string com;
    int key;
    cin >> com;
    if (com == "print") {
      inParse(root);
      cout << endl;
      preParse(root);
      cout << endl;
    } else {
      cin >> key;
      Node* z = new Node {key, NIL, NIL, NIL};
      insert(z);
    }
  }
}



Measured memory_bytes: 26596
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;
const long long mod=1e9+7;
const long long INF=1LL<<60;

int main(){
   int k;
   cin>>k;
   if(k%2==0)cout<<(k/2)*(k/2)<<endl;
   else cout<<(k/2)*(k/2+1)<<endl;
}
 
   

Measured memory_bytes: 256
#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>
// C++
#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 <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#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>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
//#define all(v) ((v).begin(),(v).end())
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
    int n;
    cin>>n;
    vector<string> v(n);
    map<string,int> mp;
    rep(i,0,n){
        cin>>v[i];
        //cout<<mp[v[i]]<<endl;
        if(mp[v[i]]!=0){
            cout<<"No"<<endl;
            return 0;
        }
        mp[v[i]]++;
        if(i&&v[i][0]!=v[i-1][v[i-1].size()-1]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
        return 0;

}




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

int main(){
    string s;
    cin>>s;
    int a,z,n=s.size();
    rep(i,n){
        if(s[i]=='Z')z=i;
    }
    for(int i=n-1; i>=0; --i){
        if(s[i]=='A')a=i;
    }
    cout<<z-a+1<<endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
main(){
  int X;
  cin>>X;
  int bp_max=1;
  for(int p=1;p<=X;++p){
    for(int b=2;b<=X;++b){
      int power=pow(p,b);
      if(power>X)break;
      bp_max=max(bp_max,power);
    }
  }
  cout<<bp_max<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}

int main(){
    int x=0,n,g,m,p,h,k,min=400000001,ans=0,sum=0;
    string s;
    bool f=true;
    cin >> n;
    VI a(n);
    VI b(8);
    rep(i,n){
        cin >> a[i];
        if(a[i]>=1 && a[i]<=399){
            if(b[0]==0)
                b[0] = 1;
        }
        else if(a[i]>=400 && a[i]<=799){
            if(b[1]==0)
                b[1] = 1;
        }
        else if(a[i]>=800 && a[i]<=1199){
            if(b[2]==0)
                b[2] = 1;
        }
        else if(a[i]>=1200 && a[i]<=1599){
            if(b[3]==0)
                b[3] = 1;
        }
        else if(a[i]>=1600 && a[i]<=1999){
            if(b[4]==0)
                b[4] = 1;
        }
        else if(a[i]>=2000 && a[i]<=2399){
            if(b[5]==0)
                b[5] = 1;
        }
        else if(a[i]>=2400 && a[i]<=2799){
            if(b[6]==0)
                b[6] = 1;
        }
        else if(a[i]>=2800 && a[i]<=3199){
            if(b[7]==0)
                b[7] = 1;
        }
        else if (a[i] >=3200){
            sum++;
        }
	}
    rep(i,8){
        if(b[i]==1)
            ans++;
    }
    cout << max(ans,1) << " " << ans+sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>

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

int main(void)
{
	string S, T;
	cin >> S >> T;
	int ans = 0;
	rep(i, 3) if (S[i] == T[i]) ans++;

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


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

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;

  vector<int> A(N);
  vector<long long> S(N + 1, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    S[i + 1] = S[i] + A[i];
  }

  long long ans = 0;
  map<long long, int> mp;
  for (int i = 0; i <= N; i++) {
    int left = i - K;
    if (left >= 0) {
      long long x = ((S[left] - left) % K + K) % K;
      mp[x]--;
    }
    long long X = ((S[i] - i) % K + K) % K;
    ans += mp[X]++;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 15104
#include <bits/stdc++.h>
#define X first
#define Y second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int main() {
	fastio;
	string S;
	int K;
	cin >> S >> K;

	ll cnt = 0;
	if (count(all(S), S[0]) == sz(S)) {
		string tmp = S + S;
		for (int i = 1; i < sz(tmp); ++i) {
			if (tmp[i] == tmp[i - 1]) {
				++cnt;
				tmp[i] = '#';
			}
		}

		cnt *= K / 2;

		if (K & 1) {
			for (int i = 1; i < sz(S); ++i) {
				if (S[i] == S[i - 1]) {
					++cnt;
					S[i] = '#';
				}
			}
		}

		cout << cnt;
		return 0;
	}

	string tmp = S;

	for (int i = 1; i < sz(S); ++i)
		if (S[i] == S[i - 1]) {
			++cnt;
			S[i] = '#';
		}

	ll cnt2 = 0;
	S = S.back() + tmp;

	for (int i = 1; i < sz(S); ++i) {
		if (S[i] == S[i - 1]) {
			++cnt2;
			S[i] = '#';
		}
	}

	cout << cnt + cnt2 * (K - 1);

	return 0;
}

Measured memory_bytes: 256
import java.io.*;

public class Main {

	//ツ　0002
	public static void main(String[] args) throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

		for(;;) {
		
			String s = reader.readLine();
			if (s == null)
				break;
			
			String[] sp = s.split(" ");
			int a = Integer.parseInt(sp[0]);
			int b = Integer.parseInt(sp[1]);
			int c = a+b;
			String ans = "" + c;
			System.out.printf("%s\n", ans.length());
		}
		reader.close();
	}
}

Measured memory_bytes: 12000
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    ll x;
    cin>>x;
    ll a=100;
    long double c;
    double r = 1.01;
    ll cnt =0;
    while(a<x){
        c = (long double)a*r;
        a = (long long)c;
        cnt++;
        //cout<<c<<" "<<a<<" "<<cnt<<endl;
    }
    cout<<cnt<<endl;
    return 0;
}



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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(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) long long(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>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll r,g,b,n; cin>>r>>g>>b>>n;
  ll ans=0;
  rep(i,n+1){
    rep(j,n+1){
      ll rem=n-i*r-j*g;
      if(rem<0 || rem%b!=0) continue;
      rem/=b;
      if(rem<=n){
        ans++;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3660
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args)
	{
		Scanner s=new Scanner(System.in);
		
		int a=s.nextInt();
		int b=s.nextInt();
		
		if(a<=b)
		{
			System.out.println("unsafe");
		}
		else
		{
			System.out.println("safe");
		}
		
	}
	
}

Measured memory_bytes: 35764
/******************************************
*    AUTHOR:         julianferres         *
******************************************/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl
const ll INF = 1LL<<62;
#define MOD 1000000007
#define MAXN 200005

int main(){
    FIN;
    ll n;
    cin >> n;
    vi dp(n,INF), a(n);
    dp[0] = 0;
    forn(i, n) cin >> a[i];

    forn(i,n){
        if (i+1<n)
            dp[i + 1] = min(dp[i + 1], dp[i] + abs(a[i + 1] - a[i]));
        if (i + 2 < n)
            dp[i + 2] = min(dp[i + 2], dp[i] + abs(a[i + 2] - a[i]));
    }

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



Measured memory_bytes: 1792