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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

struct niku { double x; double y; double c; };

int main() {
  int N, K; cin >> N >> K;
  niku n[N];
  rep(i,N) {
    double x, y, c; cin >> x >> y >> c;
    n[i] = {x,y,c};
  }
  double l = 0, r = 5000*100;
  while(r-l>=1e-8) {
    double mid = (l+r)/2;
    bool ok = false;
    rep(i,N) repr(j,i,N) {
      if (i==j) {
        int count = 0;
        rep(k,N) if (pow(n[k].x-n[i].x,2)+pow(n[k].y-n[i].y,2)<=pow(mid/n[k].c,2)) count++;
        if (count>=K) ok = true;
      }
      else {
        double ri = mid/n[i].c, rj = mid/n[j].c;
        if (pow(n[i].x-n[j].x,2)+pow(n[i].y-n[j].y,2)>pow(ri+rj,2)) continue;
        if (pow(n[i].x-n[j].x,2)+pow(n[i].y-n[j].y,2)<pow(ri-rj,2)) continue;
        double vx = n[i].x-n[j].x, vy = n[i].y-n[j].y;
        double vl = sqrt(vx*vx + vy*vy);
        vx /= vl; vy /= vl;
        double dl = (ri*ri-rj*rj+vl*vl) / (2*vl);
        double rx = n[i].x - vx*dl, ry = n[i].y - vy*dl;
        double rx1 = rx - vy * sqrt(ri*ri-dl*dl), ry1 = ry + vx * sqrt(ri*ri-dl*dl);
        double rx2 = rx + vy * sqrt(ri*ri-dl*dl), ry2 = ry - vx * sqrt(ri*ri-dl*dl);
        int count1 = 0, count2 = 0;
        rep(k,N) if (pow(n[k].x-rx1,2)+pow(n[k].y-ry1,2)<=pow(mid/n[k].c,2)+1e-6) count1++;
        rep(k,N) if (pow(n[k].x-rx2,2)+pow(n[k].y-ry2,2)<=pow(mid/n[k].c,2)+1e-6) count2++;
        if (count1>=K||count2>=K) ok = true;
        // cout << mid << " " << i << " " << j << " " << rx1 << " " << ry1 << " " << count1 << endl;
        // cout << mid << " " << i << " " << j << " " << rx2 << " " << ry2 << " " << count2 << endl;
      }
    }
    // cout << l << " " << mid << " " << r << endl;
    if (ok) r = mid;
    else l = mid;
  }

  double result = l;
  cout << setprecision(10) << result << endl;
  return 0;
}

Measured memory_bytes: 384
/* ?????¢????????¨?????? 586 + 79 = 665(KiB) ??????????????????????????? */
/* ????´°??????????????§ */
#include <iostream>
#include <vector>
#include <cstdio>

struct JobRecord
{
	int staff;
	int job;
	int count;
};

