akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
using namespace std;
struct Nod {
	int x,y;
}vs[110],vs1[110];
bool vis[110];
int ans = 0, n, MAX;
bool cmp(Nod a, Nod b) {
	if(a.x != b.x) return a.x < b.x;
	else return a.y < b.y;
}
bool cmp1(Nod a, Nod b) {
	if(a.y != b.y) return a.y < b.y;
	else return a.x < b.x;
}
int main() {
	cin >> n;
	for(int i = 0; i < n; i ++) {
		cin >> vs[i].x >> vs[i].y;
	}
	for(int i = 0; i < n; i ++) {
		cin >> vs1[i].x >> vs1[i].y;
	}
	sort(vs,vs+n,cmp);
	sort(vs1,vs1+n,cmp1);
	for(int i = n-1; i >= 0; i --) {
		for(int j = 0; j < n; j ++) {
			if(vs[i].x < vs1[j].x && vs[i].y < vs1[j].y && !vis[j]) {
				vis[j] = true;
				ans++;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

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

int main(){
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    int n = sz(s);
    bool ans = true;
    rep(i, n) {
        if (i == a) {
            if (s[i] != '-') ans = false;
        }
        else if (!isdigit(s[i])) ans = false;
    }
    if (ans) cout << YES << endl;
    else cout << NO << endl;
    return 0;
}


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

using namespace std;

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

  int n;
  cin >> n;
  set<int> s;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    s.insert(x);
  }
  cout << (s.size() == n ? "YES" : "NO");

  return 0;
}

Measured memory_bytes: 9600
#include <iostream>
using namespace std;
int main(void){
    int  n; cin>>n;
    int red=0, blue =0;
    for(int i=0;i<n;i++){
        char a; cin>>a;
        if(a=='R') red++;
        else blue++;
    }
    if (red>blue) cout<<"Yes" ;
    else cout<<"No";
}

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

int main(){
  int h,w;
  cin>>h>>w;
  vector<string> a(h);
  rep(i,h) cin>>a[i];
  vector<int> d(26);
  rep(i,h)rep(j,w){
    d[a[i][j]-'a']++;
  }
  vector<int> res(3);
  rep(i,26){
    if(d[i]%4==1) res[0]++;
    else if(d[i]%4==2) res[1]++;
    else if(d[i]%4==3) res[2]++;
  }
  if(h%2!=0&&w%2!=0){
    if(res[0]+res[2]!=1||res[1]+res[2]>h/2+w/2){
      cout<<"No"<<endl;
      return 0;
    }
  }else if(w%2!=0){
    if(res[0]+res[2]!=0||res[1]>h/2){
      cout<<"No"<<endl;
      return 0;
    }
  }else if(h%2!=0){
    if(res[0]+res[2]!=0||res[1]>w/2){
      cout<<"No"<<endl;
      return 0;
    }
  }else{
    if(res[0]!=0||res[1]!=0||res[2]!=0){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<queue>

using namespace std;

const int MAX = 1000001;
int S[MAX];

struct data{
  int num,score;
  data(){}
  data(int n, int s):num(n),score(s){}
  bool operator < (const data& d) const {
    if(score != d.score) return score < d.score;
    return num > d.num;
  }
};

int main(){

  int n,m;
  cin >> n >> m;
  priority_queue<data> Q;
  Q.push(data(0,0));

  while(m--){
    int a,b;
    cin >> a >> b;
    S[a] += b;
    
    Q.push(data(a,S[a]));

    while(1){
      data now = Q.top();
      if(now.score == S[now.num]){
	cout << now.num << " " << now.score << endl;
	break;
      } 
      Q.pop();
    }
  }
  return 0;
}

Measured memory_bytes: 6008
sx,sy,tx,ty=map(int,input().split())
height=ty-sy
width=tx-sx
ans=""
ans+='U'*height+'R'*width+'D'*height+'L'*width
ans+='L'+'U'*(height+1)+'R'*(width+1)+'D'
ans+='R'+'D'*(height+1)+'L'*(width+1)+'U'
print(ans)


Measured memory_bytes: 3060
#include<stdio.h>
int main(void){
    int n, x;
    scanf("%d", &n);
    for(x = 1; x <= n; x++){
        if(x % 3 == 0){
            printf(" %d", x);
        } else if(judge(x) == 1){
            printf(" %d", x);
        }
    }
    printf("\n");
    return 0;
}

int judge(x){
    while(x != 0){
        if(x % 10 == 3){
            return 1;
        }
        x /= 10;
    }
    return 0;
}

Measured memory_bytes: 600
a, b, C = gets.split.map(&:to_i)

rad = (C * Math::PI / 180.0)

S = (a * b) / 2.to_f * Math.sin(rad)
L = a + b + (Math.sqrt(a**2 + b**2 - 2*a*b*Math.cos(rad)))
h = b * Math.sin(rad)

printf("%9.8f\n%9.8f\n%9.8f\n", S, L, h)

Measured memory_bytes: 8976
N, A, B, C, D = map(int, input().split())
S = ["#"] + list(input())

flag = True
for i in range(A, C):
    if S[i] == "#" and S[i + 1] == "#":
        flag = False
        break
else:
    for i in range(B, D):
        if S[i] == "#" and S[i + 1] == "#":
            flag = False
            break

if flag:
    if C < D:
        print("Yes")
    else:
        for i in range(B, D + 1):
            if S[i - 1] == "." and S[i] == "." and S[i + 1] == ".":
                print("Yes")
                break
        else:
            print("No")
else:
    print("No")


Measured memory_bytes: 6260
N = int(input())
C = list(input())

W = C.count("W")
R = C.count("R")
w = 0
r = R

ans = R
for i in range(1,N+1):
  if C[i-1] == "W":
    w += 1
  else:
    r -= 1
  ans = min(ans, max(w,r))
  
print(ans)

Measured memory_bytes: 10776
<?php   
   //長針は1分毎分6度だ。
   //短針は１時間で30度進む
   //cosシータ＝c/a
   //0のときは360にする
fscanf(STDIN,"%d%d%d%d",$a,$b,$h,$m);
   
	//explode(" ",trim(fgets(STDIN));
$kakudo_hour = 30*$h+$m*0.5;
$kakudo_minute = 6*$m;

if($kakudo_hour==0){
  $kakudo_hour=360;
}
if($kakudo_minute==0){
  $kakudo_minute=360;
}
    
$Theta=abs($kakudo_hour-$kakudo_minute);
//echo sqrt(47)."\n";
//echo $kakudo_hour." ".$kakudo_minute."\n";
//echo $Theta;
//echo cos(deg2rad($Theta))."\n";

$distan = ($a**2+$b**2)-(2*$a*$b*cos(deg2rad($Theta)));
$distan = sqrt($distan);
echo $distan."\n";


Measured memory_bytes: 16488
local mod = 1000000007
local mfl = math.floor

local function bmul(x, y)
  local x1, y1 = mfl(x / 31623), mfl(y / 31623)
  local x0, y0 = x - x1 * 31623, y - y1 * 31623
  return (x1 * y1 * 14122 + (x1 * y0 + x0 * y1) * 31623 + x0 * y0) % mod
end

local function badd(x, y)
  return (x + y) % mod
end

local function bsub(x, y)
  return x < y and x - y + mod or x - y
end

local function modpow(src, pow)
  local res = 1
  while 0 < pow do
    if pow % 2 == 1 then
      res = bmul(res, src)
      pow = pow - 1
    end
    src = bmul(src, src)
    pow = mfl(pow / 2)
  end
  return res
end

local function modinv(src)
  return modpow(src, mod - 2)
end

local fact = {1}
local invs = {1}
local invfact = {1}
for i = 2, 200010 do
  fact[i] = bmul(fact[i - 1], i)
  invs[i] = bmul(mfl(mod / i), mod - invs[mod % i])
  invfact[i] = bmul(invfact[i - 1], invs[i])
end

local function getComb(n, k)
  if k == 0 or k == n then return 1 end
  return bmul(fact[n], bmul(invfact[k], invfact[n - k]))
end

local h, w = io.read("*n", "*n")
local a, b = io.read("*n", "*n")
local mid = {}
local mh = h - a
for i = b + 1, w do
  mid[i - b] = getComb(i - 1 + mh - 1, i - 1)
end
local ret = 0
for i = b + 1, w do
  local r = getComb(w - i + a - 1, w - i)
  ret = badd(ret, bmul(mid[i - b], r))
end
print(ret)


Measured memory_bytes: 9996
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll INF= 1000000005; 
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }

  vector<int>dp(n,INF);
  dp[0]=0;
  for(int i=0;i<n;i++)
  {
    for(int j=i+1;j<=i+k;j++)
    { if(j<n){
      dp[j]=min(dp[j],dp[i]+abs(a[i]-a[j]));}
     			}
                }
          cout<<dp[n-1];
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  if (n % 2 == 0) cout << n << endl;
  else cout << n * 2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define range 
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")
int main(){

   // freopen("input.txt","r",stdin);
    IOS;
    clock_t clk = clock();
	int m,d;cin>>m>>d;
	int cnt = 0;
	forn1(j,m){
		forn1(i,d){
			int ten = i/10, one = i%10;
			if(ten >= 2 && one >= 2 && one*ten == j)cnt++;
		}
	}
	cout<<cnt;


    cerr << endl << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
    return 0;
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    ll N, K; cin >> N >> K;
    int cnt = 0;
    while(N > 0){
        cnt++;
        N /= K;
    }
    cout << cnt << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7752
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
using namespace std;

#define ll long long int
#define MOD 1000000007
#define INF 1e9 + 5
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define vi vector<int>
#define vl vector<long>
#define vll vector<long long>
#define pb push_back




struct activity {
    int a,b,c;
};


int solve(vector<activity> ar, int n) {
    int dp[n][3];
    //BASE CASES
    dp[0][0] = ar[0].a;
    dp[0][1] = ar[0].b;
    dp[0][2] = ar[0].c;

    for(int i = 1; i < n; i++) {
        dp[i][0] = ar[i].a + max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = ar[i].b + max(dp[i-1][0],dp[i-1][2]);
        dp[i][2] = ar[i].c + max(dp[i-1][1],dp[i-1][0]);
    }

    return max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}


int main() {
	fast
	int t=1;
	// cin>>t;
	while(t--) {
        int n;
        cin>>n;
        vector<activity> ar(n);
        for(int i= 0; i< n; i++) {
            cin>>ar[i].a>>ar[i].b>>ar[i].c;
        }
        cout<<solve(ar,n)<<"\n";

	}
	return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef pair<int,int> pii;
typedef pair<long long, int> pli;

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

ll mod = 998244353;

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

  int n,m,q;
  cin >> n >> m >> q;
  vi a(q),b(q),c(q),d(q);

  rep(i,q){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    a[i]--;
    b[i]--;
  }

  int ret = 0;

  vi A(n,1);

  while(1){
    int score = 0;
    rep(j,q){
      if(A[b[j]]-A[a[j]] == c[j])score += d[j];
    }
    ret = max(ret,score);

    for(int i = n-1;i >= 0;i--){
      if(A[i] < m){
        A[i]++;
        for(int j = i+1;j < n;j++){
          A[j] = A[i];
        }
        break;
      }
    }
    if(A[0] == m)break;
  }

  cout << ret << endl;
}

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


int vacation(int n, vector<vector<int>>& mat){
    vector<vector<int>> dp(n,vector<int>(3,INT_MIN));
    for(int i = 0; i < 3; i++) dp[0][i] = mat[0][i];
    
    for(int i = 1; i < n; i++){

        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(j != k){
                    dp[i][j] = max( dp[i][j], mat[i][j] + dp[i-1][k] );
                }
            }
        }
    }
    
    int m = max(dp[n-1][0],dp[n-1][1]);
    m = max(m,dp[n-1][2]);
    return m;
}

int main(){
    int n; cin >> n;
    vector<vector<int>> mat(n, vector<int> (3,0));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            cin >> mat[i][j];
        }
    }
    cout << vacation(n,mat);

    return 0;
}

Measured memory_bytes: 14000
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		if(N%2==1)
			System.out.println(N/2+1);
		else
			System.out.println(N/2);
	}
}


