akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

VLL V;
ll N;

bool find(ll a, ll b, ll c) {
	ll n = 0;
	for (; n < N; n++) {
		if (V[n] == a)break;
	}
	if (n == N)return false;
	n++;
	for (; n < N; n++) {
		if (V[n] == b)break;
	}
	if (n == N)return false;
	n++;
	for (; n < N; n++) {
		if (V[n] == c)break;
	}
	if (n == N)return false;
	return true;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	string S;
	cin >> N >> S;
	V.resize(N);
	for (ll n = 0; n < N; n++) {
		V[n] = S[n] - '0';
	}
	ll ans = 0;
	for (ll a = 0; a < 10; a++) {
		for (ll b = 0; b < 10; b++) {
			for(ll c = 0; c < 10; c++) {
				if (find(a, b, c))ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(((a+b)>(c+d))){
    cout << "Left" << endl;
  }else if(((a+b)==(c+d))){
    cout << "Balanced" << endl;
  }else if(((a+b)<(c+d))){
    cout << "Right" << endl;
  }
}

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

namespace ConsoleApplication1
{
    class Program
    {
        string[] dice;
        void rotate(int a, int b, int c, int d)
        {
            string tmp = dice[a];
            dice[a] = dice[b];
            dice[b] = dice[c];
            dice[c] = dice[d];
            dice[d] = tmp;
        }
        static void Main(string[] args)
        {
            Program p = new Program();
            p.dice = Console.ReadLine().Split(' ');

            char[] str = Console.ReadLine().ToCharArray();

            for(int i=0;i<str.Length;i++)
            {
                switch(str[i])
                {
                    case 'W':
                        p.rotate(0,2,5,3);
                        break;
                    case 'S':
                        p.rotate(1,0,4,5);
                        break;
                    case 'N':
                        p.rotate(0, 1, 5, 4);
                        break;
                    default:
                        p.rotate(2, 0, 3, 5);
                        break;
                }
            }
            Console.WriteLine(p.dice[0]);
        }
    }
}

Measured memory_bytes: 8816
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a1 = new int [n];
		int[] a2 = new int [n];

		for(int i = 0; i < n; i++) {
			a1[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++) {
			a2[i] = sc.nextInt();
		}

		int max = 0;
		int idx = 0;
		while(idx < n) {
			int sum = 0;
			for(int i = 0; i <= idx; i++) {
				sum += a1[i];
			}

			for(int i = idx; i < n; i++) {
				sum += a2[i];
			}
			max = Math.max(max, sum);
            idx++;
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

using Graph = vector<vector<int>>;

	int x[10], y[10];

double dist(int i, int j) {
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx * dx + dy * dy, 0.5);
}

int main(){
	int n; cin >> n;
	rep(i, n) cin >> x[i] >> y[i];
	double sum = 0.0;
	vector<int> v(n);
	rep(i, n) v[i] = i;
	do{
		rep(i, n - 1) sum += dist(v[i], v[i + 1]);
	}while(next_permutation(v.begin(), v.end()));
	rep(i, n) sum /= (i + 1);
	cout << fixed << setprecision(8) << sum << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
#define REP(i,n) for (int i = 0; i <(n); ++i)
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }


int main(){
  //in
  int n, k;
  cin >> n >> k;
  int R, S, P;
  cin >> R >> S >> P;
  string t;
  cin >> t;

  vector<bool> win(n,false);

  ll ans = 0;

  REP(i,k){
    if(t[i] == 'r') ans += P;
    if(t[i] == 's') ans += R;
    if(t[i] == 'p') ans += S;
    win[i] = true;
  }
  REP2(i,k,n){
    if(t[i] == t[i-k]){
      if(win[i-k]) continue;

      if(t[i] == 'r') ans += P;
      if(t[i] == 's') ans += R;
      if(t[i] == 'p') ans += S;
      win[i] = true; 
    }
    else{
      if(t[i] == 'r') ans += P;
      if(t[i] == 's') ans += R;
      if(t[i] == 'p') ans += S;
      win[i] = true;    
    }
  }

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

Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(int i=a;i<=b;i++)

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
int main()
{	
	ios_base:: sync_with_stdio(0);
	cin.tie(0);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	string s1;
	cin>>s1;
	int a=s1.length(),i,j,k=0;
	a=a-1;
	for(i=0,j=a;i<=a;i++,j--){
		if(s1[i]!=s1[j]) k++;
	}
	if(k%2==0) cout<<k/2;
	else{
		k=((k-1)/2)+1;
		cout<<k;
	}
	}


Measured memory_bytes: 256
var
	n,a:int64;
	i,k:Longint;
function S(n:int64):int64;
var x:int64;
begin
	x:=0;
	while n>0 do begin
		x:=x+n mod 10;
		n:=n div 10;
	end;
	S:=x;
end;
begin
	n:=1;
	a:=1;
	read(k);
	writeln(1);
	for i:=2 to k do begin
		if (n+a*10)*S(n+a)<(n+a)*S(n+a*10)then a:=a*10;
		n:=n+a;
		writeln(n);
	end;
end.

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const pair<T, U> &_p) { _out << _p.first << ' ' << _p.second << '\n'; return _out; }
template<typename T, typename U> inline istream &operator>> (istream &_in, pair<T, U> &_p) { _in >> _p.first >> _p.second; return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const vector<T> &_v) { if (_v.empty()) { return _out; } _out << _v.front() << ' '; for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) { _out << *_it <<' '; } return _out; }
template<typename T> inline istream &operator>> (istream &_in, vector<T> &_v) { for (auto &_i : _v) { _in >> _i; } return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const map<T, U> &_m) { if (_m.empty()) { return _out; }for (auto _it:_m) { _out << _it.first << ": " << _it.second << '\n'; } return _out; }
#define pb push_back
#define pob pop_back
#define makp make_pair
#define X first
#define Y second
#define ll long long
#define all(x) x.begin(),x.end()
#define up(a,t) (upper_bound(all(a),t) - a.begin())
#define lb(a,t) (lower_bound(all(a),t) - a.begin())
vector<int> dx = {1, -1, 0, 0};
vector<int> dy = {0, 0, 1, -1};
struct cord{
    int x;
};
#define ld long double

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0;i < s.size();i++){
        if(s[i] == '2'){
            ans++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int N;
    scanf("%d", &N);
    int s[N], ans=0;
    int  min=101;
    for(int i=0; i<N; i++){
        scanf("%d", &s[i]);
        ans += s[i];
        if(s[i]%10!=0 && s[i]<min){
            min = s[i];
        }
    }
    
    if(min==101){
        printf("0\n");
        return 0;
    }
    else if(ans%10==0){
        ans -= min;
    }

    printf("%d\n", ans);

    return 0;
}


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

int main() {
	string s;
	cin >> s;
	if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R') {
		cout << 3 << endl;
	}
	else if (s[1] == 'R' && (s[0] == 'R' || s[2] == 'R')) {
		cout << 2 << endl;
	}
	else if (s[0] == 'R' || s[1] == 'R' || s[2] == 'R') {
		cout << 1 << endl;
	}
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 3600
/*
17D8101031C 杉山　祥吾 ID:keisei334 C++
*/

#include <iostream>
#include <string>
#include <cstdlib>
#include <fstream>

using namespace std;

int S[100];
int top=0;

void push(int x){
  top++;
  S[top]=x;
}

int pop(){
  top--;
  return S[top+1];
}

int main(){
  int x;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if(s[0]=='0') break;
    if ( s[0] == '+' ){
      int v1=pop();
      int v2=pop();
      push(v2+v1);
    } else if ( s[0] == '-' ){
      int v1=pop();
      int v2=pop();
      push(v2-v1);
    } else if ( s[0] == '*' ){
      int v1=pop();
      int v2=pop();
      push(v2*v1);
    } else {
      x = atoi(s);
      push(x);
    }
  }

  cout<<S[top]<<"\n";

  return 0;
}

/*実行結果
1 2 + 0
3

1 2 + 3 4 - * 0
121
243
3-13
-3
*/



Measured memory_bytes: 3164
#include<iostream>
using namespace std;
int main(){
	int A,B;
	cin>>A>>B;
	if(A>=1&&A<=13&&B>=1&&B<=13){
		if(A==1)
		A=14;
		if(B==1)
		B=14;
	if(A>B)
	cout<<"Alice\n";
	else if(A==B)
	cout<<"Draw\n";
	else
	cout<<"Bob\n";
}
}


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

#define ln '\n'
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for(int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    VI v(n), c(n);
    REP(i, n) cin >> v[i];
    REP(i, n) cin >> c[i];

    int ans = 0;
    REP(i, n) ans += max(v[i] - c[i], 0);
    cout << ans << ln;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll n, x;
	cin>>n>>x;
	vector<ll> v(n);
	rep(i, n) cin>>v[i];
	ll res = 0;
	rep(i, n-1){
		if(v[i]+v[i+1]>x){
			res += v[i]+v[i+1]-x;
			v[i+1] = max(0LL, x-v[i]);
		}
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 1024
function main(arg) {
        var num = parseInt(arg);
     
        var jougen = Math.sqrt(num)+1;
        var kyori = num - 1;
     
        for(i=2;i<jougen;i++){
        	if(num%i===0){
        	    var hikaku = i + num/i - 2;
        		if(hikaku<kyori){
        			kyori = hikaku;
        		}
        	}
        }
        console.log(kyori);
    }
    main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7500
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>


using namespace std;
string yn(bool a)
{
  if (a){return "Yes";}
  else{return "No";}
}

int main()
{
  ios::sync_with_stdio(false);
  string s,t;
  cin>>s;
  cin>>t;
  bool flag=0;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end(),greater<char>());
  if(s<t){flag=1;}
  else{flag=0;}
  cout<<yn(flag);



  return 0;

}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int H, W, K;
        cin >> H >> W >> K;
        vector<string> vs(H);
        vector<vector<int>> field(H, vector<int>(W, -1));

        for (int i = 0; i < H; ++i) cin >> vs[i];
        int cnt = 1;
        for (int i = 0; i < H; ++i) {
            for (int j = 0; j < W; ++j) {
                if (vs[i][j] == '#') {
                    field[i][j] = cnt++;
                }
            }
        }

        for (int i = 0; i < H; ++i) {
            for (int j = 0; j + 1 < W; ++j) {
                if (field[i][j] != -1 && field[i][j + 1] == -1) {
                    field[i][j + 1] = field[i][j];
                }
            }
            for (int j = W - 1; j > 0; --j) {
                if (field[i][j] != -1 && field[i][j - 1] == -1) {
                    field[i][j - 1] = field[i][j];
                }
            }
        }

        for (int i = 0; i < W; ++i) {
            for (int j = 0; j + 1 < H; ++j) {
                if (field[j][i] != -1 && field[j + 1][i] == -1) {
                    field[j + 1][i] = field[j][i];
                }
            }
            for (int j = H - 1; j > 0; --j) {
                if (field[j][i] != -1 && field[j - 1][i] == -1) {
                    field[j - 1][i] = field[j][i];
                }
            }

        }

        for (int i = 0; i < H; ++i) {
            for (int j = 0; j < W; ++j) {
                cout << field[i][j] << " ";
            }
            cout << endl;
        }


    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 1280
from collections import deque

H, W = map(int, input().split())
tiles = [list(input()) for _ in range(H)]
moves_cnt = 0
for h in range(H):
  for w in range(W):
    if tiles[h][w] == '#':
      moves_cnt += 1

dhw = [(0, 1), (1, 0)]

moves = deque([(0, 0, 1)])
checked = [[False for _ in range(W)] for _ in range(H)]
checked[0][0] = True
ans = 0
while len(moves) > 0:
  h, w, m = moves.pop()
  if h == H-1 and w == W-1:
    ans = m
    break
  for dh, dw in dhw:
    if h+dh < H and w+dw < W and tiles[h+dh][w+dw] == '#' and not checked[h+dh][w+dw]:
      moves.appendleft((h+dh, w+dw, m+1))
      checked[h+dh][w+dw] = True
if ans == moves_cnt:
  print('Possible')
else:
  print('Impossible')

Measured memory_bytes: 65040
#include <bits/stdc++.h>
using namespace std;
# define ll long long int
#define M 998244353
#define pb push_back
#define ss second
#define ff first
#define inf 1000000000000000
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x ;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
												//nestedcode
 
ll binpow(ll a, ll b, ll m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }

}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin>>n;
    if(n>=30)	cout<<"Yes";
    else	cout<<"No";
}
   
  

	  


Measured memory_bytes: 3640
from itertools import zip_longest, count, accumulate
from bisect import bisect, bisect_left
 
def LIST(): return list(map(int, input().split()))
 
n, m, k = map(int, input().split())
a = [0] + list(accumulate(LIST()))
b = list(accumulate(LIST()))
 
num = 0
 
for i, a in enumerate(a):
    time_rest = k - a
    
    if time_rest < 0:
        continue
    
    num = max(num, i + bisect(b, time_rest))
 
print(num)


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

class Main {
    public static void main( String args[] ) throws IOException {
		int a = 0;
		int b = 0;
		int c = 0;
		int d = 0;

		int rect1 = 0;
		int rect2 = 0;

		int result = 0;

		Scanner scan = new Scanner( System.in );

		a = scan.nextInt();
		b = scan.nextInt();
		c = scan.nextInt();
		d = scan.nextInt();

		rect1 = a * b;
		rect2 = c * d;

		if( rect2 > rect1 ){
			result = rect2;
		}
		else{
			result = rect1;
		}

        System.out.println( result );
    }
}


Measured memory_bytes: 9044
integer N,M,Q
integer,allocatable::S(:,:),PL(:,:)
integer L,R
integer pp,qq

read*,N,M,Q
allocate(PL(N,N))
PL=0
do i=1,M
  read*,L,R
  PL(L,R)=PL(L,R)+1
end do
allocate(S(0:N,0:N))
S=0
do i=1,N
  do j=1,N
    S(i,j)=S(i-1,j)+S(i,j-1)-S(i-1,j-1)+PL(i,j)
  end do
end do
do i=1,Q
  read*,pp,qq
  print"(i0)",S(qq,qq)-S(pp-1,qq)-S(qq,pp-1)+S(pp-1,pp-1)
end do
end

Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define drep(i,cc,n) for(int i=(cc);i<=(n);++i)
#define rep(i,n) drep(i,0,n-1)
#define drrep(i,cc,n) for(int i=(cc);i>=(n);--i)
#define rrep(i,n) drrep(i,0,n-1)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,v.size())if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define arrprint(v,n) rep(i,n)if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define matprint(v,n,m) rep(i,n){rep(j,m){cout << v[i][j] << " ";}cout << endl;}
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
using ll = long long;
using P = pair<int,int>;
template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>; //小さいものから取り出す

int main(){
    int n,m,k;
    cin >> n >> m >> k;
    vector<int> a(n),b(m);
    rep(i,n)cin >> a[i];
    rep(i,m)cin >> b[i];
    ll tmp = 0;
    int ans = 0;
    int ai=0,bi=0;
    rep(i,n){
        if(tmp + a[i] > k)break;
        tmp += a[i];
        ans++;
        ai++;
    }
    bool flg = false;
    while(ai>=0 && bi <= m-1){
        while(tmp + b[bi]> k){
            if(ai-1 < 0){flg = true;break;}
            tmp -= a[ai-1];
            ai--;
        }
        if(flg)break;
        tmp += b[bi];
        bi++;
        ans = max(ans,ai+bi);
    }

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

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

int main() {
  int H, W, cnt;
  cin >> H >> W;
  vector<string> S(H);
  rep(i, H) cin >> S.at(i);
  rep(i, H){
    rep(j, W){
      if(S.at(i).at(j)=='.'){
        cnt=0;
        if(i*j!=0 && S.at(i-1).at(j-1)=='#') cnt++;
        if(i!=0 && S.at(i-1).at(j)=='#') cnt++;
        if(i!=0 && j!=W-1 && S.at(i-1).at(j+1)=='#') cnt++;
        if(j!=0 && S.at(i).at(j-1)=='#') cnt++;
        if(j!=W-1 && S.at(i).at(j+1)=='#') cnt++;
        if(i!=H-1 && j!=0 && S.at(i+1).at(j-1)=='#') cnt++;
        if(i!=H-1 && S.at(i+1).at(j)=='#') cnt++;
        if(i!=H-1 && j!=W-1 && S.at(i+1).at(j+1)=='#') cnt++;
        S.at(i).at(j)=char(cnt+'0');
      }
    }
  }
  rep(i, H){
    cout << S.at(i) << endl;
  }
}

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

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

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

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

int main(){
  double T, X;
  cin >> T >> X;
  cout << fixed;//小数点を確実に10桁で表示するためのもの
  cout << setprecision(10); 
  cout << T / X << endl;
  return 0;
}


Measured memory_bytes: 3792
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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; }

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

constexpr ll mod = 998244353;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  vector<P> vec;
  if (n%2 == 0) {
    for(int i=1; i<=n; i++) {
      for(int j=i+1; j<=n; j++) {
        if (i+j != n+1) {
          vec.emplace_back(i, j);
        }
      }
    }
  } else {
    for(int i=1; i<n; i++) {
      for(int j=i+1; j<=n; j++) {
        if (i+j != n) {
          vec.emplace_back(i, j);
        }
      }
    }
  }

  int size = vec.size();
  cout << size << endl;
  rep(i, size) {
    int p = vec[i].first;
    int q = vec[i].second;
    cout << p << ' ' << q << '\n';
  }
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>


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

  bool flag = (S[0]=='A' && islower(S[1]) && islower(S[S.size()-1]));

  if (flag){
    int cnt = 0;
    for (int i=2;i<S.size()-1;i++){
      if (islower(S[i])) continue;
      else if (S[i]=='C') cnt++;
      else flag = false;
    }  
    
    if (cnt!=1) flag = false;
  }  
  cout << (flag? "AC" : "WA") << endl;
  // cout << (islower(S[S.size()-1])? "AC" : "WA") << endl;


  // cout << fixed << setprecision(6);
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
dic = {}
for i in a:
    if i not in dic:
        dic[i] = 1
    else:
        dic[i] += 1
ans = 0
for k, v in dic.items():
    if k > v:
        ans += v
    elif k < v:
        ans += v-k

print(ans)


Measured memory_bytes: 18164
#include <string>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
typedef long long ll;
const int mod=1e9+7;
#define lol(i,n) for(int i=0;i<n;i++)

using namespace std;
int n,m,a[101000],b[100010];
ll sum=0,s=0;
int main() {
    cin >>n>>m;
    lol(i,n){
        cin >>a[i];
        sum+=a[i];
    }
    lol(i,m){
        cin >> b[i];
        s+=b[i];
    }
    cout << s*sum << endl;
}



Measured memory_bytes: 3904
import scala.io.StdIn.readLine
/**
  * AOJ
  */

object Main {

  def main(args: Array[String]): Unit = {
    println(if(find(read,read)) "Yes" else "No")
  }

  def read() : Array[Int] = {readLine().split(" ").map(_.toInt)}

  def find(dice1:Array[Int],dice2:Array[Int]) : Boolean = {
    for(i <- createDiceArray(dice1,"WNNNW"); j <- createDiceArray(i,"HHH")){
      if((j zip dice2).forall(x => x._1 == x._2)) return true
    }
    return false
  }

  def createDiceArray(dice:Array[Int],commands:String) : List[Array[Int]] = {
    var dices = List(dice)
    for(cmd <- commands.toCharArray){
      dices :+= getNextStatus(cmd,dices.last)
    }
    dices
  }

  def getNextStatus(cmd:Char,dice:Array[Int]): Array[Int] = cmd match {
    case 'N' => Array(dice(1), dice(5), dice(2), dice(3), dice(0), dice(4))
    case 'H' => Array(dice(0), dice(2), dice(4), dice(1), dice(3), dice(5))
    case 'W' => Array(dice(2), dice(1), dice(5), dice(0), dice(4), dice(3))
  }
}

Measured memory_bytes: 44240
//#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<algorithm>
using namespace std;
using ll = long long;
using v  = vector<ll>;
auto const INF = (ll)1e9;

int main(){
    ll n,m;
    cin >> n >> m;
    auto a = v(n,0);
    auto b = v(n,0);
    auto c = v(m,0);
    auto d = v(m,0);
    
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i];
    }
    for(int i=0;i<m;i++){
        cin >> c[i] >> d[i];
    }
    
    for(int i=0;i<n;i++){
        ll _min = INF;
        int _min_num =INF;
        for(int j=0;j<m;j++){
            int t = abs(a[i]-c[j])+abs(b[i]-d[j]);
            if(_min > t){
                _min = t;
                _min_num = j;
            }
        }
        cout << _min_num+1 << endl;
    }
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
for i in range(1, n+1):
    y = n//i
    ans += y*(y+1)*i//2