int main(void)
{
	using namespace std;

	int num_of_staffs, num_of_jobs;
	cin >> num_of_staffs >> num_of_jobs;

	vector<JobRecord> v_job_record;

	/* ??\???????¨?????????????????????? */
	/* ?????§ 50000 ?????????????????? */
	/* ????????§?????¢????????¨?????? 50000(???) * 3(??????, ??????????¨????, ?????°) * 4(Bytes) = 600000(Bytes) ==> ?´?586KiB */
	while(1)
	{
		JobRecord input;
		cin >> input.staff >> input.job >> input.count;
		if( input.staff == 0 && input.job == 0 && input.count == 0 )
		{
			break;
		}
		
		/* ??\??????????????? */
		v_job_record.push_back(input);
	}

	int num_of_calc;
	cin >> num_of_calc;

	/* ???????¨???? */
	for(int calc_count = 0; calc_count < num_of_calc; calc_count++)
	{
		/* ???????¨???????????????§?????¢????????¨??????????¨??????¨?????? */
		/*   v_unit_price : 10000(??\???????¨?????????§) * 4 = 40000 Bytes */
		/*   v_salary     : 10000(????????°?????§)     * 4 = 40000 Bytes */
		/* ????¨???§ 80000 Bytes ==> ?´? 79 KiB */
		vector<int> v_unit_price(num_of_jobs);	/* ???????????¨????????? */
		vector<int> v_salary(num_of_staffs, 0);	/* ???????????¨?????????. ????????? 0 ????????????????¨???? */

		/* ??\??? */
		for(int job = 0; job < num_of_jobs; job++)
		{
			cin >> v_unit_price[job];
		}

		/* ?¨???? */
		for(int i = 0; i < v_job_record.size(); i++)
		{
			/* ???????????\???????¨??????? 1????????????????????§?????????????????????????????¨???????????? 0??????????????????????????? */
			int staff      = v_job_record[i].staff;
			int job        = v_job_record[i].job;
			int count      = v_job_record[i].count;
			int unit_price = v_unit_price[ job - 1 ];
			
			v_salary[ staff - 1 ] += unit_price * count;
		}
		
		/* ?????? */
		for(int i = 0; i < num_of_staffs; i++)
		{
			if( i != 0 )
			{
				cout << " ";
			}
			cout << v_salary[i];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
 using namespace std;
 using pii = pair<int, int>;
 using ll = long long;
 #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
 const ll MOD = 1000000007;
 const ll INFL = (1LL << 60);
 const int INFI = (1 << 30);

 int main() {
   ll H, W, ans = INFL; cin >> H >> W;

   if (H % 3 == 0 || W % 3 == 0) ans = 0;

   else {
     ll h3 = H / 3;
     ll w3 = W / 3;

     ll S1, S2, S3;

     for (ll i = 0; i <= W % 3; i++) {
       S1 = (w3 + i) * H;
       S2 = (W - (w3 + i)) * (H / 2);
       S3 = W * H - S1 - S2;

       ans = min(ans, max(S1, max(S2, S3)) - min(S1, min(S2, S3)));
     }

     for (ll i = 0; i <= H % 3; i++) {
       S1 = (h3 + i) * W;
       S2 = (H - (h3 + i)) * (W / 2);
       S3 = W * H - S1 - S2;

       ans = min(ans, max(S1, max(S2, S3)) - min(S1, min(S2, S3)));
     }

     ans = min(ans, min(H, W));
   }

   cout << ans << endl;
 }


Measured memory_bytes: 256
def solve(n, m)
  array = Array.new(n)
  n.times do |i|
    array[i] = i + 1
  end
  
  pos = m - 1
  while array.size > 1 do
    array.delete_at(pos)
    pos += m - 1
    pos = pos % array.size
  end
  array[0]
end

loop do
  n, m = $stdin.gets.chomp.split(" ").map(&:to_i)
  break if n == 0 && m == 0
  p solve(n, m)
end

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

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt(); long k = sc.nextLong();
        int [] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = sc.nextInt();
        ArrayList<Integer> starts = new ArrayList<>();
        //HashSet<Integer> seen = new HashSet<>();
        int [] dp = new int[n];
        int [] next = new int[n];
        Arrays.fill(next, n);
        int [] b = new int[200001];
        Arrays.fill(b, -1);
        for (int i = 0; i < n; i++) {
            if (b[a[i]] != -1) next[b[a[i]]] = i;
            b[a[i]] = i;
        }
        for (int i = n - 1; i >= 0; i--) {
            if (next[i] == n) dp[i] = i;
            else if (next[i] == n - 1) dp[i] = -1;
            else dp[i] = dp[next[i] + 1];
        }
        int [] first = new int[200001];
        Arrays.fill(first, -1);
        for (int i = 0; i < n; i++) {
            if (first[a[i]] == -1) first[a[i]] = i;
        }
        int cur = 0; starts.add(-1);
        while (cur != -1) {
            int newStart = dp[cur];
            if (newStart != -1) starts.add(newStart);
            if (newStart == -1) {
                cur = -1;
            } else {
                cur = first[a[newStart]] + 1;
                if (cur == n) cur = -1;
            }
        }
        long rem = k % starts.size();
        int start = starts.get((int) rem);
        if (start == -1) {
            out.println();
        } else {
            ArrayList<Integer> res = new ArrayList<>();
            int i = start;
            while (i < n) {
                if (dp[i] == i) res.add(a[i++]);
                else {
                    int go = dp[i];
                    if (go != -1) i = go; else break;
                }
            }
            for (Integer x: res) out.print(x + " ");
        }
        out.close();
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}

Measured memory_bytes: 62260
#include <bits/stdc++.h>
#include <quadmath.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define EPSILON 0
int powint(int a, int x){
	int res = 1;
	REP(i,x){
		res = res *a; 
	}
	return res;
}
 
using namespace std;
 
int main(){
	int Q;
	cin>>Q;
	vector<int> A(Q);
	vector<int> B(Q);
	REP(i,Q){
		cin>>A[i]>>B[i];
	}
	REP(i,Q){
		long long int a=A[i];
		long long int b=B[i];
		long long int u=ceil(sqrt(a*b))-1;
		long long int ans=2*u;
		//if(sqrt(a*b)==ceil(sqrt(a*b))){
		//	ans++;
		//}
		long long int t=min(a,b);
		//if( int(ceil(double(a*b)/t)) - 1 == max(a,b) ){
		ans--;//既にあるやつのぶん
		//}
 
		if(a==b){
			ans++;
		} else 	if((long long int)((long double)(a*b)/u +EPSILON) == u){
			ans--;
		}
 
		if(ceil((long double)(a*b)/u) == ((long double)(a*b)/u) && (long long int)((long double)(a*b)/u +EPSILON) == u+1){
			ans--;
		}
 

		/*
		debug(a);
		debug(b);
		debug(u);
		*/
		cout<<ans<<endl;
	}
	return 0;
}

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

int n;
ii a[500011];
ll ans;

int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i].first);
        a[i].second = i;
    }
    sort(a+1, a+n+1);
    for (int i = 1; i <= n; i++) ans += (a[i].second % 2) ^ (i % 2);
    printf("%lld\n", ans >> 1);
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
using namespace std;
#pragma warning(disable : 4996)


