akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define sor(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
#define vi vector<int>
#define vl vector<long long>
#define vii vector<vector<int>>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;



int main()
{
    int H,W;
    cin >> H >> W;
    ve<ve<char>> S(H,ve<char>(W,'.'));
    
    int ans = 0;
    
    rep(i,H) rep(j,W) cin >> S[i][j];
    
    rep(is,H) rep(js,W){
        if(S[is][js] == '#') continue;
        rep(ig,H) rep(jg,W){

            if(S[ig][jg] == '#') continue;
            //cout << is << js << ig << jg << endl;
            if(is == ig && js == jg) continue;
            ve<ve<int>> D(H,ve<int>(W,1000000002));
            D[is][js] = 0;
            int an = 0;
            
            queue<pair<int,int>> que;
            que.push({is,js});
            
            while (!que.empty()) {
                pair<int,int> aa = que.front();
                que.pop();
                if(aa.fi + 1 <= H-1){
                    if(S[aa.fi+1][aa.se] == '.' && D[aa.fi+1][aa.se] == 1000000002){
                        que.push({aa.fi+1,aa.se});
                        D[aa.fi+1][aa.se] = min(D[aa.fi+1][aa.se],D[aa.fi][aa.se] + 1);
                    }
                }
                if(aa.fi - 1 >= 0){
                    if(S[aa.fi-1][aa.se] == '.' && D[aa.fi-1][aa.se] == 1000000002){
                        que.push({aa.fi-1,aa.se});
                        D[aa.fi-1][aa.se] = min(D[aa.fi-1][aa.se],D[aa.fi][aa.se] + 1);
                    }
                }
                if(aa.se + 1 <= W-1){
                    if(S[aa.fi][aa.se+1] == '.' && D[aa.fi][aa.se+1] == 1000000002){
                        que.push({aa.fi,aa.se+1});
                        D[aa.fi][aa.se+1] = min(D[aa.fi][aa.se+1],D[aa.fi][aa.se] + 1);
                    }
                }
                if(aa.se - 1 >= 0){
                    if(S[aa.fi][aa.se-1] == '.' && D[aa.fi][aa.se-1] == 1000000002){
                        que.push({aa.fi,aa.se-1});
                        D[aa.fi][aa.se-1] = min(D[aa.fi][aa.se-1],D[aa.fi][aa.se] + 1);
                    }
                }
            }
            if(D[ig][jg] == 1000000002) continue;
            
            //cout << is << js << ig << jg << endl;
            //out(D[ig][jg]);
            ans = max(ans,D[ig][jg]);
            
            
        }
        
        
    }
    
    out(ans);



    return 0;
}


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

using namespace std;

int a[55];

int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", a + i);
    }
    long long ans = 0;
    for (int i = 0; i < n; i++){
        for (int j = i + 1; j < n; j++){
            ans += a[i] * a[j];
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
// A - Kth Term
// https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_a
#include <iostream>
#include <bits/stdc++.h>
#include <map>
#include <queue>
#include <set>
#include <string> 
#include <vector>
#include <numeric>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll, int> PLI;
typedef pair<int, int> PII;
const ll mxsize = 2e5 + 5;
const ll linf = 1e9;
const long double inf = 10000000000.0;
#define fastIO                                                                 \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
const ll mod = 1e9 + 9;
#define clr(x) memset(x , 0 , sizeof(x));
 
/******************************************** CODE STARTS FROM HERE *************************************************/ 

vector < int > val = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 
    1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main()
{
    fastIO;
    int k;
    cin >> k;
    cout << val[k - 1] << endl;
}

Measured memory_bytes: 256
W,H,N = map(int,input().split())

xl = 0
xr = W
yu = H
yd = 0

for i in range(N):
    x,y,a = map(int, input().split())

    if a == 1:
        xl = max(xl,x)
    elif a == 2:
        xr = min(xr,x)
    elif a == 3:
        yd = max(yd,y)
    else:
        yu = min(yu,y)

ans = max(0,xr - xl) * max(0,yu - yd)

print(ans)


Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
//if(strcmp(s[i],"AC")==0)
//if(s[l]=='#')
/*小文字判定
if((moji>= 'a') && (moji<='z')){
    printf("a\n");
    return 0;
  }
  */
//文字列中の一文字⇒数字の時は s[i]-'0'
int W_Length(char *str){
	int length = 0;
	while(*str++ != '\0')
		length++;
	return length;
}

void swap(long long int *a, long long int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}
//swap(&a, &b)

double deg(double theta){//deg to theta
return theta*(2*3.14159265359)/360;
}

long long int cmp( const void *p, const void *q ) {
    return *(long long int*)p - *(long long int*)q;
}//ちいさい順
//qsort(a,n,sizeof(long long int),cmp);


int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}
//qsort(s,n,sizeof(s[0]),cmp_s);
//char s[n][11]

long long int GCD(long long int a, long long int b){
  long long int L=a,S=b;
  while(1){
    if(S>L){
      L=S+L;
      S=L-S;
      L=L-S;
    }
    if(L%S==0){
      return S;
    }
    L=L%S;
  }
  
}

long long int LCM(long long int a, long long int b){
  return a*b/(GCD(a,b));
}

long long int nCr[3000][3000]={0};
 
long long int combination(long long int n, long long int r)
{
    if (r == 0 || r == n){
      nCr[n][r]=1;
        return (1);
    }
    else if (r == 1){
      nCr[n][r]=n;
        return (n);
    }
  if(nCr[n-1][r-1]==0&&nCr[n-1][r]==0){
    nCr[n-1][r-1]=combination(n - 1, r - 1)%1;
    nCr[n-1][r]=combination(n - 1, r)%1;
    return (nCr[n-1][r-1]+nCr[n-1][r]);
  }
  else if(nCr[n-1][r-1]!=0&&nCr[n-1][r]==0){
    nCr[n-1][r]=combination(n-1,r)%1;
    return(nCr[n-1][r-1]+ nCr[n - 1][r]);
  }
  else if(nCr[n-1][r-1]==0&&nCr[n-1][r]!=0){
    nCr[n-1][r-1]=combination(n-1,r-1)%1;
    return(nCr[n-1][r]+ nCr[n - 1][r-1]);
  }
  else{
    return nCr[n-1][r]+nCr[n-1][r-1];
  }
    
}


int main (void)
{
	long long int n,i,min,k,a[210],b,max,j=1,count=0,temp1,temp2,flag=0;
scanf("%lld",&n);
for(i=0;i<n;i++){
  scanf("%lld%lld",&a[2*i],&a[2*i+1]);
  if(a[2*i]==a[2*i+1]){
    flag++;
  }
  else{
    flag=0;
  }
  if(flag==3){
      printf("Yes\n");
      return 0;
    }
  }


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


Measured memory_bytes: 1664
#include<stdio.h>
int main()
{
    int N,D;
    scanf("%d%d",&N,&D);
    int count = 0,s;
    s = D;
    int i;
    for(i=1; ; i++)
    {
        D = (D*2)+1;
        N-=D;
        if(N<=0)
        {
            printf("%d\n",i);
            return 0;
        } D = s;
    }
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    private struct Pair<T> { public T x, y; public Pair(T xx, T yy) { x = xx; y = yy; } }
    private static int[] dx = { 1, 0, -1, 0 };
    private static int[] dy = { 0, -1, 0, 1 };
    public static void Main()
    {
        int N = NextInt();
        long A = NextLong();
        int B = NextInt();
        long[] X = LineLong();
        long ans = 0;
        for (int i = 0; i < N - 1; i++)
        {
            //歩いたほうがいいかテレポするか
            ans += Math.Min(B, (X[i + 1] - X[i]) * A);
        }
        Console.WriteLine(ans);
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 20960
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <list>
using namespace std;
typedef long long ll;

int main() {
    ll K,A,B;
    cin >> K >> A >> B;
    ll ans=0;
    if(B-A<=2 || K<A+1){
        cout << 1+K << endl;
    }
    else{
        ans+=((K-(A+1))/2)*(B-A);
        ans+=(K-(A+1))%2;
        cout << ans+B << endl;
    }
}

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

int main() {
    int N; cin >> N;
    string S; cin >> S;
    int x = 0;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'I') {
            x++;
            ans = max(ans, x);
        } else {
            x--;
        }
    }
    cout << ans << endl;
}


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

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

    int ans = 1 << 29;
    for (int i = 1; i < n; i++) {
        int a = i;
        int b = n - i;
        int t = 0;
        while (a) {
            t += a % 10;
            a /= 10;
        }
        while (b) {
            t += b % 10;
            b /= 10;
        }
        ans = min(ans, t);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	int W,a,b;
	public void solve() {
		W = nextInt();
		a = nextInt();
		b = nextInt();

		if(b+W <= a){
			out.println(Math.max(0,a-b-W));
		}else{
			out.println(Math.max(0,b-a-W));
		}
	}
	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

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

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

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

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

// 出力
void print() { std::cout << '\n'; }
template <class T>void print(const T &x) {std::cout << x <<'\n';}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}

void solve(long long N, std::vector<long long> d){
    int ans = 0;
    REP(i, N) {
        for (int j = i + 1; j < N; j++) {
            ans += d[i] * d[j];
        }
    }
    print(ans);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> d(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&d[i]);
    }
    solve(N, std::move(d));
    return 0;
}


Measured memory_bytes: 256
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define F first
#define S second
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

#define error(args...) {vector<string>_v=split(#args,',');err(_v.begin(),args);cout<<endl;}
vector<string> split(const string &s, char c) {vector<string>v; stringstream ss(s); string x;
while (getline(ss, x, c))v.emplace_back(x); return move(v);} void err(vector<string>::iterator it) {}
template<typename T, typename... Args>void err(vector<string>::iterator it, T a, Args...args) {
cout << it->substr((*it)[0] == ' ', it->length()) << " = " << a << " "; err(++it, args...);}

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;
ll vis[N],res[N];

int solve() 
{
	//happy coding

	int n,m;
	ll rem;
	cin>>n>>m>>rem;

	std::vector<int > a(n),b(m);
	std::vector<ll> preb(m+1);
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<m;i++){
		cin>>b[i];
		preb[i+1] = preb[i]+b[i];
	}

	int best = 0;
	ll sum = 0;
	for(int i=0;i<=n&&sum <= rem;i++){
		ll target = rem - sum;
		int cnt = upper_bound(all(preb),target) - preb.begin();
		best = max(i+cnt-1,best);
		sum += a[i];
	}

	cout<<best<<endl;



	
	return 0;
}
int main(){
	int test = 1;
  	//scanf("%d", &test);
  	while (test--)solve();return 0;
}