print(ans)

Measured memory_bytes: 9544
import java.util.*;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N;
        N = sc.nextInt();
        ArrayList<String> List = new ArrayList<String>();
        for (int a = 0; a < N; a++) {
            String moji = sc.next();
            List.add(moji);
        }
        if (List.contains("Y")== true) {
            System.out.println("Four");
        }
        else {
            System.out.println("Three");
        }
    }
}


Measured memory_bytes: 21716
#include <stdio.h>
int gcd(int p,int q){while(q){int t=p%q;p=q;q=t;}return p;}

int main(){
	int n;
	scanf("%d",&n);
	long ans=1;
	while(n--){
		int t;
		scanf("%d",&t);
		ans=ans/gcd(ans,t)*t;
	}
	printf("%ld\n",ans);
}


Measured memory_bytes: 2112
#include <stdio.h>
#include <iostream>

using namespace std;
using Int = unsigned;

const Int N_MAX = 100002;
Int N;
Int cnt2[3];

int count2(Int x){
    Int c2 = 0;
    while(((x & 1) == 0) && c2 < 2) {
        c2++;
        x >>= 1;
    }
    return c2;
}
/* greedy algorithm */
bool solve(){
    int now = 2;
    while(0 < cnt2[0] || 0 < cnt2[1] || 0 < cnt2[2]) {
        //printf("cnt %d %d %d , now: %d\n", cnt2[0], cnt2[1], cnt2[2], now);
        switch(now) {
        case 0:
            if (0 < cnt2[2]) {
                cnt2[2]--;
                now = 2;
            } else {
                return false;
            }
            break;
        case 1:
            if (0 < cnt2[1]) {
                cnt2[1]--;
                now = 1;
            } else if (0 < cnt2[2]) {
                cnt2[2]--;
                now = 2;
            } else {
                return false;
            }
            break;
        case 2:
            if (0 < cnt2[0]) {
                cnt2[0]--;
                now = 0;
            } else if (0 < cnt2[1]) {
                cnt2[1]--;
                now = 1;
            } else {
                return true;
            }
            break;
        }
    }
    return true;
}