Measured memory_bytes: 24404
stdin.ReadLine()
|> ignore
|> fun () -> stdin.ReadLine()
|> fun x -> x.Split(' ')
|> Array.map int
|> fun arr ->
  Array.foldBack (
    fun (i, x) acc ->
      if i > 0 && arr.[i - 1] = x
      then acc
      else x::acc
  ) (arr |> Array.mapi (fun i x -> i, x)) []
  |> Seq.toArray
|> fun arr ->
  Array.concat [[| arr.[0] |]; arr; [| arr.[arr.Length - 1] |]]
|> fun arr ->
  arr
  |> Array.mapi (fun i x -> i, x)
  |> fun arri ->
    arri.[1..arr.Length - 2]
    |> Seq.fold (
      fun (c, ret) (i, x) ->
        (arr.[i - 1], arr.[i + 1])
        |> fun (p, n) -> c > 0 && ((x < p && x < n) || (x > p && x > n))
        |> fun sw -> if sw then (0, ret + 1) else (c + 1, ret)
    ) (0, 1)
|> fun (_, ret) -> ret
|> printfn "%d"


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

const int N = 2e5 + 5;

int n, b[N], ans[N];
string a[N];

int main() {
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 0; i < n; ++i) cin >> a[i];
	sort(a, a + n);
	b[0] = 1;
	int top = 0;
	for (int i = 1; i < n; ++i) {
		if (a[i - 1] == a[i]) ++b[top];
		else b[top = i] = 1;
	}
	int res = 0, cnt;
	for (int i = 0; i < n; ++i) {
		if (b[i] == res) ans[++cnt] = i;
		if (b[i] > res) ans[cnt = 1] = i, res = b[i];
	}
	//for (int i = 0; i < n; ++i) {
	//	cout << a[i] << ' ' << b[i] << endl;
	//}
	for (int i = 1; i <= cnt; ++i)
		cout << a[ans[i]] << endl;
	return 0;
}