Measured memory_bytes: 6364
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

int main() {
     // 左上および右下にも
     // -> マス(1, 1)およびマス(2, N)にも
    int n;
    cin >> n;
    int a[2][n];
    rep(i, 2) rep(j, n) cin >> a[i][j];
    rep3(j, 1, n) a[0][j] += a[0][j - 1];
    a[1][0] += a[0][0];
    rep3(j, 1, n) a[1][j] += max(a[0][j], a[1][j - 1]);
    out(a[1][n - 1]);
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cfloat>
#include <climits>
#include <cassert>
#include <random>
#include <fstream>

int main() {
	while (true) {
		int m, c, n; std::cin >> m >> c >> n; if (n == 0) break;
		std::vector<std::queue<int>> users(n);
		for (auto& u : users) {
			int k; std::cin >> k;
			for (auto i = 0; i < k; ++i) {
				int b; std::cin >> b;
				u.push(b);
			}
		}
		std::vector<int> current_book_position(100, m), recent_access(101, INT_MAX);
		std::set<int> first_desk;
		std::priority_queue<int, std::vector<int>, std::greater<int>> empty_space;
		for (auto i = 0; i <= m; ++i) empty_space.push(i);
		std::vector<int> desk_rest(m + 1, c); desk_rest.back() = INT_MAX;
		int sum_cost = 0;
		std::queue<int> user_in_row; for (auto i = 0; i < n; ++i) user_in_row.push(i);
		for (auto time = 0; !user_in_row.empty(); ++time) {
			const auto top = user_in_row.front(); user_in_row.pop();
			const auto ref = users[top].front(); users[top].pop();
			if (!users[top].empty()) user_in_row.push(top);
			const auto target_pos = current_book_position[ref];
			if (++desk_rest[target_pos] == 1) {
				empty_space.push(target_pos);
			}
			int cost = target_pos + 1;
			if (desk_rest[0] > 0) {
				cost += 1;
				if (--desk_rest[0] == 0) empty_space.pop();
			}
			else {
				const auto temp_area = empty_space.top();
				if (--desk_rest[temp_area] == 0) {
					empty_space.pop();
				}
				const auto most_least_ref = *std::min_element(first_desk.begin(), first_desk.end(), [&recent_access](int a, int b) {return recent_access[a] < recent_access[b]; });
				const auto escape_area = empty_space.top();
				if (--desk_rest[escape_area] == 0) {
					empty_space.pop();
				}
				if (++desk_rest[temp_area] == 1) {
					empty_space.push(temp_area);
				}
				cost += temp_area + 1 + 1 + escape_area + 1 + temp_area + 1 + 1;
				current_book_position[most_least_ref] = escape_area;
				first_desk.erase(most_least_ref);
			}
			current_book_position[ref] = 0;
			first_desk.insert(ref);
			recent_access[ref] = time;
			sum_cost += cost;
		}
		std::cout << sum_cost << '\n';
	}
}



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

int main(){
  int n,p;
  vector<int> person(50);


  while(1){
    int i=0;
    cin>>n>>p;
    if(n==0&&p==0)break;
    for(int i=0;i<n;i++)person[i]=0;
    
    while(1){
      int flag=0;
      if(p!=0){ 
	person[i]+=1;
	p--;
      }else if(p==0&&person[i]>0){
	p=person[i];
	person[i]=0;
      }
      
      if(p==0){
	//	for(int k=0;k<n;k++) cout<<person[k];
	//	cout<<endl;
	//	cout<<flag<<endl;
	for(int j=0;j<n;j++){
	  if(person[j]>0){
	    flag++;
	  }
	  if(flag>1)break;
	}
      }

      if(flag==1)break;
      i++;
      if(i==n)i=0;  
    }
    cout<<i<<endl;
    
  }

  return 0;
}

Measured memory_bytes: 1192
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	int x = b - a;
	int ans = 0;
	for (int i = 1; i < x; i++)
	{
		ans += i;
	}
	cout << ans - a << endl;
	
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map(String::toInt)
    val q = BooleanArray(10);
    readLine()!!.split(' ').map(String::toInt).forEach {
        q[it] = true
    }
    var ans = n
    while (!f(ans, q)) ans++
    println(ans)
}