int main(int argc, char const *argv[]) {
    cin >> N;
    for (int i = 0; i < N; i++) {
        Int a;
        cin >> a;
        cnt2[count2(a)]++;
    }
    printf(solve() ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 256
(* O(n) *)
let rec fold_btw f a i n = if i >= n then a else fold_btw f (f a i) (i + 1) n
let fold_int f a n = fold_btw f a 0 n

(* O(n^2) *)
let solve r g b n =
  fold_int
    (fun acc_r r0 ->
      fold_int
        (fun acc_g g0 ->
          let rg = r0 * r + g0 * g in
          if rg > n then
            acc_g
          else if (n - rg) mod b = 0 then
            acc_g + 1
          else
            acc_g)
        acc_r
        (n + 1))
    0
    (n + 1)

let read_ints () = read_line () |> Str.split (Str.regexp " ") |> List.map int_of_string

let _ =
  match read_ints () with
  | [r; g; b; n] -> solve r g b n |> string_of_int |> print_endline
  | _ -> ()

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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/b.in", "r", stdin);
//  freopen("../IO/b.in", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}


void solve(std::istream &in, std::ostream &out) {
  int A, B, M;in>>A>>B>>M;
  vector<int> a(A), b(B);
  for (int &i : a) in >> i;
  for (int &i : b) in >> i;
  int s1 = *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end());
  for (int i = 0, x, y, c; i < M; ++i) {
    in >> x >> y >> c;
    s1 = min(s1, a[x - 1] + b[y - 1] - c);
  }
  out << s1 << '\n';
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
public static void main(String[] args){
	int max,min,a=0;
	long goukei=0;
	         Scanner sc = new Scanner(System.in);
	         a =sc.nextInt();
	         int[] n =new int[a];
	         
	        		 for(int i=0;i<a;i++){
	        		  n[i]=sc.nextInt();	
	        		  }
	        		  max=n[0];
	        		  min=n[0];
	        		 
	        		 for(int i=0;i<n.length;i++){ 
	        					 if(max<n[i]){
	        						 max=n[i];
	        						 
	        					 }
	        					 if(min>n[i]){
	        						 min=n[i];
	        					 }
	        					 goukei+=n[i];
	        				 }
	        				 System.out.print(min);
	        				 System.out.print(" ");
	        				 System.out.print(max);
	        				 System.out.print(" ");
	        				 System.out.println(goukei);
	        				 sc.close();
		    
	        	
}
	 		
	 		 
	   
}




Measured memory_bytes: 41504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=100005,INF=1<<30;
vector<pair<int,int>> G[MAX];
int need[MAX];
bool visited[MAX];
pair<int,int> edge[MAX];

void DFS(int u,int p,int e){
    visited[u]=1;
    for(auto to:G[u]){
        if(visited[to.fi]) continue;
        DFS(to.fi,u,to.se);
    }
    
    if(need[u]){
        if(e==-1) return;
        else{
            int a=edge[e].fi,b=edge[e].se,c=need[u];
            if(a==u){
                need[a]-=c;
                need[b]-=(26-c);
            }else{
                need[a]-=(26-c);
                need[b]-=c;
            }
            if(need[a]<0) need[a]+=26;
            if(need[b]<0) need[b]+=26;
        }
    }
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S;cin>>S;
    int N,M;cin>>M;
    N=si(S);
    vector<pair<int,int>> T;
    for(int i=0;i<M;i++){
        int a,b;cin>>a>>b;
        if(a+b==N+1) continue;
        if(a>(N+1)/2){
            chmin(a,N+1-a);
            chmin(b,N+1-b);
            swap(a,b);
        }else if(b>(N+1)/2){
            chmin(b,N+1-b);
            if(a>b) swap(a,b);
            b--;
        }else if((N&1)&&b==(N+1)/2) b--;
        a--;
        G[a].push_back(mp(b,i));
        G[b].push_back(mp(a,i));
        
        edge[i]=mp(a,b);
    }
    
    for(int i=0;i<N/2;i++){
        int diff=S[i]-S[N-1-i];
        if(diff<0) diff+=26;
        need[i]=diff;
    }
    
    for(int i=N/2;i>=1;i--){
        need[i]=(26+need[i]-need[i-1])%26;
    }
    
    for(int i=0;i<=N/2;i++){
        if(!visited[i]) DFS(i,-1,-1);
    }
    
    bool ok=true;
    for(int i=0;i<=N/2;i++){
        if(need[i]) ok=false;
    }
    
    if(ok) cout<<"YES\n";
    else cout<<"NO\n";
}


Measured memory_bytes: 8272
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define puts(i) cout<<i<<endl
#define pi 3.14159265358979323846264338
#define pb push_back
#define mp make_pair
#define inf 10000
using ll = long long;
using P = pair<int,int>;
using Pll = pair<ll,ll>;

ll divisor=1000000007;

int main(){
	int m,d,n;
	cin>>m>>d>>n>>d;
	int ans=abs(m-n);
	puts(ans);
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
 
use std::cmp::Ordering;
 
use std::cmp;
use std::cmp::min;
use std::collections::BTreeMap;
use std::process;
use std::cmp::Ord;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::collections::BTreeSet;
use std::mem;
 
use std::ops::{Deref, DerefMut, Index, IndexMut};
use std::any::{Any, TypeId};


fn main(){
    input!{
        n:usize,
        a:[(usize, usize);n-1],
    }
    let mut v= Vec::new();
    for i in 0..n{
        v.push(Vec::new());
    }
    for i in 0..n-1{
        v[a[i].0 - 1].push(a[i].1 - 1);
        v[a[i].1 - 1].push(a[i].0 - 1);
    }
    fn dfs(s:usize, v:&Vec<Vec<usize>>, d:&mut Vec<usize>, dis:usize){
        if d[s] != 1000000000{ return;}
        d[s] = dis;
        for i in 0..v[s].len(){
            dfs(v[s][i], v, d, dis+1);
        }

    }
    let mut d= vec![1000000000;n+1];
    dfs(0, &v, &mut d, 0);
    let mut mi = 0;
    let mut m = 0;
    for i in 0..n{
        if m<d[i]{
            mi = i;
            m = d[i];
        }
    }
    let mut d= vec![1000000000;n+1];
    dfs(mi, &v, &mut d, 0);
    let mut mi = 0;
    let mut m = 0;
    for i in 0..n{
        if m<d[i]{
            mi = i;
            m = d[i];
        }
    }

    if (m)%3 ==1{
        println!("Second");
    }
    else{
        println!("First");
    }
}



Measured memory_bytes: 37224
// 挿入ソート
#include<iostream>
#include<algorithm>
using namespace std;

//static const int MAX_N = 100;
static const int MAX_ELE = 1000;

int main(void)
{
    int v, j;
    int N;
    int ary_sequence[MAX_ELE];

    cin >> N;

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

    for(int i = 0; i < N - 1; i++)
    {
        cout << ary_sequence[i] << ' ';
    }

    cout << ary_sequence[N - 1] << endl;

    // -----▼▼▼ 挿入ソート ▼▼▼-----

    for(int i = 1; i < N; i++)
    {
        v = ary_sequence[i];
        j = i - 1;

        while( j >= 0 && ary_sequence[j] > v )
        {
            ary_sequence[j + 1] = ary_sequence[j];
            j--;
        }

        ary_sequence[j + 1] = v;

        for(int k = 0; k < N - 1; k++)
        {
        		cout << ary_sequence[k] << ' ';
        }

        cout << ary_sequence[N - 1] << endl;
    }

    // -----▲▲▲ 挿入ソート ▲▲▲-----

    return 0;
}



Measured memory_bytes: 3088
n=int(input())
CSF=[list(map(int,input().split())) for _ in range(n-1)]

for i in range(n):
  ans=0
  for c,s,f in CSF[i:]:
    if ans<s:
      ans=s
    elif ans%f!=0:
      ans+=f-ans%f
    ans+=c
  print(ans)

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

int main(){
  long long D, N;
  cin >> D >> N;
  cout << setprecision(9);
  if (N == 100){
    N += 1;
  }
  
  cout << pow(100, D) * N << endl;
}

Measured memory_bytes: 3852
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
#include <list>
using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int(a.size()))
#define F first
#define S second
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};