Measured memory_bytes: 15616
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i+=2){
        int sum = 0;
        for (int k = 1; k <= i; k++){
            if (i % k == 0){
                sum++;
            }
        }
        if (sum == 8){
            ans++;
        }
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] data = new int[n];
		int num =0;
		for(int i =0;i<n;i++) {
			data[i]=sc.nextInt();
		}
		Arrays.sort(data);
		for(int i=0;i<n-2;i++) {
			for(int j = i+1;j<n-1;j++) {
				for(int k=j+1;k<n;k++) {
					if((data[i]!=data[j])&&(data[k]!=data[j])&&(data[i]!=data[k])&&(data[i]+data[j]>data[k])&&(data[k]+data[j]>data[i])&&(data[i]+data[k]>data[j])) {
						num++;
					}
				}
			}
		}
		System.out.println(num);
		sc.close();
	}

}


Measured memory_bytes: 36884
main::IO()
main=do
  s<-getLine
  let a:b:c:d:[]=map read (words s)
  print (if (d<=a) || (b<=c)
          then 0
          else if a<=c && d<=b
                then (d-c)
                else if c<=a && b<=d
                      then (b-a)
                      else if a<=c && b<=d
                            then (b-c)
                            else if c<=a && d<=b
                                  then (d-a)
                                  else 0 )