int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	long long a, b, k;
	cin >> a >> b >> k;
	if (k < a) {
		cout << a - k << " " << b;
	}
	else {
		cout << 0 << " " << max(0LL, b - (k - a));
	}
}

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

int main(){
    int N,M,C;
    cin >> N >> M >> C;
    int B[M];
    for(int i=0;i<M;i++) cin >> B[i];
    int a =0;
    int A[M];

    for(int j=0;j<N;j++){
        int sum=0;
        for(int i=0;i<M;i++){
            cin >> A[i];
            sum += A[i]*B[i];
        }
        if(sum+C>0) a++;
    }
    cout << a << endl;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = ReadInts();
            if (ab[0] <= 5)
            {
                WriteLine(0);
            }
            else if (ab[0] <= 12)
            {
                WriteLine(ab[1] / 2);
            }
            else
            {
                WriteLine(ab[1]);
            }
        }
        

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        //最大公約数
        
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
    }
}


Measured memory_bytes: 13140
n, y = map(int, input().split())
for i in range(n + 1):
    for j in range(n - i + 1):
        if 10000 * i + 5000 * j + 1000 * (n - i - j) == y:
            print(i, j, n - i - j)
            x = 1
            break
    else:continue
    break
else:print(-1,-1,-1)


Measured memory_bytes: 40684
#include<bits/stdc++.h>
using namespace std;
int main() 
{
int n,k;
cin>>n>>k;
int ans=1;
  for(int i=0;i<n;i++) 
  {
    ans=min(ans*2,ans+k);
  }
cout<<ans<<endl;
return 0;
}

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

using namespace std;

int main(){
    char x,y;
    cin >> x;
    cin >> y;
    if (x > y)
        cout << ">";
    else if(x<y)
        cout << "<";
    else if(x == y)
        cout << "=";
    return 0;

}


Measured memory_bytes: 256
N = int(input())

div_counts = []
for i in range(2, int(N**0.5)+1):
  count = 0
  while N%i == 0:
    count += 1
    N //= i
    if N == 1:
      break
  div_counts.append(count)
  
if N != 1:
  div_counts.append(1)

ans = 0
for count in div_counts:
  for i in range(1, count+1):
    if count >= i:
      ans += 1
      count -= i
print(ans)

Measured memory_bytes: 17140
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i<=b;i++)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;

ll H, W;
int N;
map<ll, int> cnt;
map<int, ll> ans;
//-----------------------------------------------------------------
int main() {
	cin >> H >> W >> N;


	//x,y座標を受け取って、その周りを+1していく。
	//+1されたことのある座標は、mapにぶちこんで記録しておく。
	//pairを使わなくてもxの最大値より大きい値をyにかけておけば、一つの値に圧縮できる。
	//範囲外判定をfor文の判定でやるか、中で別に書くかは微妙。
	rep(i, 0, N) {
		int a, b; cin >> a >> b;

		rep(y, max(1, a - 2), min((ll)a, H - 2) + 1) rep(x, max(1, b - 2), min((ll)b, W - 2) + 1) {
			cnt[(ll)y * 1000000001LL + (ll)x]++;
		}
	}

	//9個の中に黒マスがp.second個ある。
	for (auto p : cnt) {
		ans[p.second]++;
	}

	//ほうじょげんりを使って一つも入ってない正方形を数える。
	ll sm = 0;
	rep(i, 1, 10) sm += ans[i];
	ans[0] = (H - 2) * (W - 2) - sm;

	//出力
	rep(i, 0, 10) cout << ans[i] << endl;
}

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

int main(void){
    int x, y, n=1;
    
    cin >> x;
    
    for(int i=1; i<x; i++){
        if(x<=i*i) {y=i-1; break;}
    }
    for(int i=2; i<=y; i++){
        for(int j=i; j*i<=x; j*=i){
            if(n<j*i) n=j*i;
        }
    }
    
    cout << n << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
//ll a[1000000+9]= {0};
using namespace std;
int main()
{
    string a;
    ll k,i,p=0;
    cin>>a>>k;
    for(i=0; i<a.length(); i++)
    {
        if(a[i]!='1')
        {
            break;
        }
        else
        {
            p++;
        }
    }
//cout<<p<<endl;
    if(k<=p)
    {
        cout<<1<<endl;
    }
    else
    {
        cout<<a[p]<<endl;
    }
    return 0 ;
}


Measured memory_bytes: 256
// Indrajeet Mishra
 
/*#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")*/
 
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define test(s) if (!(s)) { cout << __LINE__ << " " << #s << endl; exit(-1); }
#define debug(x) do { std::cerr << x; } while (0)
#define endl "\n"
#define pb push_back
#define pf push_front
#define vll vector<ll>
#define dll deque<ll>
#define sll set<ll, greater <ll>>
#define mll map<ll, ll>
#define vii vector<int>
#define dii deque<int>
#define sii set <int, greater <int>>
#define mii map<int, int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mod 1000000007
#define inv2 500000004
#define inv6 166666668
#define N 1000005
#define inf 200000000
#define eps 1e-10
#define PI 3.14159265359
#define all(v) (v).begin(),(v).end()
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
#define gcd(a,b) __gcd(a,b)
 
ll dp[101][101];
void dp_initialiser(){
    memset(dp,-1,sizeof(dp));
}

int main() {
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    dp_initialiser();
    ll x=0,k=0,d=0;cin>>x>>k>>d;
    x=abs(x);
    ll p=x/d;
    if(p>=k)cout<<(x-k*d);
    else{
        ll a=(x-d*(x/d));
        ll count1=k-(x/d);
        if(count1%2)a=abs(a-d);
        a=abs(a);
        ll b=x-d*((x/d)+1);
        ll count2=k-1-(x/d);
        if(count2%2)b=abs(b+d);
        b=abs(b);
        cout<<min(a,b);
    }
    return 0;
}

Measured memory_bytes: 3696
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007



int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b)print(c);
	else if (b == c)print(a);
	else print(b);





	return 0;
}

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