typedef struct _state{
  int from,vis;
  double cost;
  _state(double ic,int ifr,int iv):cost(ic),from(ifr),vis(iv){
  };
  bool operator<(const _state&r)const{
    return cost>r.cost;
  };
}state;

vector<PI> V[30];


main(){
  ios::sync_with_stdio(false);
  int n,m,p,a,b;
  while(cin>>n>>m>>p>>a>>b,n){
    --a,--b;
    int ti[n];
    rep(i,n)cin>>ti[i];

    rep(i,m)V[i].clear();

    rep(i,p){
      int x,y,z;
      cin>>x>>y>>z;
      --x,--y;
      V[x].pb(mp(y,z));
      V[y].pb(mp(x,z));
    }

    priority_queue<state> Q;
    Q.push(state(0,a,0));

    bool cost[1<<n][m];
    memset(cost,0,sizeof(cost));
    double ans=-1;

    while(!Q.empty()){
      int from=Q.top().from,cti=Q.top().vis;
      double ccost=Q.top().cost;
      Q.pop();
      if(cost[cti][from])continue;
      cost[cti][from]=true;
      if(from==b){
        ans=ccost;
        break;
      }

      rep(i,n){
        if(cti>>i&1)continue;
        rep(j,V[from].size()){
          int to=V[from][j].first;
          int cc=V[from][j].second;
          if(cost[cti|1<<i][to])continue;
          double ncost=ccost+1.0*cc/ti[i];
          Q.push(state(ncost,to,cti|1<<i));
        }
      }
    }
    if(ans<0)cout<<"Impossible"<<endl;
    else cout<<ans<<endl;
  }
}