Measured memory_bytes: 508
s=input()
n=len("s")
q=int(input())
l=[]
start=""
end=""
m=0
for i in range(q):
    l.append(input())
    if l[i]=="1":
        m += 1

    else:
        due,f,c=l[i].split()
        if (f=="1" and m % 2==0) or (f !="1" and m % 2==1) :
            start += c
        else:
            end += c
if m % 2 ==0:

    start=start[::-1]
    s = start + s + end

else:
    s = s + end
    s = s[::-1]
    s = s + start

print(s)

Measured memory_bytes: 16976
package main

import (
	"fmt"
)

func main() {

	var N int
	fmt.Scanf("%d", &N)

	var flag int = 0
	for a := 1; a <= 9; a++ {
		for b := 1; b <= 9; b++ {
			if N == a*b {
				flag = 1
			}
		}
	}

	if flag == 1 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}


Measured memory_bytes: 1836
#include<stdio.h>

int main(){
	
	int K,S,i,j,ans=0;
	scanf("%d %d",&K,&S);
	
	for(i=0;i<=K;i++){
		for(j=0;j<=K;j++){
			if(0<=S-i-j&&S-i-j<=K){
				ans++;
			}
		}
	}
	
	printf("\n%d\n",ans);
	
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int d[20010][300];
int main(){
  int n,m,b[20],min,i,j,k,a,c;
  while(scanf("%d %d",&n,&m),n||m){
    for(i=0;i<n*300+300;i++)d[i/300][i%300]=1e8;
    for(i=0;i<m;i++)scanf("%d",&b[i]);
    d[0][128]=0;
    for(i=1;i<=n;i++){
      scanf("%d",&a);
      for(j=0;j<256;j++){
	for(k=0;k<m;k++){
	  c=MIN(255,j+b[k]);
	  if(c<0)c=0;	  
	  d[i][c]=MIN(d[i][c],d[i-1][j]+(c-a)*(c-a));
	}
      }
    }
    /*for(j=0;j<3;j++){
      for(i=120;i<140;i++)printf("%10d ",d[j][i]);
      printf("\n");
      }//*/
    min=1e8;
    for(i=0;i<256;i++)min=MIN(min,d[n][i]);
    printf("%d\n",min);
  }
  return 0;
}

Measured memory_bytes: 24036
///////////////////////////////////////////////////////////
#include <algorithm>
#include <array>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
///////////////////////////////////////////////////////////
#define ll long long
#define ull unsigned long long
///////////////////////////////////////////////////////////
template <class T>
T absolute(const T& n);
template <class T>
void input(vector<T>& vec);
template <class T>
void output(const vector<T>& vec);
template <class T>
T sum(const vector<T>& vec);
template <class T>
void upsort(vector<T>& vec);
template <class T>
void downsort(vector<T>& vec);
template <class T>
T max(const vector<T>& vec);
template <class T>
T min(const vector<T>& vec);
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<10;++i){
        if(n%i==0){
            if(n/i<10){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
template <class T>
T absolute(const T& n)
{
    if (n < 0) {
        return (-n);
    }
    return n;
}

template <class T>
void input(vector<T>& vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cin >> vec.at(i);
    }
}

template <class T>
void output(const vector<T>& vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cout << vec.at(i) << " ";
    }
    cout << endl;
}

template <class T>
T sum(const vector<T>& vec)
{
    T initial = 0.0;
    T s = accumulate(vec.begin(), vec.end(), initial);
    return s;
}

template <class T>
void upsort(vector<T>& vec)
{
    sort(vec.begin(), vec.end());
}

template <class T>
void downsort(vector<T>& vec)
{
    sort(vec.begin(), vec.end(), greater<T>());
}

template <class T>
T max(const vector<T>& vec)
{
    T m = vec.at(0);
    for (size_t i = 0; i < vec.size(); ++i) {
        m = max(m, vec.at(i));
    }
    return m;
}

template <class T>
T min(const vector<T>& vec)
{
    T m = vec.at(0);
    for (size_t i = 0; i < vec.size(); ++i) {
        m = min(m, vec.at(i));
    }
    return m;
}
///////////////////////////////////////////////////////////

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

const int mod=1e9+7;

void add(int &a,int b)
{
    a=(a+b)%mod;
}

int main()
{
    string s; cin>>s;
    int N=s.size();

    vector<vector<int>> dp(N+1,vector<int>(13));
    dp[0][0]=1;

    for(int i=0;i<N;i++){
        for(int j=0;j<13;j++){
            for(int d=0;d<10;d++){
                if(s[i]!='?' and d!=s[i]-'0') continue;
                add(dp[i+1][(j*10+d)%13],dp[i][j]);
            }
        }
    }
    cout<<dp[N][5]<<endl;
    return 0;
}

Measured memory_bytes: 8960
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 2e7 + 9, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int freq[27];
int main()
{
int n,i,flag=1;
string s;
cin>>s;
n=s.size();
for(i=0;i<n;++i){
    freq[s[i]-'a']++;
}
for(i=0;i<27;++i){
    if(freq[i]%2){
        flag=0;
        break;
    }
}
if(flag){
    printf("Yes\n");
}
else{
    printf("No\n");
}



    return 0;
}


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

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

  int N, M;
  string S;
  cin >> N >> M;
  cin >> S;
  vector<int> ans;
  int i = N;
  while(i > 0){
    if(i <= M){
      ans.push_back(i);
      break;
    }
    for(int j = M; j > 0; j--){
      if(S[i-j] == '0'){
        ans.push_back(j);
        i -= j;
        break;
      }
      if(j == 1){
        cout << -1 <<endl;
        return 0;
      }
    }
  }
  for(int i = 0; i < ans.size(); i++){
    cout << ans.at(ans.size() - i - 1) << " ";
  }
}