fun f(a : Int, q : BooleanArray) : Boolean {
    a.toString().forEach {
        if (q[it - '0']) return false
    }
    return true
}

Measured memory_bytes: 25220
#include<stdio.h>
int main(void){
    int m,d,sum,date;
    int month[12]={31,29,31,30,31,30,31,31,30,31,30,31};
    while(1){
        scanf("%d %d",&m,&d);
        if(m==0 && d==0){
            break;
        }
        sum=0;
        date=0;
        for(int i=0;i<m-1;i++){
            sum+=month[i];
        }
        sum+=d;
        date=sum%7;
        if(date==1){
            printf("Thursday\n");
        }else if(date==2){
            printf("Friday\n");
        }else if(date==3){
            printf("Saturday\n");
        }else if(date==4){
            printf("Sunday\n");
        }else if(date==5){
            printf("Monday\n");
        }else if(date==6){
            printf("Tuesday\n");
        }else if(date==0){
            printf("Wednesday\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2032
/*

結果:
*/
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }

int MAX(int a, int b) { if (a > b) { return a; }return b; }
/*
int min(int a, int b) { if (a<b) { return a; }return b; }
*/
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }

//B:AC
int main() {

	char w[100][11];
	int n, i, j;
	scanf("%d", &n);
	for (i = 0; i<n; ++i)scanf("%s", w[i]);
	for (i = 0; i<n - 1; ++i) {
		for (j = i + 1; j<n; ++j) {
			if (!strcmp(w[i], w[j])) {
				puts("No");
				return 0;
			}
		}
	}
	for (i = 1; i<n; ++i) {
		if (w[i - 1][strlen(w[i - 1]) - 1] != w[i][0]) {
			puts("No");
			return 0;
		}
	}
	puts("Yes");

#ifdef DEBUGF
	getch();
#endif
	return 0;
	}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define MAXN 100005

using namespace std;
using ll = long long;

int n, k;
ll A[MAXN];
ll dp[MAXN];

ll solve(int i) {
  if (i < 0) {
    return 1e9;
  }
  if (i == 0) {
    return 0;
  }
  ll& res = dp[i];
  if (res != -1) {
    return res;
  }
  res = 1e9;
  for (int j = 1; j <= k; j++) {
    res = min(res, abs(A[i] - A[i - j]) + solve(i - j));
  }
  return res;
}

int main() {
  fill(dp, dp + MAXN, -1LL);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  cout << solve(n - 1) << '\n';
  return 0;
}


Measured memory_bytes: 6528
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

import math

def solve():
    r = II()
    print(2 * math.pi * r)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

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

const int INF = 1e9;

int main() {
    int n;
    cin >> n;
    int h[n], dp[n];
    for (int i = 0; i < n; i++) { cin >> h[i]; dp[i] = INF; }
    dp[0] = 0;
    for (int i = 1; i < n; i++) {
        chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
        if (i > 1) chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(){
    int age0,age1,age2,age3,age4,age5,age6,n,i,x;
    while(1){
        age0=0;age1=0;age2=0;age3=0;age4=0;age5=0;age6=0;
        scanf("%d",&n);
        if(n==0)break;
        for(i=0;i<n;i++){
            scanf("%d",&x);
            if(x>=60){
                age6++;
            }else if(x>=50){
                age5++;
            }else if(x>=40){
                age4++;
            }else if(x>=30){
                age3++;
            }else if(x>=20){
                age2++;
            }else if(x>=10){
                age1++;
            }else{
                age0++;
            }
        }
        printf("%d\n%d\n%d\n%d\n%d\n%d\n%d\n",age0,age1,age2,age3,age4,age5,age6);
    }
    return 0;
}

Measured memory_bytes: 600
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ld long double

/* 幾何ライブラリ */

const ld PI = 3.14159265358979323846L;

// 2次元座標, 2次元ベクトル
using pos = pair<ld, ld>;

// 加算
pos add(pos p1, pos p2) {
	return { p1.first + p2.first, p1.second + p2.second };
}
// 減算
pos sub(pos p1, pos p2) {
	return { p1.first - p2.first, p1.second - p2.second };
}
// 内積
ld inner_product(pos p1, pos p2) {
	return p1.first * p2.first + p1.second * p2.second;
}
// 定数倍
pos mul(ld c, pos p) {
	return { c * p.first, c * p.second };
}

// ノルムの2乗
ld norm2(pos p) {
	return p.first * p.first + p.second * p.second;
}
// ノルム
ld norm(pos p) {
	return sqrt(norm2(p));
}

// 射影
// pをp1, p2を通る直線に射影する
// 検証済み(https://onlinejudge.u-aizu.ac.jp/courses/library/4/CGL/all/CGL_1_A)
pos projection(pos p1, pos p2, pos p) {
	pos q = sub(p2, p1);
	pos tmp = mul(inner_product(q, sub(p, p1)) / norm2(q), q);
	return add(p1, tmp);
}

// 反射
// pをp1, p2を通る直線に関して対称移動する
// 検証済み(https://onlinejudge.u-aizu.ac.jp/courses/library/4/CGL/all/CGL_1_B)
pos reflection(pos p1, pos p2, pos p) {
	pos tmp = projection(p1, p2, p);
	return add(p, mul(2.0, sub(tmp, p)));
}

// 位置関係
// p0を基準に、p1, p2の位置関係を求める
// p2が
//	p1から反時計回り方向 : COUNTER_CLOCKWISE
//	p1から時計回り方向 : CLOCKWISE
//	p1と反対方向(p2, p0, p1がこの順に同一直線上) : ONLINE_BACK
//	p1の延長線上(p0, p1, p2がこの順に同一直線上) : ONLINE_FRONT
//	p1の途中(線分p0p1の上) : ON_SEGMENT
string positional_relation(pos p0, pos p1, pos p2) {
	const ld e = 1e-10; // 許容誤差
	pos v1 = sub(p1, p0), v2 = sub(p2, p0);
	if (abs(v2.first) < e && abs(v2.second) < e) return "ON_SEGMENT";
	ld r1 = atan2l(v1.second, v1.first), r2 = atan2l(v2.second, v2.first);
	if (abs(r1 - r2) < e || (abs(r1 - r2) > PI - e && abs(r1 - r2) < PI + e)) { // ONLINE
		if (v1.first * v2.first < 0 || v1.second * v2.second < 0)
			return "ONLINE_BACK";
		if (abs(v1.first) < abs(v2.first) || abs(v1.second) < abs(v2.second))
			return "ONLINE_FRONT";
		return "ON_SEGMENT";
	}
	// NOT ONLINE
	if (r2 - r1 + (r2 - r1 < 0 ? 2 * PI : 0) < PI)
		return "COUNTER_CLOCKWISE";
	return "CLOCKWISE";
}


int main() {
	cout << setprecision(15);
	pos p0, p1;
	cin >> p0.first >> p0.second >> p1.first >> p1.second;
	int q; cin >> q;
	while (q--) {
		pos p2; cin >> p2.first >> p2.second;
		cout << positional_relation(p0, p1, p2) << endl;
	}
	return 0;
}


Measured memory_bytes: 3244
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderBeginnerContest098
{
    class QB
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string S = Console.ReadLine();
            HashSet<char> list = new HashSet<char>();
            int count = 0;
            int max = 0;
            for(int i = 0; i < N; i++)
            {
                //if (!list.Contains(S[i]))
                //{
                    if (S.IndexOf(S[i], i + 1) >= 0) count++;
                //}
                //else
                if (list.Contains(S[i]))
                {
                    if (S.LastIndexOf(S[i], i - 1) >= 0) count--;
                }
                list.Add(S[i]);
                if (max < count) max = count;
            }
            Console.WriteLine(max);
        }
    }
}


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

using namespace std ;
int main () {

int N; cin >> N ;
vector <int > V ( N );
for ( int i = 0; i < N ; ++ i ) {
cin >> V [ i ];
}
vector <int > C ( N );
for ( int i = 0; i < N ; ++ i ) {
cin >> C [ i ];
}

int ans = 0;
for ( int i = 0; i < N ; ++ i ) {
if ( V [ i ] > C [ i ]) {
ans += V [ i ] - C [ i ];
}
}

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

Measured memory_bytes: 256
#![doc = " # Bundled libraries"]
#![doc = ""]
#![doc = " ## `kyopro_lib` (private)"]
#![doc = ""]
#![doc = " ### Modules"]
#![doc = ""]
#![doc = " - `::__kyopro_lib::fewnick_tree` → `$crate::fewnick_tree`"]
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
fn main() {
    input! { n : usize , q : usize , a : [i64 ; n] }
    let mut ft = FewnickTree::new(n);
    for i in 0..n {
        ft.add(i, a[i]);
    }
    for _ in 0..q {
        input! { t : i32 }
        if t == 0 {
            input! { p : usize , x : i64 }
            ft.add(p, x);
        } else {
            input! { l : usize , r : usize }
            println!("{}", ft.sum_range(l..r));
        }
    }
}
use self::fewnick_tree::FewnickTree;
pub mod fewnick_tree {
    pub struct FewnickTree<T>(Vec<T>);
    impl<T: Clone + num::Num + std::ops::AddAssign> FewnickTree<T> {
        pub fn new(n: usize) -> Self {
            Self(vec![T::zero(); n + 1])
        }
        pub fn from_slice(dat: &[T]) -> Self {
            let mut v = vec![T::zero()];
            v.extend_from_slice(dat);
            for i in 1..dat.len() {
                let j = i + i & i.wrapping_neg();
                if j < v.len() {
                    let x = v[i].clone();
                    v[j] += x;
                }
            }
            Self(v)
        }
        pub fn clear(&mut self) {
            for x in &mut self.0 {
                *x = T::zero();
            }
        }
        pub fn add(&mut self, mut i: usize, x: T) {
            i += 1;
            while i < self.0.len() {
                (self.0)[i] += x.clone();
                i += i & i.wrapping_neg();
            }
        }
        pub fn sum(&self, mut i: usize) -> T {
            let mut res = T::zero();
            while 0 < i {
                res += (self.0)[i].clone();
                i ^= i & i.wrapping_neg();
            }
            res
        }
    }
    impl<T: Clone + num::Num + std::ops::AddAssign + std::ops::Sub> FewnickTree<T> {
        pub fn sum_range(&self, r: std::ops::Range<usize>) -> T {
            self.sum(r.end) - self.sum(r.start)
        }
    }
}


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

int main() {
  int n;
  cin >> n;
  for(int i=0; i<n; i++){
    string s;
    cin >> s;
    if(s == "Y"){
      cout << "Four" ;
      break;
    }
    if(s != "Y" && i == n-1){
      cout << "Three";
    }
  }
  
}


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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    if((count(S.crbegin(), S.crend(), 'a') == 1) && count(S.crbegin(), S.crend(), 'b') == 1 && count(S.crbegin(), S.crend(), 'c') == 1) cout << YES << endl;
    else cout << NO << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
a,b,k = map(int,input().split())
for i in range(k):
    if i%2==0:
        if a%2!=0:
            a -= 1
        b += a//2
        a = a//2
    else:
        if b%2!=0:
            b -= 1
        a += b//2
        b = b//2
print(a,b)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <map>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    map<string, int> mp;
    int cnt = 0;
    for(int i = 0; i < n; i++)
    {
        string s; cin >> s;
        mp[s]++;
        cnt = max(cnt, mp[s]);
    }
    for(auto &x : mp)
    {
        if(x.second == cnt)
        {
            cout << x.first << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 23808
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();
    int caseNum = 1;
    while(true) {
      int data = Integer.parseInt(br.readLine());
      if(data == 0) {
        break;
      }
      sb.append("Case ").append(Integer.toString(caseNum++)).append(": ").append(Integer.toString(data)).append("\n");
    }
    System.out.print(sb);
  }
}

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

using namespace std;

#define ll                  long long
#define vi                  vector<int>
#define vl                  vector<ll>
#define pii                 pair<int, int>
#define vvi                 vector<vi>
#define vvl                 vector<vl>
#define all(x)              x.begin(), x.end()
#define contains(con, x)    con.find(x) != con.end()
#define fastread            ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)


int main() {
    fastread;

    int T = 1;
    // cin >> T;

    while (T--) {
        int A, B, C, D;
        cin >> A >> B >> C >> D;

        int attacksToDefeatSecond = (C + B - 1) / B;
        int attacksToDefeatFirst = (A + D - 1) / D;

        if (attacksToDefeatFirst >= attacksToDefeatSecond) {
            cout << "Yes\n";
        }
        else {
            cout << "No\n";
        }
    }

}

Measured memory_bytes: 3660
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main() {
	string s; cin >> s;
	ll a = s[0] - '0';
	ll b = s[1] - '0';
	ll c = s[2] - '0';
	ll d = s[3] - '0';

	rep(i, 0, 2) {
		rep(j, 0, 2) {
			rep(k, 0, 2) {
				ll sum = (i == 0) ? a + b : a - b;
				sum = (j == 0) ? sum + c : sum - c;
				sum = (k == 0) ? sum + d : sum - d;
				if (sum == 7) {
					cout << a;
					cout << ((i == 0) ? '+' : '-') << b;
					cout << ((j == 0) ? '+' : '-') << c;
					cout << ((k == 0) ? '+' : '-') << d << "=7" << endl;
					return 0;
				}
			}
		}
	}
	return 0;
}

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

int main() {
  int h,w;
  cin >> h >> w;
  vector<vector<char>> c(h,vector<char>(w));
  vector<vector<char>> c2(h*2,vector<char>(w));
  
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      cin >> c[i][j];
    }
  }
  
  for(int i=0; i<h*2; i++){
    for(int j=0; j<w; j++){
      c2[i][j]=c[i/2][j];
    }
  }
  for(int i=0; i<h*2; i++){
    for(int j=0; j<w; j++){
      cout << c2[i][j];
      if(j==w-1) cout << endl;
    }
  }
  
}
                         

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

int main(){
	char c[3][3];
	for(int i=0; i<3; i++){
		for(int j=0; j<3; j++){
			cin >> c[i][j];
		}
	}
	cout << c[0][0] << c[1][1] << c[2][2];
}

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

int main() {
  int n, x;
  int count = 0;

  while (1) {
    cin >> n >> x;
    if ((n == 0) && (x == 0)) {
      break;
    }
    
    count = 0;
    for (int i = 1; i < (n - 1); ++i) {
      for (int j = (i + 1); j < n; ++j) {
        for (int k = (j + 1); k < (n + 1); ++k) {
          if ((i + j + k) == x) {
            count += 1;
          } else if ((i + j + k) > x) {
            break;
          }
        }
        if ((i + j) > x) {
          break;
        }
      }
      if (i > x) {
        break;
      }
    }
    cout << count << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	string S; cin >> S;
	int N = S.size();

	int ans = 0;
	for (int i = 0; i < N - N / 2; i++) {
		if (S[i] != S[N - 1 - i]) ans++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
s = gets.chomp
q = gets.chomp.to_i
q_arr = q.times.map{gets.chomp.split(" ")}

s_arr = s.split("")
r_flag = false
q_arr.each do |(t, f, c)|
  if t == "1" then
    r_flag = !r_flag
  elsif f == "1" then
    if r_flag then
      s_arr.push(c)
    else
      s_arr.unshift(c)
    end
  else
    if r_flag then
      s_arr.unshift(c)
    else
      s_arr.push(c)
    end
  end
end

if r_flag then
  puts s_arr.reverse.join("")
else
  puts s_arr.join("")
end


Measured memory_bytes: 60284
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main() {
    int n;
    string s;
    cin>>n>>s;
    int ans=1;
    REP(i,n-1){
        if(s[i]!=s[i+1])ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
/**
 * 
 */
import java.util.ArrayList;
import java.util.Scanner;

/**
 * @author User
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int[] array = new int[3];
		array[0] = sc.nextInt();
		array[1] = sc.nextInt();
		array[2] = sc.nextInt();
		
		int minCost = 300;
		
		for(int i = 0; i < 3 ; i++) {
			int nextMinCost = 100;
			int nextMinNumber = 0;
			for(int j = 0; j < 3 ; j++) {
				int totalCost = 0;				
				if(j == i) {
					continue;
				}
				
				for(int z = 0; z < 3 ; z++) {
					if(z != i && z != j) {
						totalCost += Math.abs(array[j] - array[i]) + Math.abs(array[z] - array[j]);
					}
				}
				if(totalCost < minCost) {
					minCost = totalCost;
				}
			}	

		}
	
		// 出力
		System.out.println(minCost);
	}

}


Measured memory_bytes: 23892
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
#define ll long long
#define endl '\n'
int main()
{
    string s, t;
    cin >> s >> t;
    if (t.substr(0, s.size()) == s)
        cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 3620
/*
  Author - KISHAN TIWARI
  Dream bigger. Do bigger.
  Wake up with determination. Go to bed with satisfaction.
*/
//Sometimes later becomes never. Do it now.
#include<bits/stdc++.h>
using namespace std;
#define ll           long long
#define f(i,a,b)     for(ll i=a;i<b;i++)
#define mod          1000000007
#define fi           first
#define se           second
#define pa           pair <ll,ll>
#define mp           make_pair
#define pb           push_back
#define ve           vector<ll>
#define vep          vector< pa >
#define all(a)       a.begin(), a.end()
#define sz(x)        (ll)x.size()
#define c(t)         cout<<t<<"\n"
using namespace std;
void solve()
{
string s,t;
cin>>s>>t;
ll i=0,mi=mod;
while(i<=s.size()-t.size())
{
    ll j=0,k=i,a=0;
    while(j<t.size())
    {
        if(t[j]!=s[k])
        {
           a++;
        }
        k++;
        j++;
    }
    mi=min(mi,a);
    i++;
}
c(mi);
}
int main()
{
    ios::sync_with_stdio(true);
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long N,A,B;
  cin >> N >> A >> B;
  if (A == 0)
    cout << 0 << endl;
  else if (B == 0)
    cout << N << endl;
  else{
    long x,y;
    x = N/(A+B);
    y = N%(A+B);
    if (y<A)
      cout << A*x+y << endl;
    else
      cout << A*(x+1) << endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var ans = n % 2 == 1 ? (n + 1) / 2 / (double)n : 1 / 2.0;
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
static const int INFTY = (1 << 30);
ll A, B;
ll mgcd(ll a, ll b)
{
    ll max = (a > b) ? a : b;
    ll min = (a < b) ? a : b;
    while (max % min)
    {
        ll tmp = max;
        max = min;
        min = tmp % min;
    }
    return min;
}
void func()
{
    cin >> A >> B;
    cout << A * B / mgcd(A, B) << endl;
}
int main()
{
    func();
}

Measured memory_bytes: 256
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX = 1000000;
const int MOD = 998244353;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b){
  ll r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


ll LCM(ll a,ll b){
  ll c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
    return p;
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
  return p;
}

ll COM(ll n,ll k){

  
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,a,b,k,ans=0;
  cin>>n>>a>>b>>k;
  map<ll,ll> mp;
  rep(i,n+1){
    if((k-i*a)%b==0 && (k-i*a)/b>=0 && (k-i*a)/b<=n){
      mp[i]=(k-i*a)/b;
    }
  }
  COMinit();
  for(auto c:mp){
    ans+=COM(n,c.first)*COM(n,c.second);
    ans%=998244353;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 38016
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;

int h,w;
vector<vector<char> > field;

int main(){
	while(1){
		cin>>h>>w;
		if(!h&&!w) break;
		field=vector<vector<char> >(h,vector<char>(w));
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cin>>field[i][j];
			}
		}
		int H=0,W=0;
		bool loop=0;
		while(field[H][W]!='.'){
			if(field[H][W]=='!'){
				cout<<"LOOP"<<endl;
				loop=1;
				break;
			}
			char tmp=field[H][W];
			field[H][W]='!';
			if(tmp=='>') W++;
			else if(tmp=='<') W--;
			else if(tmp=='^') H--;
			else H++;
		}
		if(!loop) cout<<W<<' '<<H<<endl;
	}
}

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


int main(){
    // あとで消す
    //std::ifstream in("bin3.txt");
    //std::cin.rdbuf(in.rdbuf());

    string S;
    cin >> S;

    for(size_t i=0;i<S.length();i++){
        S[i] = 'x';
    }

    cout << S << endl;

    return 0;
}


Measured memory_bytes: 256
import fractions
import functools

N = int( input() )
T = [ int(input()) for _ in range(N) ]

def lcm( x, y ):
    return x * y // fractions.gcd( x, y )

def lcm_list( numbers ):
    return functools.reduce( lcm, numbers, 1 )

if N == 1: print( T[0] )
else     : print( lcm_list(T) )

Measured memory_bytes: 5560
n = int(input())
a = list(map(int,input().split()))


x = 1
for i in a:
    x = x * i

Y = []

for i in range(n):
    tmp = 1
    for j in range(n):
        if(i!=j):
            tmp = a[j] * tmp
    Y.append(tmp)

sum_y = 0
for i in Y:
    sum_y = sum_y + i

print(x/sum_y)

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

int main()
{
    int n;
    cin >> n;
    int data[4][3][10]={};
    int b,f,r,v;
    for(int i=0;i<n;i++)
    {
        cin >> b >> f >> r >> v;
        data[b-1][f-1][r-1]+=v;
    }
    for(int i=0;i<4;i++)
    {
        for(int j=0;j<3;j++)
        {
            for(int k=0;k<10;k++)
            {
                cout << " " << data[i][j][k];
            }
            cout << endl;
        }
        if(i<3)
        {
            for(int l=0;l<20;l++)
            {
                cout << "#";
            }
            cout << endl;
        }
    }
}


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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    string t; cin >> t;
    REP(i, 0, t.size()){
        if(t[i] == '?'){
            cout << "D";
        }else{
            cout << t[i];
        }
    }
    cout << endl;
}

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

void eratos(bool *isPrime, int max) {
    fill(isPrime, isPrime + max, true);
    isPrime[0] = false;
    isPrime[1] = false;
    for(int i = 2; i <= max / i; ++i)
        if(isPrime[i])
            for(int j = 2; j <= max / i; ++j)
                isPrime[i * j] = false;
}

const int MAX = 100010;
bool isPrime[MAX];

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int x;
    cin >> x;
    eratos(isPrime, MAX);
    for (int i = x; i < MAX; i++) {
        if (isPrime[i]) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 384
n,m = map(int, input().split())
c = []
d = [0 for i in range(m+1)]
for i in range(n):
    arr = input().split()
    sum = 0
    for j in range(m):
        sum += int(arr[j])
        d[j] += int(arr[j])
    arr.append(sum)
    d[m] += sum
    c.append(arr)
c.append(d)
for i in range(n+1):
    print(" ".join(map(str,c[i])))

Measured memory_bytes: 8168