Measured memory_bytes: 8092
#include <iostream>

#include <iomanip>
using namespace std;
int main(){

   int a;
    cin>>a;
    if(a==1){
        cout<<"Hello World";
    }
    else if (a==2){
       int s,b;
       cin>>s>>b;
        cout<<s+b;

    }





    return 0;
}


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


int main(void){
    long long int i,length_s,ans,cal,j;
    vector<long long int> num(20);
    ans = 0;

    string s;
    cin >> s;

    for(i=0; i<s.size(); i++){
        num.at(i) = s.at(i) - 48;
    }


    length_s = s.size();


    for(i=0; i < (1 << length_s - 1); i++){
        bitset<10> plus(i);
//        cout << plus << endl;
        cal = num.at(0);
        for(j = 0; j < length_s - 1; j++){
            if(plus[j] == 0){
                cal = cal * 10 + num.at(j+1);
//                cout << cal << endl;
            }else if(plus[j] == 1){
                ans += cal;
                cal = num.at(j+1);
//                cout << cal << endl;
            }
        }
        ans += cal;
//        cout << cal << endl;
    }

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

Measured memory_bytes: 3544
#include<bits/stdc++.h>
#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()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int H, W, K;
string S[303];
int cnt[303];
//---------------------------------------------------------------------------------------------------
int ans[303][303];
int idx = 1;
void go(int sx, int tx) {
	vector<int> vy;
	rep(y, 0, H) {
		int sm = 0;
		rep(x, sx, tx + 1) if (S[y][x] == '#') sm++;
		if (0 < sm) vy.push_back(y);
	}
	int pre = 0;
	int ny = vy.size();
	rep(i, 0, ny - 1) {
		rep(y, pre, vy[i] + 1) rep(x, sx, tx + 1) ans[y][x] = idx;
		idx++;
		pre = vy[i] + 1;
	}
	rep(y, pre, H) rep(x, sx, tx + 1) ans[y][x] = idx;
	idx++;
}
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> H >> W >> K;
	rep(y, 0, H) cin >> S[y];

	rep(y, 0, H) rep(x, 0, W) if (S[y][x] == '#') cnt[x]++;
	vector<int> vx;
	rep(x, 0, W) if (0 < cnt[x]) vx.push_back(x);

	int nx = vx.size();
	int pre = 0;
	rep(i, 0, nx - 1) {
		go(pre, vx[i]);
		pre = vx[i] + 1;
	}
	go(pre, W);

	rep(y, 0, H) {
		rep(x, 0, W) {
			if (x) printf(" ");
			printf("%d", ans[y][x]);
		}
		printf("\n");
	}
}







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

int main(){
    ll N;
    cin >> N;
    ll sum=0;
    // rep(i,N){
    //     if(i==N-1){
    //         sum += (i+1)%1;
    //         cout << (i+1)%1 << endl;
    //     }else{
    //         sum += (i+1)%(i+2);
    //         cout << (i+1)%(i+2) << " ";
    //     }
    // }
    ll n = N-1;
    ll Sn = n * (2 + (n-1)) /2;
    cout << Sn << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define ST(n) sort(n.begin(),n.end())

int main(){
	int N;
	cin >> N;
 	cout << N*N*N << endl;
}


Measured memory_bytes: 256