Measured memory_bytes: 1096
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();

        if (b % a == 0) {
            System.out.println(a + b);
        } else {
            System.out.println(b - a);
        }
    }

}


Measured memory_bytes: 23764
using System;
using System.Linq;


namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (x[1] > x[0])
            {
                Console.WriteLine("a < b");
            }
            else if (x[0] > x[1])
            {
                Console.WriteLine( "a > b");
            }
            else 
            {
                Console.WriteLine("a == b");
            }

        }
    }
}

Measured memory_bytes: 9352
#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>
using namespace std;
#define int long long
#define all(arr) arr.begin(),arr.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define vi vector<int>
#define vstr vector<string>
#define vbool vector<bool>
#define vvi vector<vector<int> >
#define mii map<int,int>
#define pb push_back
#define pii pair<int,int>
#define vpair vector<pii > 
#define mkp make_pair
#define scan(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) {cout<<a[i]<<' ';}cout<<'\n'
#define mem(a,v) memset(a,v,sizeof(a))
#define loop(i,a,b) for (int i = a; i < b; i++)
#define loope(i,a,b) for (int i = a; i <= b; i++)
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION std::cout.unsetf ( std::ios::fixed );std::cout.precision(9)
#define PI 3.14159265
#define S second
#define F first
#define CHECK cout<<"CHEDEDWB"<<endl
#define br '\n'
/*int mod = 1e9+7;
int inf = 1e18;
int m_inf = INT_MIN;
int MOD = 100001;*/

void solve()
{
	string s,t;
	cin>>s>>t;
	int n = s.size();
	int ans = 0;
	loop(i,0,n)
	{
		if(s[i]!=t[i])
			ans++;
	}
	cout<<ans<<endl;
}

int32_t main()
{
	FastIO; PRECISION;
	int t = 1;
	//cin>>t;
	while(t--)
		solve();
	return 0;
}

Measured memory_bytes: 3576
e1, e2, e3, e4 = map(int, input().split())
if e2 < e1: e1,e2 = e2,e1
if e4 < e3: e3,e4 = e4,e3
if e3 < e1: e1,e3 = e3,e1
if e4 < e2: e2,e4 = e4,e2
if e3 < e2: e2,e3 = e3,e2

if e1 == e2 and e3 == e4:
    print('yes')
else:
    print('no')


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

public class Main
{