import static java.lang.Integer.parseInt;

/**
 * Hot days - Accepted
 * JOI 12th, Pre 4
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		line = br.readLine();

		int D = parseInt(line.substring(0, line.indexOf(' ')));
		int N = parseInt(line.substring(line.indexOf(' ') + 1));

		int[] T = new int[D];
		int[][] ABC = new int[N][3];
		int[][] CC = new int[N][N];

		for (int i = 0; i < D; i++) {
			T[i] = parseInt(br.readLine());
		}

		for (int i = 0; i < N; i++) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			for (int j = 0; j < 3; j++) {
				ABC[i][j] = parseInt(st.nextToken());
			}
		}

		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				CC[i][j] = Math.abs(ABC[i][2] - ABC[j][2]);
			}
		}

		//solve
		int[][] dp = new int[D][N];

		for (int i = 0; i < dp.length; i++) {
			Arrays.fill(dp[i], -1);
		}

		for (int i = 0; i < N; i++) {
			if (ABC[i][0] <= T[0] && T[0] <= ABC[i][1]) {
				dp[0][i] = 0;
			}
		}

		for (int i = 1; i < D; i++) {
			for (int j = 0; j < N; j++) {
				if (ABC[j][0] <= T[i] && T[i] <= ABC[j][1]) {
					for (int k = 0; k < N; k++) {
						if (dp[i - 1][k] != -1) {
							dp[i][j] = Math.max(dp[i][j], dp[i - 1][k] + CC[j][k]);
						}
					}
				}
			}
		}

		int max = -1;
		for (int i = 0; i < N; i++) {
			max = Math.max(max, dp[D - 1][i]);
		}

		System.out.println(max);

	}
}

Measured memory_bytes: 27708
import java.util.Scanner;
public class Main{
     public static void main(String[] args) {
      try (Scanner sc = new Scanner(System.in)){
           String line = sc.nextLine();
            String answer = "";
             int length = line.length();
              for (int i = 0; i < length; i++){
                   char ch = line.charAt(i);
                   if(Character.isLowerCase(ch)){
                       ch=Character.toUpperCase(ch);
                   }else if(Character.isUpperCase(ch)){
                       ch=Character.toLowerCase(ch);
                   }
                   answer=answer+ch;
                }
                System.out.println(answer);
            }
        }
    }



Measured memory_bytes: 31540
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <iostream>

using namespace std;

#define FOR(i, a, b)   for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)  for(int i = (a); i > (b); --i)
#define rep(i, n)      for(int i = 0; i < (n); ++i)
#define all(c)         begin(c), end(c)
#define rall(c)        rbegin(c), rend(c)
#define SZ(a)          ((ll) a.size())

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

int main() {
	int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if((e-a)>k)cout << ":(";
  else cout << "Yay!";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int w,h;
int f[150][150];

int cnt(int x,int y,int s,int t){
  if(y-t<0 || x-s<0) return -1;
  return f[y][x]-f[y-t][x]-f[y][x-s]+f[y-t][x-s];
}
int solve(int s,int t){
  int ret = 0;
  for(int i=0;i<h;++i)
    for(int j=1;j<w;++j)
      f[i][j]+=f[i][j-1];
  for(int j=0;j<w;++j)
    for(int i=1;i<h;++i)
      f[i][j]+=f[i-1][j];
  for(int i=0;i<h;++i)
    for(int j=0;j<w;++j)
      ret = max(ret,cnt(j,i,s,t));
  return ret;
}

int main(){
  int n;
  while(cin>>n,n){
    memset(f,0,sizeof(f));
    cin >> w >> h;
    ++w,++h;
    while(n--){
      int x,y;
      cin >> x >> y;
      f[y][x] = 1;
    }
    int s,t;
    cin >> s >> t;
    cout << solve(s,t) << endl;
  }
  return 0;
}

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

namespace ConsoleApp2
{
    class Program
    {
        static long MOD = 1000000007;
        static void Main(string[] args)
        {
            var NK = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            var N = NK[0] + 1;
            var K = NK[1];
            var ss = new List<long[]>();
            {
                var min = Enumerable.Range(0, K).Select(i=>long.Parse(i.ToString())).Sum();
                var max = Enumerable.Range(0, K).Select(i => long.Parse((N-1-i).ToString())).Sum();
                ss.Add(new long[] { min, max });
            }
            for (var i = 0; i < N-K; i++)
            {
                ss.Add(new long[] { ss[i][0] + i + K, ss[i][1] + (N-K-i-1) });
            }
            long ans = 0;
            foreach(var item in ss)
            {
                ans += item[1] - item[0]+1;
                ans %= MOD;
            }
            Console.WriteLine(ans);
        }

    }
}

Measured memory_bytes: 34776
S = input()
T = input()

s_cnt=[]
t_cnt=[]

for i in range(97,97+26):
    s_cnt.append(S.count((chr(i))))
    t_cnt.append(T.count((chr(i))))

s_cnt.sort()
t_cnt.sort()

ok_flag=True
for i in range(len(s_cnt)):
    if s_cnt[i] != t_cnt[i]:
        ok_flag=False

if ok_flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;
long long INF = 1000000007;

int main() {
    long long N,M;
    cin>>N>>M;
    if(abs(N-M)>1){
        cout<<0<<endl;
    }else{
        long long ans=1;
        REP(i,N){
            ans*=(i+1);
            ans%=INF;
        }
        REP(i,M){
            ans*=(i+1);
            ans%=INF;
        }
        if(N==M){
            ans*=2;
            ans%=INF;
        }
        cout<<ans<<endl;
    }



    return 0;
}

Measured memory_bytes: 256
n,a,b,k=map(int,input().split())
if k==0:
    print(1)
    quit()
mod=998244353
fra=[1]*(n+2)
inv=[1]*(n+2)
t1=1
t2=1
for i in range(1,n+2):
    t1*=i
    t1%=mod
    t2*=pow(i,mod-2,mod)
    t2%=mod
    fra[i]=t1
    inv[i]=t2
def comb(n,r):
    return fra[n]*inv[n-r]%mod*inv[r]%mod
ans=0
b,a=sorted([a,b])
for i in range(max(0,-(-(k-b*n)//a)),min(n+1,k//a+1)):
    t=k-i*a
    if t>b*n or t%b!=0:
        continue
    else:
        t//=b
        ans+=(comb(n,i)*comb(n,t))%mod
        ans%=mod
print(ans)

Measured memory_bytes: 26680
#include<bits/stdc++.h>
using namespace std;
void solve()
{
    int n; cin >> n;
    if(n >= 30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}
int main()
{
    solve();
    return 0;
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

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

	int n;cin >> n;
	vector<ll> v(n);REP(i, n)cin >> v[i];
	sort(ALL(v));

	auto a = v;
	auto b = v;
	REP(i, n-1)a[i+1] = gcd(a[i], a[i+1]);
	for(int i = n-1;i > 0;i--)b[i-1] = gcd(b[i], b[i-1]);
	ll ans = 0;
	REP(i, n){
		if(i == 0)ans = max(ans, b[1]);
		else if(i == n-1)ans = max(ans, a[n-2]);
		else ans = max(ans, gcd(a[i-1], b[i+1]));
	}
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll i,j,k,n,r,p,c=0;
     string s,t;
     cin>>s>>t;
     k=s.length();
     for(i=0;i<k;i++)
     {
         if(s[i]!=t[i])
         {
             cout<<"No"<<endl;
             return 0;
         }
     }
     cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 3624
s_origin = input()
s_copy = s_origin[:]
for _ in range(len(s_origin)):
    s_copy = s_copy[:-1]
    if len(s_copy)%2 == 1:
        continue
    else:
        s_left = s_copy[:int(len(s_copy)/2)]
        s_right = s_copy[int(len(s_copy)/2):]
        if s_left == s_right:
            print(len(s_copy))
            break

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);


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

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        final int D = Integer.parseInt(sc.next());
        final int N = Integer.parseInt(sc.next());
        int cnt = 0;
        int ans = 0;
        
        for (int i = 1; cnt < N; i++) {
            if (func(i) == D) {
                cnt++;
                ans = i;
            }
        }
        
        out.println(ans);
        
        out.flush();
    }
    
    public static int func(int x) {
        if (x % 100 != 0) return 0;
        return func(x / 100) + 1;
    }
}

Measured memory_bytes: 23732
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,i,flg,j;
	scanf("%d",&x);
	while(1)	{
		flg=1;
		for(i=2;i*i<=x;i++)	{
			if(x%i==0)	{
				flg=0;	break;
			}
		}
		if(flg==1)	break;
		else x++;
	}
	printf("%d\n",x);
	return 0;
}

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

int main() {
  int D, G;
  cin >> D >> G;
  
  int p[D], c[D];
  for (int i = 0; i < D; i++) {
    cin >> p[i] >> c[i];
  }
  
  int min = 1000;
  // コンプリートボーナスのもらい方をパターン分けして、各パターンについて調べる
  for (int bits = 0; bits < (1 << D); bits++) {
    int count = 0;
    int sum = 0;
    for (int i = 0; i < D; i++) {
      if (bits & (1 << i)) {
        count += p[i];
        sum += (i + 1) * 100 * p[i] + c[i];
      }
    }
    if (sum >= G) {
      if (count < min) {
        min = count;
      }
      continue;
    }
    
    // コンプリートボーナスをもらった上で足りない場合の計算
    for (int i = D - 1; i >= 0; i--) {
      if (!(bits & (1 << i))) {
        if (sum + (i + 1) * 100 * (p[i] - 1) >= G) {
          count += (G - sum) / ((i + 1) * 100);
          if ((G - sum) % ((i + 1) * 100) != 0) {
            count++;
          }
          if (count < min) {
            min = count;
          }
          break;
        } else {
          count += p[i] - 1;
          sum += (i + 1) * 100 * (p[i] - 1);
        }
      }
    }
  }
  
  cout << min << endl;
  return 0;
}

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

int main(){
        char s[4];
    	cin >> s;
    	if(s[0]=='7'||s[1]=='7'||s[2]=='7'){
		cout << "Yes" << endl;
    	}
    	else{
		cout << "No" << endl;
	}
}

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

int main() {
    string candidate[4] = {"dream", "dreamer", "erase", "eraser"};
    string S;
    cin >> S;
    reverse(S.begin(), S.end());
    for(int i = 0; i < 4; i++) {
        reverse(candidate[i].begin(), candidate[i].end());
    }
    for(int i = 0; i < S.size();) {
        bool flag = false;
        for(int j = 0; j < 4; j++) {
            if(S.substr(i, candidate[j].size()) == candidate[j]) {
                i += candidate[j].size();
                flag = true;
            }
        }
        if(!flag) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 512
S = input()
T = input()
 
N = len(S)
M = len(T)
ans = 1001

# Sから順にM文字切り出し、切り出した文字列とTのハミング距離における最小値を求める
for i in range(N+1-M):
  dis = 0
  for j in range(M):
    if S[i+j] != T[j]:
      dis += 1
  ans = min(ans, dis)
  
print(ans)

Measured memory_bytes: 9064
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <deque>
#include <map>
#include <iomanip>
#include <limits>
#include <map>

using namespace std;

const int CMax = 100002;
const int CVMax = 40;
const int CInf = 2000000001;
const long long CMod = 1000000007;

int n, A[CMax];
long long res = 0;

long long gcd(long long a, long long b)
{
    if (b != 0) return gcd(b, a % b);
    else return a;
}


struct TrieNode
{
    struct TrieNode *children[CVMax];
    int ended;
};

struct TrieNode *getNode()
{
    struct TrieNode *pNode = new TrieNode;
    pNode->ended = 0;

    for (int i = 0; i < CVMax; i++) {
        pNode->children[i] = NULL;
    }

    return pNode;
};

void insertWord(struct TrieNode *root, string word) {
    struct TrieNode *pNode = root;
    int tmp;

    for (int i = 0; i < word.length(); i++) {
        tmp = word[i] - 'a';
        if (!pNode->children[tmp]) {
            pNode->children[tmp] = getNode();
        }
        pNode = pNode->children[tmp];
    }

    res += (long long)pNode->ended;

    pNode->ended++;
}

int main()
{
    int m, tmp1, tmp2;
    scanf("%d %d", &n, &m);

    multiset < pair <int, int> > S;
    multiset < pair <int, int> >::reverse_iterator rit;
    pair <int, int> iit;

    vector <int> days;
    vector <int>::iterator vit;

    for (int i = 0; i < n; i++) {
        scanf("%d %d", &tmp1, &tmp2);
        S.insert(make_pair(tmp2, tmp1));
    }

    for (int i = 1; i <= m; i++) {
        days.push_back(i);
    }

    for (rit = S.rbegin(); rit != S.rend(); ++rit) {
        iit = *rit;
        if (iit.second <= m) {
            vit = lower_bound(days.begin(), days.end(), iit.second);
            if (vit != days.end()) {
                days.erase(vit);
                res += (long long) iit.first;
            }
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
string s;
ll n;
queue<ll> q;
int main(){
	cin >> s;
	n=s.size();
	if(s[0]!='1' or s[n-1]!='0')
		return puts("-1"),0;
	for(int i=0;i<n and n-1-i>0;i++)
		if(s[i]!=s[n-2-i])
			return puts("-1"),0;
	for(int i=0;i<n;i++){
		if(s[i]=='1' or i==n-1)
			while(!q.empty()){
				printf("%lld %d\n",q.front()+1,i+1);
				q.pop();
			}
		q.push(i);
	}
}

Measured memory_bytes: 4512
import sys
import copy
import time
import random

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline

D = None
C = None
S = None

def cnt_score(t):
    global D, C, S
    score = 0
    cnt = [-1] * 26

    for i in range(D):
        score += S[i][t[i] - 1]
        minusscore = 0
        cnt[t[i] - 1] = i
        for j in range(26):
            minusscore += (i - cnt[j]) * C[j]
        score -= minusscore
    return score


def main():
    global D, C, S
    D = int(input())
    C = [int(x) for x in input().split()]
    S = [[int(x) for x in input().split()] for _ in range(D)]

    start = time.time()

    ans = []
    for s in S:
        ans.append(s.index(max(s)) + 1)

    # 初期値をランダムで探す
    while True:
        # time up
        current = time.time()
        if current - start > 1.0:
            break

        # main
        new_ans = []
        for _ in range(D):
            new_ans.append(random.randint(1, 26))

        if cnt_score(new_ans) > cnt_score(ans):
            ans = new_ans

    #ans = [1] * D

    day = 0
    while True:
        # time up
        current = time.time()
        if current - start > 1.8:
            break

        # main
        new_ans = copy.deepcopy(ans)
        old_score = cnt_score(ans)

        max_sore = old_score
        max_contest = ans[day]
        for i in range(26):
            new_ans[day] = i + 1
            new_score = cnt_score(new_ans)
            if new_score > old_score:
                max_contest = i + 1
                old_score = new_score
        ans[day] = max_contest

        # increment day
        day = (day + 1) % D

    for a in ans:
        print(a)



if __name__ == '__main__':
    main()


Measured memory_bytes: 83152
#include <iostream>
#include <vector>
#include <unordered_set>

using namespace std;

struct UnionFind
{
    vector<int> data;

    UnionFind(int size) : data(size, -1) { }

    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }

    bool findSet(int x, int y) {
        return root(x) == root(y);
    }

    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }

    int size(int x) {
        return -data[root(x)];
    }
};

int main()
{
    int N, K, R;

    cin >> N >> K;
    UnionFind uf(N);

    for (int i = 0; i < K; ++i) {
        int m, r1, r2;
        cin >> m >> r1;

        for (int j = 1; j < m; ++j) {
            cin >> r2;
            uf.unionSet(r1 - 1, r2 - 1);
        }
    }

    cin >> R;
    int p, q;
    unordered_set<int> ans;
    for (int i = 0; i < R; ++i) {
        cin >> p >> q;
        if (uf.findSet(p - 1, q -1)) {
            ans.insert(p - 1);
            ans.insert(q - 1);
        }
    }

    cout << ans.size() << endl;

    return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;



int main(){
	ll m;
	cin>>m;
	rep(r,m){
		ll res=0;
		ll mo,y,n;
		cin>>mo>>y>>n;
		rep(i,n){
			ll f,c;
			double p;
			cin>>f>>p>>c;
			ll tmp;
			if(f) tmp=mo;
			else tmp=0;
			ll t=mo;
			rep(j,y){
				if(f){
					tmp+=(ll)(tmp*p);
					tmp-=c;
				}
				else{
					tmp+=(ll)(t*p);
					t-=c;
				}
			}
			if(!f) tmp+=t;
			//cout<<tmp<<endl;
			res=max(res,tmp);
		}
		cout<<res<<endl;
		//cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

////////////////////////////////////////////////////////


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

    rep(i, 0, k){
        if(a >= b) b*=2;
        else c*=2;
    }

    if(a < b && b < c) co("Yes");
    else co("No");

    return 0;
}




Measured memory_bytes: 3624
postorder = []

def printpostorder(inorder, preorder, n): 
    if preorder[0] in inorder: 
        root = inorder.index(preorder[0]) 
          
    if root != 0: # left subtree exists 
        printpostorder(inorder[:root],  
                       preorder[1:root + 1],  
                       len(inorder[:root])) 
      
    if root != n - 1: # right subtree exists 
        printpostorder(inorder[root + 1:],   
                       preorder[root + 1:],  
                       len(inorder[root + 1:])) 
    
    postorder.append(preorder[0])
          

n = int(input())
preorder = list(map(int, input().split()))
inorder = list(map(int, input().split()))
printpostorder(inorder, preorder, n)

print( " ".join( [ str(i) for i in postorder ]))


Measured memory_bytes: 5608
#include <iostream>
int main(){
	int N,R;
    int inner;
    std::cin>>N ;
  	std::cin>>R;
    if (N>=10){
    	inner=R;
      	std::cout<<inner;
    }
    else{
    	inner=R+100*(10-N);
      	std::cout<<inner;
        }
    return 0;
    
}


Measured memory_bytes: 256
H,W,A,B = map(int,input().split())
MOD = 10**9+7

MAXN = H+W+5
fac = [1,1] + [0]*MAXN
finv = [1,1] + [0]*MAXN
inv = [0,1] + [0]*MAXN
for i in range(2,MAXN+2):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

def ncr(n,r):
    if n < r: return 0
    if n < 0 or r < 0: return 0
    return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD

ans = 0
for i in range(W-B):
    ans += ncr(H-A+W-2-i, W-1-i) * ncr(A-1+i, i)
    ans %= MOD
print(ans)

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


int main() {
	int e;
	while (cin >> e && e>0) {
		int y=0;
		int z=0;
		int sum=0,summin=e; // min: NOTICE how we initialize the minimum

		for (y = 0; y*y+z*z*z <= e; ++y)
		{
			//cout << y << " " << z << endl;
			for (z=0 ; y*y+z*z*z <= e; ++z)
			{
				int x= e-y*y-z*z*z;
				sum = x+y+z;
				if (sum < summin) summin = sum;
       			//	cout << y << " " << z << endl;
			}
			z=0;
		}
		cout << summin << endl;
	}

	return 0;
}



Measured memory_bytes: 3000
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.Vector as V

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n, q] <- getIntList
    s <- getLine
    let acs = V.fromList $ scanl (+) 0 (cl s)
    replicateM_ q $ do
        [l,r] <- getIntList
        print $ (acs V.! r) - (acs V.! l)

cl [] = []
cl (c:[]) = 0 : cl []
cl (a:b:cs) | a:b:[] == "AC" = 0 : 1 : cl cs
            | otherwise = 0 : cl (b:cs)

Measured memory_bytes: 13180
#include <iostream>
#include <cmath>

using namespace std;


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

	int S = pow(100,D);
	if (N <= 99) {
		cout << S * N << endl;
	}
	else {
		cout << S * 101 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

int popcount(int x) {
	int ret = 0;
	while (x) {
		x &= x - 1;
		ret++;
	}
	return ret;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	int id[4] = { 0,4,6,8 };
	rep(mask, 0, (1 << 4)) {
		string t = "AKIHABARA";
		rrep(i, 0, 4) {
			if ((mask >> i) & 1) {
				t.erase(t.begin() + id[i]);
			}
		}
		if (s == t) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}

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

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

  int n;
  string s;
  cin >> n >> s;

  int ans = 0;

  for (int i = 0; i < n-2; ++i) {
    string t = s.substr(i, 3);
    if (t == "ABC") ++ans;
  }

  cout << ans << '\n';

  return (0);
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N;
  cin >> N;
  cout << 180 * (N-2) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
 
using ll = long long;
using namespace std;
static const int INF = 1000000;
 
 
int main() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<int> v (600, 0);
    vector<vector<int>> p(300001, vector<int>(3, INF));
    vector<int> ans(100000);
    for (int i = 0; i < m; ++i) {
        int l, r;
        scanf("%d %d", &l, &r);
        vector<int> e {r*2+2, l, -1};
        p.emplace_back(e);
    }
    for (int i = 0; i < q; ++i) {
        int l, r;
        scanf("%d %d", &l, &r);
        vector<int> e {r*2+3, l, i};
        p.emplace_back(e);
    }
    sort(p.begin(), p.end());
    for (auto &&a: p){
        if(a[0] == INF) break;
        if(a[0]%2 == 0){
            v[a[1]]++;
        }else{
            int sum = 0;
            for (int i = a[1]; i <= a[0]/2; ++i) {
                sum += v[i];
            }
            ans[a[2]] = sum;
        }
    }
    for (int i = 0; i < q; ++i) {
        printf("%d\n", ans[i]);
    }
    return 0;
}

Measured memory_bytes: 34184
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
signed main(){
    ll n;cin>>n;
    vector<vector<ll> >a(n+2,vector<ll>(n+2));
    vector<vector<ll> >used(n+2,vector<ll>(n+2));
    REP(i,1,n+1){
        REP(j,1,n+1){
            a[i][j]=i-1;
            a[i][j]=min(n-i,a[i][j]);
            a[i][j]=min(j-1,a[i][j]);
            a[i][j]=min(n-j,a[i][j]);
        }
    }
    ll ans=0;
    rep(i,n*n){
        ll p;cin>>p;
        ll yy=p%n;
        if(yy==0)yy=n;
        ll xx=(p-1)/n+1;
        queue<pll>q;
        used[xx][yy]=1;
        q.push(mp(xx,yy));
        while(!q.empty()){
            pll k=q.front();
            q.pop();
            ll x=k.fi,y=k.se;
            ll now=a[x][y];
            if(!used[x][y])now++;
            rep(j,4){
                ll nx=x+dx[j],ny=y+dy[j];
                if(a[nx][ny]>now){
                    a[nx][ny]=now;
                    q.push(mp(nx,ny));
                }
            }
        }
        ans+=a[xx][yy];
    }
    cout<<ans<<endl;
}

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

int main()
{
    size_t D, N;
    cin >> D >> N;
    size_t D100 = 1;
    for(size_t i=0; i<D; i++){ D100 *= 100;};
    if(N==100) cout << (D100 * (N+1)) << endl;
    else       cout << (D100 * N) << endl;
    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    
		String x = "";
		try {
			while ((x = in.readLine()) != null) {
				String[] ab = x.split(" ");
				int a = Integer.parseInt(ab[0]);
				int b = Integer.parseInt(ab[1]);
				String str = String.valueOf(a + b);
				System.out.println(str.length());
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 24224