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

int main() {
  int N, K; cin >> N >> K;
  vector<long long> v(K, 0);
  for (int i = 1; i <= N; i++) v.at(i % K)++;
  long long ans = 0;
  for (int a = 0; a < K; a++) {
    int b = (K - a) % K;
    int c = (K - a) % K;
    if ((b + c) % K != 0) continue;
    ans += v.at(a) * v.at(b) * v.at(c);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int sum=0;
  long int n,k,i;
  cin>>n>>k;
  long int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  sort(a,a+n);
  for(i=0;i<n-k;i++)
  {
    sum+=a[i];
  }
  cout<<sum;
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define endl "\n"
#define ll long long
#define sz(s) (int)(s.size())
#define INF 0x3f3f3f3f3f3f3f3fLL
#define all(v) v.begin(),v.end()
#define watch(x) cout<<(#x)<<" = "<<x<<endl
const int dr[] { -1, -1, 0, 1, 1, 1, 0, -1 };
const int dc[] { 0, 1, 1, 1, 0, -1, -1, -1 };
#if __cplusplus >= 201402L
template<typename T>
vector<T> create(size_t n) {
	return vector<T>(n);
}
template<typename T, typename ... Args>
auto create(size_t n, Args ... args) {
	return vector<decltype(create<T>(args...))>(n, create<T>(args...));
}
#endif
void run() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifdef EZZAT
	freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#else
#endif
}

int main() {
	run();
	int s, w;
	cin >> s >> w;
	cout << (w >= s ? "unsafe" : "safe");
}


Measured memory_bytes: 3684
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import deque

    n, k = map(int, readline().split())
    d = list(map(int, readline().split()))
    e = [str(i) for i in range(10) if i not in d]

    que = deque([i for i in e if i != "0"])

    while True:
        x = que.popleft()
        if int(x) >= n:
            print(x)
            sys.exit()

        for y in e:
            que.append(x+y)


if __name__ == '__main__':
    main()


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

int main(){
	int N;
	cin >> N;
	long long int min = 999999;
	for(int i = 1; i < N; ++i){
		int A = i;
		int B = N - A;
		long long int sum = 0;
		while(A > 0){
			sum += A % 10;
			A /= 10;
		}
		while(B > 0){
			sum += B % 10;
			B /= 10;
		}
		if(sum < min) min = sum;
	}
	cout << min << endl;
}

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

int main(){
  int N,K;cin>>N>>K;
  int MAX = (N-1)*(N-2)/2;

  if(K>MAX){
    cout<<"-1"<<endl;
    return 0;
  }

  int m_base = N-1;
  int M = m_base + (MAX-K);
  cout<<M<<endl;

  for(int i=2; i<=N; i++){
    cout<<1<<" "<<i<<endl;
    M--;
  }

  int p=2, q = p+1;
  while(M>0){
    cout<<p<<" "<<q<<endl;
    q++;
    if(q>N){
      p++;
      q = p+1;
    }
    M--;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define cY cout << "Yes" << endl;
#define cN cout << "No" << endl;
    
int main() {
  ll n;string x;
  cin >> n;
  vector<string>s(n);
  vector<ll>t(n);
  rep(i,n) cin >> s.at(i) >> t.at(i);
  cin >> x;
  ll sum1,sum2 = 0;
  rep(i,n) sum1 += t.at(i);
  rep(i,n){
    sum2 += t.at(i);
    if(s.at(i) == x) break;
  }
  cout << sum1-sum2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()
#define fs first
#define sd second
#define couts(x) cout << (x) << (" ")
#define coutn(x) cout << (x) << ("\n")
#define endl "\n"

template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T1, typename T2> std::istream &operator>>(std::istream &is, std::pair<T1,T2> &p){is >> p.first >> p.second; return is; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::deque<T> &vec){ os << "deque["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> std::ostream &operator<<(std::ostream &os, const std::pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> std::ostream &operator<<(std::ostream &os, const std::unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }

template<class T> using V = vector<T>;
template<class T> using V2 = V<V<T>>;
template<class T> using V3 = V<V2<T>>;


void solve(void){
  string s, t; cin >> s >> t;
  ll ans = 0, pre=0;
  V2<int> tb(26), tb2(26);
  FOR(i,0,(int)s.size()){
    tb[s[i]-'a'].push_back(i+1);
  }
  FOR(i,0,(int)t.size()){
    tb2[t[i]-'a'].push_back(i+1);
  }
  FOR(i,0,(int)t.size()){
    char c = t[i] - 'a';
    int pl = upper_bound(ALL(tb[c]),pre) - tb[c].begin();
    if(pl == tb[c].size()) {
      pl = lower_bound(ALL(tb[c]),0) - tb[c].begin();
    }
    if(pl == tb[c].size()) {
      coutn(-1);
      return;
    }
    pl = tb[c][pl];
    if(pl>pre) ans += pl - pre;
    else{
      ans += s.size() + pl - pre;
    }
    //couts(ans);couts(pre); coutn(pl);
    pre = pl;
  }
  coutn(ans);
}


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


Measured memory_bytes: 1724
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <new>
#include <sstream>
#include <complex>
#define BIT(nr) (1ULL << (nr))
#define int long long
#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	
#define LL_HALFMAX 9223372036854775807 / 2	
#define MIN -(9223372036854775807 / 2)
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }

using namespace std;

using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;

	// libalgo のものに追加、メンバを追加するだけなので互換性は崩さないはず、逆辺のG[e.dstの]インデックスを保持
	int rev;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
	bool operator<(const Edge& right) const {
		return dst < right.dst;
	}
};

using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph& g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph& g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

int dx[8] = { 0, 1, 0,-1, 1, 1,-1,-1 }; // x軸方向への変位
int dy[8] = { 1, 0,-1, 0, 1,-1, 1,-1 }; // y軸方向への変位

signed main() {
	int w, h;
	while (1) {
		cin >> w >> h;
		if (w == 0 && h == 0) {
			break;
		}
		vector<vector<int>> m;
		rep(i, h) {
			vector<int> add(w, 0);
			rep(j, w) {
				cin >> add[j];
			}
			m.push_back(add);
		}

		vector<vector<int>> visited(h, vector<int>(w, false));
		function<void(int, int)> dfs = [&](int x, int y) {
			if (visited[y][x]) {
				return;
			}
			visited[y][x] = true;

			rep(i, 8) {
				int nx = x + dx[i];
				int ny = y + dy[i];

				if (nx < 0 || ny < 0 || nx >= w || ny >= h) {
					continue;
				}
				if (!m[y][x]) {
					continue;
				}
				dfs(nx, ny);
			}
		};
		int ans = 0;
		rep(y, h) {
			rep(x, w) {
				if (visited[y][x]) {
					continue;
				}
				else if(m[y][x]) {
					dfs(x, y);
					ans++;
				}
			}
		}
		cout << ans << "\n";
	}

	return 0;
}


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

struct prob {
	bool ans;
	int penalty;
	prob() :ans(false), penalty(0) {
	}
};

int main() {
	int n, m;
	cin >> n;
	cin >> m;
	prob* probs[n];
	for(int i=0;i<n;++i){
		probs[i]=new prob();
	}

	string s;
	int ans = 0;
	unsigned long penalty = 0;
	for (int i = 0; i < m; ++i) {
		int id;
		cin >> id;
		cin >> s;
		prob* p=probs[id-1];
		if (!p->ans) {
			if (s.c_str()[0]=='A') {
				p->ans = true;
				++ans;
				penalty += p->penalty;
			} else {
				++(p->penalty);
			}
		}
	}
	cout << ans << " " << penalty << endl;
	for(int i=0;i<n;++i){
		delete probs[i];
	}
	return 0;
}


Measured memory_bytes: 4096
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
using namespace std;
const int maxn=200000+10,mo=1000000007;
struct dong{
    int x,v,id;
} a[maxn];
struct suan{
    int l,r;
    friend bool operator <(suan a,suan b){
        return a.r<b.r||a.r==b.r&&a.l<b.l;
    }
} b[maxn];
int tree[maxn*4],left[maxn],right[maxn],f[maxn];
int i,j,k,l,t,n,m,mi,mx,ans;
int read(){
    int x=0,f=1;
    char ch=getchar();
    while (ch<'0'||ch>'9'){
        if (ch=='-') f=-1;
        ch=getchar();
    }
    while (ch>='0'&&ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
bool cmp(dong a,dong b){
    return a.v<b.v;
}
bool cmp2(dong a,dong b){
    return a.x<b.x;
}
void change(int p,int l,int r,int a,int b){
    if (l==r){
        (tree[p]+=b);
        if (tree[p]>=mo) tree[p]-=mo;
        return;
    }
    int mid=(l+r)/2;
    if (a<=mid) change(p*2,l,mid,a,b);else change(p*2+1,mid+1,r,a,b);
    tree[p]=(tree[p*2]+tree[p*2+1]);
    if (tree[p]>=mo) tree[p]-=mo;
}
int query(int p,int l,int r,int a,int b){
    if (l==a&&r==b) return tree[p];
    int mid=(l+r)/2;
    if (b<=mid) return query(p*2,l,mid,a,b);
    else if (a>mid) return query(p*2+1,mid+1,r,a,b);
    else{
        int t=(query(p*2,l,mid,a,mid)+query(p*2+1,mid+1,r,mid+1,b));
        if (t>=mo) t-=mo;
        return t;
    }
}
int main(){
    
    n=read();
    fo(i,1,n)
        //scanf("%d%d",&a[i].x,&a[i].v);
        a[i].x=read(),a[i].v=read();
    sort(a+1,a+n+1,cmp);
    fo(i,1,n) a[i].id=i;
    sort(a+1,a+n+1,cmp2);
    mi=n+1;
    fd(i,n,1){
        mi=min(mi,a[i].id);
        left[a[i].id]=mi;
    }
    mx=0;
    fo(i,1,n){
        mx=max(mx,a[i].id);
        right[a[i].id]=mx;
    }
    fo(i,1,n) b[i].l=left[i],b[i].r=right[i];
    sort(b+1,b+n+1);
    fo(i,1,n){
        if (b[i].l==1) f[i]++;
        t=max(b[i].l-1,1);
        (f[i]+=query(1,1,n,t,b[i].r));
        if (f[i]>=mo) f[i]-=mo;
        change(1,1,n,b[i].r,f[i]);
        if (b[i].r==n){
            (ans+=f[i]);
            if (ans>=mo) ans-=mo;
        }
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 9472
#include <bits/stdc++.h>
using namespace std;
#define endl "\n" 
#define ll long long
#define pb push_back
#define mk make_pair
#define pii pair<int, int>
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define umap unordered_map
#define uset unordered_set 
#define mod 1000000007
#define imax INT_MAX
#define imin INT_MIN
#define exp 1e9
#define sz(x) (int((x).size()))
#define int long long

const int N = 100005;
// int dist[N];
int dp[N];
vector<int> g[N];

// void helper( int src) {
//     queue<pair<int,int>> q;
//     q.push({src,0});
//     dist[src] = 0;
//     while(q.size() != 0) {
//         int node = q.front().first;
//         int pops = q.front().second;
//         q.pop();
//         for(auto nbr : g[node]) {
//             if(dist[node]+1 >= dist[nbr] and nbr != pops) {
//                 dist[nbr] = max(dist[nbr], 1 + dist[node]);
//                 q.push({nbr,node});
//             }
//         }
//     }
//     return ;
// }

// int bfs(int n, int m) {
//     memset(dist, -1, sizeof dist);

//     for(int i = 1; i <= n; i++) {
//         if(dist[i] == -1) {
//             helper(i);
//         }
//     }
//     int ans = -1;
//     for(int i = 1; i <= n; i++) {
//         ans = max(ans, dist[i]);
//     }
//     return ans;

// }

int solve(int src) {
    if(dp[src] != -1) {
        return dp[src];
    }
    bool leaf = true;
    int bestChild = 0;
    for(int child : g[src]) {
        leaf = false ;
        bestChild = max(bestChild, solve(child));
    }
    if(leaf == true) {
        return dp[src] = 0;
    } else {
        return dp[src] =  1 + bestChild;
    }
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, m; cin >> n >> m;
    for(int i = 0; i < m; i++) {
        int x, y; cin >> x >> y;
        g[x].push_back(y);
    }
    memset(dp, -1, sizeof dp);
    int ans = 0; 
    for(int i = 1; i <= n; i++) {
        ans = max(ans, solve(i));
    }
    cout << ans;

    // cout << bfs(n,m);


    return 0;
}

Measured memory_bytes: 11848
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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 input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

template<typename T>
T mygcd(T a, T b) {
    if (a % b == 0) return b;
    return mygcd(b, a%b);
}

int main() {
    int k; cin>>k;
    ll ans = 0;
    for (ll a = 1; a <= k; ++a) {
        for (ll b = 1; b <= k; ++b) {
            for (ll c = 1; c <= k; ++c) {
                ll g = mygcd(a,b);
                g = mygcd(g,c);
                ans += g;
            }
        }
    }

    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3668
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <string>
#include <iomanip>
using namespace std;
#define int long long
vector <pair <int, int> > v;
signed main() {
#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		int a, b;
		cin >> a >> b;
		v.push_back(make_pair(a, i));
		v.push_back(make_pair(b, i));
	}
	sort(v.begin(), v.end());
	int l = 0;
	int r = 0;
	int ll = 0;
	int rr = v.size() - 1;
	set <int> sss;
	for (int i = 0; i < v.size(); ++i) {
		if (sss.count(v[i].second) && ll == 0) {
			ll = i;
		}
		sss.insert(v[i].second);
		if (sss.size() == n) {
			r = i;
			break;
		}
	}
	if (ll == 0) ll = r + 1;
	int ans = (v[r].first - v[l].first) * (v[rr].first - v[ll].first);
	if (v[0].second == v.back().second) {
		cout << ans << endl;
		return 0;
	}
	ll = 0;
	rr = v.size() - 1;
	sss.clear();
	sss.insert(v.front().second);
	sss.insert(v.back().second);
	int doo = 0;
	for (int i = 1; i < v.size(); ++i) {
		if (sss.size() == n) {
			doo = i - 1;
			break;
		}
		if (sss.count(v[i].second)) {
			doo = i - 1;
			break;
		}
		sss.insert(v[i].second);
	}
	r = v.size() - 2;
	for (int l = doo + 1; l >= 1; --l) {
		while (!sss.count(v[r].second)) {
			sss.insert(v[r].second);
			--r;
		}
		sss.erase(v[l - 1].second);
		ans = min(ans, (v[r].first - v[l].first) * (v[rr].first - v[ll].first));
	}
	cout << ans << endl;
}

Measured memory_bytes: 17768
from collections import deque
N = int(input())
G = dict([(i,[]) for i in range(1,N+1)])
for i in range(N-1):
  a,b,c = map(int,input().split())
  G[a].append([c,b])
  G[b].append([c,a])
Q,K = map(int,input().split())
q = []
for i in range(Q):
  q.append(list(map(int,input().split())))

d = [0 for i in range(N+1)]
deq = deque([K])
seen = [False for i in range(N+1)]
while len(deq) > 0:
  v = deq.popleft()
  for i in G[v]:
    if seen[i[1]] == False:
      d[i[1]] = d[v] + i[0]
      deq.append(i[1])
      seen[i[1]] = True

for i in range(Q):
  [x,y] = q[i]
  print(d[x]+d[y])

Measured memory_bytes: 83656
// AOJ 2015: Square Route
// 2017.11.04 bal4u@uu

#include <stdio.h>
#include <string.h>

int h[1502], w[1502];
int f[1500001];
char buf[20], *p;

int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int n, m, i, j, s, ans;

	while (fgets(p=buf, 20, stdin) && *buf != '0') {
		n = getint(), p++, m = getint();
		for (i = 0; i < n; i++)	fgets(p=buf, 10, stdin), h[i] = getint();
		for (i = 0; i < m; i++)	fgets(p=buf, 10, stdin), w[i] = getint();

		memset(f, 0, sizeof(f));
		for (i = 0; i < n; i++) {
			for (s = 0, j = i; j < n; j++) s += h[j], f[s]++;
		}
		ans = 0;
		for (i = 0; i < m; i++) {
			for (s = 0, j = i; j < m; j++) s += w[j], ans += f[s];
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 7632
#include <stdio.h>
#include <math.h>

//定数πの定義
#define PI 3.14159265359

int main(void)
{
	//dist_a、dist_b、dist_cは各辺の長さ
	double dist_a, dist_b, dist_c;
	//angle_cは角Cの角度(度)、rad_cは角Cの角度(ラジアン)
	double angle_c, rad_c;
	//areaは面積を、circuitは周の長さを、heightは三角形の高さを格納
	double area, circuit, height;

	//辺a、辺b、角Cを入力
	scanf("%lf %lf %lf", &dist_a, &dist_b, &angle_c);
	//角Cの値をラジアンに変換
	rad_c = PI * angle_c / 180;

	//面積を求め、結果を出力
	area = dist_a * dist_b * sin(rad_c) / 2;
	printf("%lf\n", area);

	//余弦定理を利用し辺cの長さを求め、周の長さを出力する
	dist_c = sqrt(pow(dist_a, 2.0) + pow(dist_b, 2.0) - (2 * dist_a * dist_b) * cos(rad_c));
	circuit = dist_a + dist_b + dist_c;
	printf("%lf\n", circuit);

	/*
	底辺をdist_a、高さをheight、面積をareaとすると
	dist_a * height / 2 = area
	height = 2 * area / dist_a
	*/
	height = 2 * area / dist_a;
	printf("%lf\n", height);

	return 0;
}


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

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;

const ll mod = 1e9 + 7;


int main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    string s;
    cin >> s;
    
    int ans = 0;
    for(int i = 0; i < s.size()/2; i++){
        if(s[i] != s[s.size() - 1 -i]){
            ans ++;
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

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

    int H = scanner.nextInt();
    int W = scanner.nextInt();
    char[][] s = new char[H][W];
    for (int i = 0; i < H; i++) {
      s[i] = scanner.next().toCharArray();
    }
    if (possible(H, W, s)) {
      System.out.println("Possible");
    } else {
      System.out.println("Impossible");
    }
  }

  private static boolean possible(int H, int W, char[][] s) {
    int prev = 0;
    for (int i = 0; i < H; i++) {
      int left = -1;
      int right = W;
      for (int j = 0; j < W; j++) {
        if (s[i][j] == '#') {
          if (left < 0) left = j;
          if (right < j) return false;
        }
        if (s[i][j] == '.') {
          if (left >= 0) right = Math.min(right, j);
        }
      }
      if (left != prev) return false;
      prev = right - 1;
    }
    return true;
  }
}


Measured memory_bytes: 21844
n,l=map(int,input().split())
a=list(map(int, input().split()))
for i in range(n-1):
  if a[i]+a[i+1]>=l:
    print("Possible")
    for j in range(i):print(j+1)
    for j in range(n-1,i,-1):print(j)
    exit()
print("Impossible")

Measured memory_bytes: 14052
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
ll fac(ll x){if(x==0) return 1;  return x*fac(x-1);}
//cout << fixed << setprecision(10);

int main(){
  ll n,ans=0; cin>>n;
  vector<ll>a(n+1),b(n);
  rep(i,n+1) cin>>a[i];
  rep(i,n) cin>>b[i];
  rep(i,n){
    if(a[i]>=b[i]){
      ans+=b[i];
    }
    else{
      ans+=a[i];
      b[i]-=a[i];
      if(a[i+1]>=b[i]){
        a[i+1]-=b[i];
        ans+=b[i];
      }
      else{
        ans+=a[i+1];
        a[i+1]=0;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
// 10:40

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>

using namespace std;

#define FOR(i,a,b) for(int (i) = (a); (i) < (b); (i)++)
#define REP(i,n) FOR((i),0,(n))
#define FORCLS(i,a,b) for(int (i) = (a); i <= (b); (i)++)
#define REPCLS(i,n) FORCLS((i),1,(n))

#if defined(DEBUG) && true
#define DOUT(x) {cout << #x << ":" << x << endl;}
#define DOUTA(ary,n) {cout << #ary << ": "; for(int i = 0; i < (n); i++) { cout << (ary)[i] << ", ";} cout << endl; }
#else
#define DOUT(x)
#define DOUTA(ary,n)
#endif

using Int = long;

const Int N_MAX = 100003;
Int n,m;
Int as[N_MAX];
Int bs[N_MAX * 2];
Int cs[N_MAX * 2];

void solve() {
    Int sum = 0;
    cin >> n >> m;
    REP(i, n) { cin >> as[i]; as[i]--;}
    REP(i, 2*m) { bs[i] = 0; }
    REP(i, n-1) {
        Int s = as[i];
        Int t = as[i + 1];
        t = (s < t) ? t : t + m;
        bs[s + 2] += 1;
        bs[t + 1] -= 1;
        cs[t + 1] -= t - s - 1;
        sum += t - s;
    }
    REP(i, 2*m-1) {
        bs[i + 1] += bs[i];
    }
    REP(i, 2*m-1){
        bs[i+1] += bs[i] + cs[i+1];
    }
    DOUTA(bs, 2*m);
    REP(i, m) {
        bs[i] += bs[i + m];
    }
    DOUTA(bs, m);
    cout << sum - *max_element(bs, bs + m) << endl;
}

#ifdef DEBUG
#define MAIN hoge
#else
#define MAIN main
#endif

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


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int n,a[100005],cnt,k=0;
vector<int> v;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i-1]);
		if(i==1){
			cnt=1;
			continue;
		}
		if(a[i-1]==a[i-2]){
			++cnt;
		}else{
			v.push_back(cnt);
			cnt=1;
		}
	}
	v.push_back(cnt);
	for(int i=0;i<v.size();i++){
		k+=(v[i]/2);
	}
	printf("%d",k);
}

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

int main (){
  int N,K;
  cin >> N >> K;
  int added = 1;
  int doubled = 1;
  int screen = 1;
  
  for (int i = 0; i < N ; i++){
    
    if(screen < K){
      screen *=2;
    }
    else{
      screen +=K;
    }       
  }
  cout << screen << endl; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007
#define dancila 3.14159265359
#define eps 1e-9

// #define fisier 1

using namespace std;

typedef long long ll;


int add(int a, int b)
{
    int x = a+b;
    if(x >= mod)
        x -= mod;
    if(x < 0)
        x += mod;
    return x;
}
ll mul(ll a, ll b)
{
    return (a*b) % mod;
}

ll pw(ll a, ll b)
{
    ll ans = 1;
    while(b)
    {
        if(b & 1)
            ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand_seed()
{
    long long a = rng();
    return a;
}


int dp[200002];
int main()
{

    #ifdef fisier
        ifstream f("input.in");
        ofstream g("output.out");
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n;
    cin >> n;
   for(int i = 2; i <= n; ++i)
	{
		int x;
		cin >> x;
		dp[x]++;
	}
	for(int i = 1; i <= n; ++i)
	cout << dp[i] << '\n';
    return 0;
}


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

#define watch(x) cerr << (#x) << ": " << (x) << endl

struct restaurant {
    int num;
    string city;
    int score;

    bool operator<(const restaurant& other) const {
        if(city != other.city)
            return lexicographical_compare(city.begin(), city.end(),
                                         other.city.begin(), other.city.end());
        return score > other.score;
    }
};

int32_t main() {

    int n; cin >> n;
    vector<restaurant> restaurants(n);
    for(int i = 0; i < n; ++i) {
        restaurants[i].num = i+1;
        cin >> restaurants[i].city >> restaurants[i].score;
    }
    sort(restaurants.begin(), restaurants.end());
    for(auto r : restaurants) {
        cout << r.num << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n,q = map(int, input().split())
s = input()

t = [0] * (n +1)
for i in range(n):
    t[i+1] = t[i] + (1if s[i:i+2] == "AC" else 0)
    
for i in range(q):
    l,r = map(int, input().split())
    print(t[r-1] - t[l-1])

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
	int A, B, C, D; cin >> A >> B >> C >> D;
	int ans = max(A * B, C * D);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3648
import itertools

def sign(num):
    if num < 0:
        return -1
    elif num > 0:
        return 1
    else:
        return 0

N = input()
a_i = list(map(int, input().split()))

signs = [-1,1]
a_sum = 0
changes_1 = 0
for i, a in enumerate(a_i):
    a_sum += a
    if sign(a_sum) != signs[i%2]:
        changes_1 += abs(a_sum) + 1
        a_sum = signs[i%2]

signs = [1,-1]
a_sum = 0
changes_2 = 0
for i, a in enumerate(a_i):
    a_sum += a
    if sign(a_sum) != signs[i%2]:
        changes_2 += abs(a_sum) + 1
        a_sum = signs[i%2]

print(min(changes_1,changes_2))

Measured memory_bytes: 14212
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
  int x;
  cin>>x;
  while(1){
    bool ok=true;
    for(int i=2; i<x; ++i){
      if(x%i==0){
        ok=false;
        break;
      }
    }
    if(ok) break;
    ++x;
  }
  cout<<x<<endl;
}
    


Measured memory_bytes: 256
//#pragma GCC optimize "trapv"//  WA to RE int!!
#include <bits/stdc++.h>
#define FOR(i,n) for(long long int i=0;i<n;i++)
#define FORR(i,n) for(long long int i=n;i>=0;i--)
#define pb push_back
#define vlli vector<long long int>
#define slli set<long long int>
#define mlli map<long long int,long long int>
#define lli long long int 
#define test lli tt1234; cin>>tt1234;while(tt1234--)
#define endl "\n"
#define all(zz) zz.begin(),zz.end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define error(x) cerr << #x <<" is " << x << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fint fast;test
#define set(a,x) memset(a,x,sizeof(a))
#define L(x)	((x)<<1)
#define R(x)	(((x)<<1)+1)
#define MOD 1000000007
using namespace std;
lli n,m,dp[1001][1001];
char arr[1001][1001];
lli go(lli x,lli y){
	if(x>=n || y>=m) return 0;
	if(x==n-1 && y==m-1) return 1;
	if(arr[x][y]=='#') return 0;
	if(dp[x][y]!=-1) return dp[x][y];
	else if(x==n-1) dp[x][y]= go(x,y+1)%MOD;
	else if(y==m-1) dp[x][y]=go(x+1,y)%MOD;
	else dp[x][y]=(go(x+1,y)%MOD+go(x,y+1)%MOD)%MOD;
	return dp[x][y];
	
}
void solve(){
	// lli n,m;
	set(dp,-1);
	cin>>n>>m;
	// lli arr[n][m]	
	FOR(i,n) FOR(j,m) cin>>arr[i][j];
	cout<<go(0,0);
}


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

// Problem : H - Grid 1
// Contest : Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_h
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)



Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
// ----------------------R00TDADA------------------------------
#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (b); i > (a); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada ios_base::sync_with_stdio(false)
#define int long long
int power(int x, int p)
{
    if (p == 0)
        return 1;
    int y = power(x, p / 2);
    y *= y;
    
    if (p % 2 == 0)
        return y;
    y *= x;
   
    return y;
}

signed main()
{
    rootdada;
    int n,k;
    cin>>n>>k;
    int c=0;
    int a[n];
    rep(i,0,n)
    {
        cin>>a[i];
        if(a[i]>=k)
            c++;
    }
    cout<<c<<endl;
}

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

int N, x[20], y[20], M;
bool get[20];

void check(int X, int Y) {
  for (int i = 0; i < N; i++) if (x[i] == X && y[i] == Y) get[i] = true;
}

int main() {
  while (1) {
    scanf("%d", &N);
    if (N == 0) break;
    for (int i = 0; i < N; i++) scanf("%d%d", &x[i], &y[i]);
    for (int i = 0; i < N; i++) get[i] = false;
    scanf("%d", &M);
    char dir;
    int l, dx, dy;
    int nowx = 10, nowy = 10;
    check(nowx, nowy);
    for (int i = 0; i < M; i++) {
      scanf("%c", &dir);
      while (!(dir == 'N' || dir == 'E' || dir == 'S' || dir == 'W')) scanf("%c", &dir);
      scanf("%d", &l);
      dx = dy = 0;
      if (dir == 'N') dy = 1;
      if (dir == 'E') dx = 1;
      if (dir == 'S') dy = -1;
      if (dir == 'W') dx = -1;
      for (int j = 0; j < l; j++) {
        nowx += dx;
        nowy += dy;
        check(nowx, nowy);
      }
    }
    bool flag = true;
    for (int i = 0; i < N; i++) if (!get[i]) flag = false;
    if (flag) printf("Yes\n");
    else printf("No\n");
  }
}



Measured memory_bytes: 2584
#include <iostream>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <climits>
#include <numeric>
#include <queue>
#include <cmath>
#include <iomanip>
#include <array>
#include <string>
#include <stack>
#include <cassert>
#include <memory>

constexpr int mod = 1000000007;
long long int power(const long long int base, const int exp) {
	switch (exp) {
	case 0: return 1LL;
	case 1: return base % mod;
	default: return power(base * base % mod, exp >> 1) * power(base, exp & 1) % mod;
	}
}
int main() {
	int n, c; std::cin >> n >> c;
	std::vector<int> lower(n), higher(n); 
	for (auto& a : lower) std::cin >> a;
	for (auto& b : higher) std::cin >> b;
	std::vector<std::vector<long long int>> memo(n, std::vector<long long int>(c + 1, 0));
	for (auto i = 0; i < n; ++i) {
		for (auto j = 0; j <= c; ++j) {
			long long int sum{ 0 };
			for (auto a = lower[i]; a <= higher[i]; ++a) {
				sum += power(a, j);
			}
			memo[i][j] = sum % mod;
		}
	}
	std::vector<long long int> result(c + 1, 0); result[0] = 1;
	for (const auto& vec : memo) {
		for (int i = c; i >= 0; --i) {
			long long int sum{ 0 };
			for (auto j = 0; j <= i; ++j) {
				sum += result[i - j] * vec[j] % mod;
			}
			result[i] = sum % mod;
		}
	}
	std::cout << result[c] << '\n';
}


Measured memory_bytes: 1536
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
//#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m,q;
	while(cin>>n>>m>>q,n){
		vi in(n);
		rep(i,n)in[i]=i;
		in.erase(in.begin()+q-1);
		int t=(q-2+in.size())%in.size();
		rep(i,n-2){
			t+=m;
			t%=in.size();
			in.erase(in.begin()+t);
			t=(t-1+in.size())%in.size();
		}
		cout<<in[0]+1<<endl;
	}
}

Measured memory_bytes: 3076
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    int[] _dp;
    int[] _height;

    void Calc()
    {
        cin = new Scanner();

        int N = cin.nextInt();

        _dp = new int[N + 1];
        for (int i = 0; i <= N; ++i)
        {
            _dp[i] = int.MaxValue;
        }

        _height = new int[N + 1];

        for (int i = 1; i <= N; ++i)
        {
            _height[i] = cin.nextInt();
        }

        int cost = FlogJump(N);

        WriteLine(cost);
    }

    int FlogJump(int index)
    {
        if (index <= 1) { return 0; }

        if (_dp[index] == int.MaxValue)
        {
            chmin(ref _dp[index], FlogJump(index - 1) + Math.Abs(_height[index] - _height[index - 1]));

            if (index >= 3)
            {
                chmin(ref _dp[index], FlogJump(index - 2) + Math.Abs(_height[index] - _height[index - 2]));
            }
        }

        return _dp[index];
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 23264
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    a,b,c,d=map(int,input().split())
    x=-(-c//b)
    y=-(-a//d)
    if x<=y:
        print("Yes")
    else:
        print("No")

if __name__=='__main__':
    main()

Measured memory_bytes: 61952
using System;
class hoge
{
    static void Main(String[] args)
    {
        String input = Console.ReadLine();
        int a = int.Parse(input.Split(' ')[0]);
        int b = int.Parse(input.Split(' ')[1]);
        if (a > b)
        {
        Console.WriteLine("a > b");
        }else if (a < b)
        {
        Console.WriteLine("a < b");
        }else if (a == b)
        {
        Console.WriteLine("a == b");
        }else
        {
        return;
        }
    }
}

Measured memory_bytes: 8900
#include <stdio.h>

int main() {
    long A, B, K;
    scanf("%ld %ld %ld", &A, &B, &K);

    if (K < A) {
        A -= K;
    } else {
        K -= A;
        A = 0;

        if (K < B) {
            B -= K;
        } else {
            B = 0;
        }
    }

    printf("%ld %ld\n", A, B);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    int cnt = 1;
    int ans = 0;
    for(int i=1; i<=N; i++){
        int a;
        cin >> a;
        if(a == cnt)  cnt++;
        else{
            ans++;
        }
    }
    if(ans == N) cout << -1 << endl;
    else cout << ans <<endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static final int A = 0;
	public static final int C = 1;
	public static final int G = 2;
	public static final int T = 3;

	public static class Dictionary {
		private Dictionary[] index;
		private boolean judge;

		public Dictionary() {
			this.index = new Dictionary[4];
			this.judge = false;
		}

		public void insert(String word) {
			int i;

			if(word.charAt(0) == 'A') {
				i = A;
			} else if(word.charAt(0) == 'C') {
				i = C;
			} else if(word.charAt(0) == 'G') {
				i = G;
			} else {
				i = T;
			}

			if(this.index[i] == null) {
				this.index[i] = new Dictionary();
			}

			if(word.length() == 1) {
				this.index[i].judge = true;
				return;
			}

			this.index[i].insert(word.substring(1));
		}

		public boolean find(String word) {
			int i;

			if(word.charAt(0) == 'A') {
				i = A;
			} else if(word.charAt(0) == 'C') {
				i = C;
			} else if(word.charAt(0) == 'G') {
				i = G;
			} else {
				i = T;
			}

			if(this.index[i] == null) {
				return false;
			}

			if(word.length() == 1) {
				return this.index[i].judge;
			}

			return this.index[i].find(word.substring(1));
		}

	}

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int orderNum = Integer.parseInt(br.readLine());

		Dictionary dictionary = new Dictionary();

		for(int i = 0; i < orderNum; i++) {
			String[] order = br.readLine().split(" ");

			if(order[0].equals("insert")) {
				dictionary.insert(order[1]);
			}

			if(order[0].equals("find")) {
				dictionary.find(order[1]);

				if(dictionary.find(order[1])) {
					System.out.println("yes");
				} else {
					System.out.println("no");
				}
			}
		}
	}
}

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

int main() {
  int d, n;
  cin>>d>>n;
  if (d == 0) {
    if (n == 100) {
      cout<<101<<endl;
    } else {
      cout<<n<<endl;
    }
    return 0;
  }
  int m = pow(100, d);
  if (n == 100) {
    cout<<n*m + m<<endl;
  } else {
    cout<<n*m<<endl;
  }
}

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

using namespace std;
typedef long long ll;
ll N, P;
string S;
int cumsum[200005];
int pow[200005];

void init(){
    pow[0] = 1;
    for(int i = 1; i <= N; i++){
        pow[i] = pow[i-1]*10;
        pow[i] %= P;
    }
}

map<int, ll> mp;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N >> P >> S;
    if(P == 2){
        ll ans = 0;
        for(int i = 0; i < N; i++){
            int tmp = S[i]-'0';
            if(tmp%2 == 0){
                ans += (i+1);
            }
        }
        cout << ans << endl;
        return 0;
    }else if(P == 5){
        ll ans = 0;
        for(int i = 0; i < N; i++){
            int tmp = S[i]-'0';
            if(tmp%5 == 0){
                ans += (i+1);
            }
        }
        cout << ans << endl;
        return 0;
    }
    init();
    // mp[0] = 1;
    for(int i = N-1; i >= 0; i--){
        int tmp = S[i]-'0';
        cumsum[i+1] = cumsum[i+2]+pow[N-i-1]*tmp;
        cumsum[i+1]%=P;
        if(mp.count(cumsum[i+1]) == 0){
            mp[cumsum[i+1]] = 1;
        }else{
            mp[cumsum[i+1]]++;
        }
    }
    ll ans = mp[0];
    ll sum = 0;
    for(auto iter = mp.begin(); iter!= mp.end(); iter++){
        sum += (iter->second*(iter->second-1))/2;
    }
    ans += sum;
    // for(auto iter = mp.begin(); iter!= mp.end(); iter++){
    //     cout << iter->first << ':' << iter->second << ' ';
    // }
    // cout << endl;
    cout << ans << endl;
    // for(int i = N-1; i >= 0; i--){
    //     for(auto iter = mp.begin(); iter!= mp.end(); iter++){
    //         cout << iter->first << ':' << iter->second << ' ';
    //     }
    //     cout << endl;
    //     int t = cumsum[i+1];
    //     ll c = mp[t];
    //     sum = sum-(c*(c-1))/2+((c-1)*(c-2))/2;
    //     mp[t]--;
    //     ans += sum;
    // }
    // cout << ans << endl;
}

Measured memory_bytes: 2580
#include <stdio.h>

int main(){

	int W, H,x,y,r;

	scanf("%d%d%d%d%d", &W, &H, &x,&y,&r);

	if (x + r > W || x - r<0 || y + r>H || y - r < 0)
		printf("No\n");
	else{
		printf("Yes\n");
	}
	return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N, L;

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

    std::cin >> N >> L;

    int sum = 0;

    for(int i=1;i<=N;++i){
        sum += L + i - 1;
    }

    int a = 1;
    for(int i=1;i<=N;++i){
        if(std::abs(L + i - 1) < std::abs(L + a - 1)){
            a = i;
        }
    }

    sum -= L + a - 1;

    std::cout << sum << std::endl;
}


Measured memory_bytes: 256
import Data.Char

main :: IO ()
main = do
  s <- getString
  putStrLn $ if and [p s, q s, r s] then "AC" else "WA"
  where
    p s = head s == 'A'
    q s = any (== 'C') . init . tail . tail $ s
    r s = countIf isLower s + 2 == length s

getString :: IO String
getString = getLine

countIf :: (a -> Bool) -> [a] -> Int
countIf f = length . filter f


Measured memory_bytes: 380
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

//4Head

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(NULL));

ll const mod = 1e9 + 7;

namespace {
	ll mul(ll a, ll b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) val += mod;
		if (val >= mod) val -= mod;
		return val;
	}

	ll poww(ll a, ll b) {
		ll val = 1;
		a %= mod;
		while (b > 0) {
			if (b % 2) val = mul(a, val);
			a = mul(a, a);
			b >>= 1;
		}
		return val % mod;
	}

	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

ll const maxn = 3e5 + 5;

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

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll a, b; cin >> a >> b;
	cout << (a * b) / gcd(a, b);
	return 0;
}

/*

*/

Measured memory_bytes: 256