	public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args) throws IOException
	{
		// TODO 自動生成されたメソッド・スタブ

		String str[] = input(2);
		System.out.println(GCD(Integer.parseInt(str[0]), Integer.parseInt(str[1])));

		/*
		String str1[] = input(1);
		String str2[] = input(Integer.parseInt(str1[0]));
		String str3[] = input(1);
		String str4[] = input(Integer.parseInt(str3[0]));

		int ai[] = new int[Integer.parseInt(str1[0])];
		int bi[] = new int[Integer.parseInt(str3[0])];

		for(int i = 0; i < ai.length; i++)
		{
			ai[i] = Integer.parseInt(str2[i]);
		}

		for(int i = 0; i < bi.length; i++)
		{
			bi[i] = Integer.parseInt(str4[i]);
		}

		//System.out.println(bi.length);

		for(int i = 0; i < bi.length; i++)
		{
			boolean b = false;
			for(int j = 0; j < Math.pow(2, ai.length); j++)
			{
				//System.out.println("J    : " + Integer.toBinaryString(j));
				int sum = 0;
				for(int k = 0; k < ai.length; k++)
				{
					//System.out.println("J>>>K: " + ((j>>>k) & 0x1));
					if(((j >>> k) & 0x1) == 0x1)
					{
						if(ai[k] > bi[i]) break;
						sum += ai[k];
					}
				}
				if(sum == bi[i]) b = true;
			}
			if(b) System.out.println("yes");
			else System.out.println("no");
		}
		//*/
	}

	public static int GCD(int x, int y)
	{
		int z = Math.max(x, y) % Math.min(x, y);
		if(z == 0) return Math.min(x, y);
		return GCD(z, Math.min(y, x));
	}

	public static String[] input(int Num) throws IOException
	{
		String str[] = new String[Num];
		String str2 = br.readLine();
		int j = 0;
		for(int i = 0; i < Num; i++)
		{
			if(i < Num - 1)
			{
				str[i] = str2.substring(j, str2.indexOf(" ", j));
				j = str2.indexOf(" ", j) + 1;
			}
			else
			{
				str[i] = str2.substring(j);
			}
		}
		return str;
	}

}



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

int main(){
	vector<int> mt;
	int i, tmp;
	for(i=0;i<10;i++){
		cin >> tmp;
		mt.push_back(tmp);
	}
	sort(mt.begin(), mt.end());
	reverse(mt.begin(), mt.end());
	for(i=0;i<3;i++){
		cout << mt[i] << endl;
	}
    return 0;
}

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

typedef long long int ll;
typedef long long unsigned int ull;
typedef long double ld;
typedef vector<int> vr;
typedef pair<int, int> pr;
#define pb push_back
#define ff first
#define ss second
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433
#define endl "\n"
//cout << fixed << setprecision(2);


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   string s;
   cin >> s;
   if (s == "1"){
      cout << "0" << endl;
   }
   else{
      cout << "1" << endl;
   }
   return 0;
}


Measured memory_bytes: 3644
// 動的計画法

#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

const int n_max = 1e5 + 5;

int n,k;
int a[n_max], b[n_max], c[n_max];

int dp[4][n_max]; //(a,b,c)をした時のi日めの幸福度の最大値

void rec(int i) {
  dp[0][i] = max(dp[1][i-1] + a[i], dp[2][i-1] + a[i]);
  dp[1][i] = max(dp[0][i-1] + b[i], dp[2][i-1] + b[i]);
  dp[2][i] = max(dp[1][i-1] + c[i], dp[0][i-1] + c[i]);
  if(i+1 < n) rec(i+1);
}

int main() {
  rep(i,n_max) rep(j,4) dp[j][i] = INF;
  cin >> n ;
  rep(i,n) cin >> a[i] >> b[i] >> c[i];
  dp[0][0] = a[0];
  dp[1][0] = b[0];
  dp[2][0] = c[0];
  rec(1);
  cout << max({dp[0][n-1],dp[1][n-1],dp[2][n-1]}) << endl;
}


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

using namespace std;

#define int long long

int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    int n;
    cin>>n;
    vector<int>v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    int ans=0;
    for(int i=1;i<n;i++){
        if(v[i]>=v[i-1])continue;
        else ans+=(v[i-1]-v[i]),v[i]=v[i-1];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4776
#include <iostream>
#include<ios>
#include <vector>
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll pow(ll x,ll n) {
    ll ans = 1;  
    for(ll i =0 ; i < n; i++) {
        ans *= x;
    }
    return ans;
}
int main(){
    ios::sync_with_stdio(false);
    //dp[i]: i円引き出すのに必要な最低操作数
    //dp[i] = min(dp[i-1],dp[i-6],dp[i-6^2],...mdp[i-9],dp[i-9^2,...])+1
    const ll INF=INT64_MAX>>3;
    int N;
    cin >> N;
    vector<ll> dp(N+1, INF);
    dp[0] = 0;
    for(int i = 1; i <= N; i++) { 
        chmin(dp[i], dp[i-1]+1);
        for(int j = 1; i-pow(6,j) >= 0; j++) {
            chmin(dp[i], dp[i-pow(6,j)]+1);
        }
        for(int j = 1; i-pow(9,j) >= 0; j++) {
            chmin(dp[i], dp[i-pow(9,j)]+1);
        }
    }
    cout << dp[N] << "\n";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define ll long long
#define PI 3.141592653589
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EPS 1e-7
#define f first
#define s second
using namespace std;
const ll MOD = 1e9+7;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int random_int(int l,int r){return uniform_int_distribution<int>(l,r)(rng);}
ll fast_power(ll x, ll p){
    ll res = 1;
    while(p > 0){
        if(p & 1){
            res = (res * x);
        }
        p = p >> 1;
        x = (x*x);
    }
    return res;
}

ll a[405];
ll pre[405];
ll dp[405][405];
ll solve(int l, int r) {
    if (l == r) return 0;
    if (r - l == 1) return a[l] + a[r];
    if (dp[l][r]) return dp[l][r];
    ll ans = LLONG_MAX;
    for (int i = l; i < r; i++) {
        ans = min(ans, solve(l,i) + solve(i + 1, r) + pre[r] - pre[l - 1]);
    }
    return dp[l][r] = ans;
}


int main() {
    IO;
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        pre[i] = a[i] + pre[i - 1];
    }
    cout << solve(1, n);
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::map;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = CRLF;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ui N{}, M{}; cin >> N >> M;
  vector<ui> res(N + 1);
  for(ui tmp = 0; tmp < M; ++tmp)
  {
    ui a{}, b{}; cin >> a >> b;
    ++res[a]; ++res[b];
  }
  for(size_t index = 1; index < res.size(); ++index)
  {
    cout << res[index] << CRLF;
  }

  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;

int main() {
    ll a; cin >> a;
    string b; cin >> b;
    ll bb = (b[0] - '0') * 100 + (b[2] - '0') * 10 + (b[3] - '0');
    cout << a * bb / 100 << endl;

}


Measured memory_bytes: 3632
## coding: UTF-8
from itertools import permutations, combinations,combinations_with_replacement,product
s = input().split()
q = [int(p) for p in s]

N = q[0]
X = q[1]
Y = q[2]

num = [i+1 for i in range(N)] #N=5 : [1, 2, 3, 4, 5]
answer = [0 for i in range(N-1)] #答えを格納するリスト N=5:[距離1の組み合わせの数, 距離2, 距離3, 距離4]
#print(answer)

pairs = list(combinations(num,2)) #考えられる組み合わせを全部作る


def calc_dist(i, j):
    #(i,j)の組み合わせに対して、最短距離を返す関数
    #i < jの制限をつけて入れること
    warp = abs(i-X) + 1 + abs(j-Y)
    return min(j-i, warp)
    #正常に動作していることを確認した。




for i in range(len(pairs)):
    #print(calc_dist(pairs[i][0], pairs[i][1])) #動作確認完了
    #距離が3：リストの3番目を＋1したい
    answer[calc_dist(pairs[i][0], pairs[i][1])-1] += 1

for i in range(N-1):
    print(answer[i])


Measured memory_bytes: 147920
import java.util.Scanner;
class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    String[] s = new String[n];
    for(int i = 0; i < n; i++) {
      s[i] = sc.next();
    }

    int[] count = new int[4];

    for(int i = 0; i < n; i++) {
      switch(s[i]) {
        case "AC": count[0]++; break;
        case "WA": count[1]++; break;
        case "TLE": count[2]++; break;
        case "RE": count[3]++; break;
      }
    }

    System.out.println("AC x " + count[0]);
    System.out.println("WA x " + count[1]);
    System.out.println("TLE x " + count[2]);
    System.out.println("RE x " + count[3]);
  }
}


Measured memory_bytes: 63568
# For taking integer inputs.
import math
from decimal import Decimal
from itertools import permutations


def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


n, m = invr()
A = []
for i in range(n):
    A.append(inlist())

A = sorted(A, key=lambda d: d[0])
res = 0
for a in A:
    if m == 0:
        break
    if a[1] >= m:
        res += a[0] * m
        m = 0
    else:
        res += a[0] * a[1]
        m -= a[1]
print(res)


Measured memory_bytes: 31880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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 (a>b) { a=b; return 1; } return 0; }

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

    ll N; cin >> N;
    ll a[200010], sum[200010]; 

   rep1(i,N+1) {cin >> a[i]; sum[i] = sum[i - 1] + a[i];}

    ll ans = 1e17;

    rep1(i,N) ans = min(ans, abs(sum[N] - 2*sum[i]));

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



Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <iostream>
// #include <unordered_map>
#define vi vector <ull>
#define ii pair<ull,ull>
#define vii vector<ii>
 
#define seti set<ull>
#define mii map<ull,ull>
#define um unordered_map
#define ll long long
#define ull  long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MAX 100100
#define _ << " " <<

ull mod = 1e9+7;

 
using namespace std;
 
int h,w;
char a[1001][1001];
ull dp[1001][1001];

ull get(int i, int j){
	if(i >= h || j >= w || a[i][j] == '#') return 0;
	if(dp[i][j] != -1) return dp[i][j];
	return dp[i][j] = (get(i+1, j)+get(i,j+1))%mod;
}

 
void solve(){
	cin >> h >> w;

	for(int i = 0 ; i < h; i++){
		for(int j = 0; j < w; j++){
			cin >> a[i][j];
		}
	}

	for(int i = 0; i < 1001; i++){
		for(int j = 0; j < 1001; j++){
			dp[i][j] = -1;
		}
	}

	dp[h-1][w-1] = 1;

	cout << get(0,0);
}
 
 
int main(){
	// freopen("data.in", "r", stdin);
	// freopen("data.out", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ull q;
	// cin >> q;
	q = 1;
	for(ull i = 0; i < q; i++){
		// cout << "Case #" << i+1 << ":" << endl;
 
		solve();
		// cout << endl;
	}
 
	
 
	return 0;
}

Measured memory_bytes: 9216
#include <iostream>

int N;
int ans;

int main() {
    std::cin >> N;
    ans = 0;
    for (int i = 3; i <= N; i += 2) {
        int cnt = 0;
        for (int j = 1; j <= i; ++j) {
            if (i % j == 0) {
                ++cnt;
            }
        }
        if (cnt == 8) {
            ++ans;
        }
    }
    std::cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	string s;
	cin >> s;
	while (s != "0"){
		int sum = 0;
		for (int i = 0; i < s.size(); i++){
			sum += s[i] - 48;
		}
		cout << sum << endl;
		cin >> s;
	}
}


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

using namespace std;

using ll = long long;

int main(int argc, const char *argv[]) {
  ll n, k;
  cin >> n >> k;

  // bを固定する
  ll ans = 0;
  for (ll b = 1; b <= n; b++) {
    ll p = n / b;
    ll r = n - p * b;
    ans += p * max(0ll, b - k);
    ans += max(0ll, r - k + 1);
  }

  if (k == 0) {
    ans -= n;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

#define N 100002
#define NIL -1

typedef struct{
    int l;
    int r;
    int p;
    int k;
    int d;
}Node;
Node node[N];
int dep(int);

int main(){
    int i,j,n,a,b,id,d;
    scanf("%d", &n);
    for(i = 0;i < n;i++){
        node[i].l = NIL;
        node[i].r = NIL;
        node[i].p = NIL;
    }
    for(i = 0;i < n;i++){
        scanf("%d",&id);
        scanf("%d",&node[id].k);
        b = id;
        for(j = 0;j < node[id].k;j++){
            scanf("%d", &a);
            if(j == 0){
                node[b].l = a;
                node[a].p = id;
                b = a;
            }else{
                node[b].r = a;
                node[a].p = id;
                b = a;
            }
        }
    }
    for(i = 0; i < n; i++){
        node[i].d = 0;
        a = node[i].p;
        while(1){
            if(a == NIL){
                break;
            }else{
                a = node[a].p;
                node[i].d++;
            }
        }
    }
    for(i = 0;i < n;i++){
        printf("node %d: parent = %d, depth = %d, ", i, node[i].p,node[i].d);
        if(node[i].l != NIL){
            if(node[i].p != NIL){
                printf("internal node, [");
            }else{
                printf("root, [");
            }
            for(j = 0;j < node[i].k-1;j++){
                if(j == 0){
                    b = node[i].l;
                    printf("%d, ", node[i].l);
                }else{
                    printf("%d, ", node[b].r);
                    b = node[b].r;
                }
            }
            if(node[i].k == 1){
                printf("%d]\n", node[i].l);
            }else{
                printf("%d]\n", node[b].r);
            }
        }else{
            if(node[i].p == NIL){
                printf("root, []\n");
            }
            else{
                printf("leaf, []\n");
            }
        }
    }  
    return 0;
}

Measured memory_bytes: 2564
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char* argv[])
{
  unsigned long long S; cin >> S;
  unsigned long long x1, x2, y1, y2;
  
  //S = abs(x1*y2-y1*x2); abs(x1*1-y1*1)
  x1 = y2 = ceil(sqrt(S));
  y1 = x1*y2-S;
  x2 = 1;
    
  cout << 0 << ' ' << 0 << ' ' << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653

int main(){
	ll a, b, n; cin >> a >> b >> n;
	ll ans;
	if (n>=b-1){
		ans = ((b-1)*a)/b;
	}
	else{
		ans = (n*a)/b;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>

int main() {
	int i;
	char G[51], K[51];
	scanf("%s%s", K, G);
	for (i = 0; i < strlen(G); i++) {
		printf("%c%c", K[i], G[i]);
	}
	if (strlen(K) > strlen(G)) {
		printf("%c", K[i]);
	}
	return 0;
}

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

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

string bef;
bef += S[0];
int ans = 1;
string target;

for(int i = 1;i < S.size(); i++){
	target += S[i];
	if(bef != target){
		ans++;
		bef = target;
		target ="";
	}
}

print(ans);
}


Measured memory_bytes: 640
n = int(input())
l = list(map(int, input().split()))

ss = []
s = 0
for i in range(1, n):
  if l[i-1] >= l[i]:
    s += 1
  else:
    ss.append(s)
    s = 0
else:
  ss.append(s)
print(max(ss))
    
  

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

using namespace std;

// input
int h,n;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> h >> n;
  rep(i,n) {
    int tmp;
    cin >> tmp;
    h -= tmp;
  }

  if(h <= 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  vector<int> count(2,0);
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) == '0') {
      count.at(i%2)++;
    }else{
      count.at((i+1)%2)++;
    }
  }
  cout << min(count.at(0),count.at(1)) << endl;
  return 0;
}

Measured memory_bytes: 512