akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    vector<int> cost(m);
    vector<int> open(m);
    for (int i = 0; i < m; i++) {
        cin >> cost[i];
        int bit_count; cin >> bit_count;
        for (int j = 0; j < bit_count; j++) {
            int bit; cin >> bit;
            open[i] |= 1 << (bit - 1);
        }
    }
    const int INF = 1E9;
    vector<int> dp(1 << n, INF);
    dp[0] = 0;
    for (int i = 0; i < m; i++) {
        for (int state = 0; state < (1<<n); state++) {
            int next = state | open[i];
            dp[next] = min(dp[next], dp[state] + cost[i]);
        }
    }
    
    int ans = dp[(1 << n) - 1];
    if (ans == INF) {
        ans = -1;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int n, m, c;
  scanf("%d %d %d", &n, &m, &c);
  int j = 0;
  int b[m];
  while (j < m)
  {
    scanf("%d", &b[j]);
    j++;
  }
  int a[n][m];
  int i = 0;
  while (i < n)
  {
    j = 0;
    while (j < m)
    {
      scanf("%d", &a[i][j]);
      j++;
    }
    i++;
  }
  
  long sum;
  int cnt = 0;
  i = 0;
  while (i < n)
  {
    j = 0;
    sum = 0;
    while (j < m)
    {
      sum += a[i][j] * b[j];
      j++;
    }
    sum += c;
    if (sum > 0)
    {
      cnt++;
    }
    i++;
  }
  
  printf("%d", cnt);
  return 0;
}


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

public class Main {

    public void solve() throws IOException {
        int h = nextInt(), w = nextInt();
        int res[][] = new int[h][w];
        int n = nextInt();
        int c[] = new int[n];
        for (int i = 0; i < n; i++) {
            c[i] = nextInt();
        }
        int cnt = 0;
        for (int i = 0; i < h; i++) {
            if(i % 2 == 0) {
                for (int j = 0; j < w; j++) {
                    if(c[cnt] != 0){
                        c[cnt]--;
                        res[i][j] = cnt + 1;
                    }else{
                        cnt++;
                        c[cnt]--;
                        res[i][j] = cnt + 1;
                    }
                }
            }else {
                for (int j = w - 1; j >= 0; j--) {
                    if(c[cnt] != 0){
                        c[cnt]--;
                        res[i][j] = cnt + 1;
                    }else{
                        cnt++;
                        c[cnt]--;
                        res[i][j] = cnt + 1;
                    }
                }
            }
        }
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                out.print(res[i][j] + " ");
            }
            out.println();
        }
    }


    BufferedReader br;
    StringTokenizer sc;
    PrintWriter out;

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Main().run();
    }

    void run() throws IOException {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
//            br = new BufferedReader(new FileReader("sum2.in"));
//            out = new PrintWriter(new File("sum2.out"));
            solve();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    String nextToken() throws IOException {
        while (sc == null || !sc.hasMoreTokens()) {
            try {
                sc = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return sc.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
}

Measured memory_bytes: 23892
import           Data.Maybe
import           Data.List

main :: IO ()
main = do
    input <- getContents
    let [n, m] : list : _ = map read . words <$> lines input :: [[Int]]
    let f n = (n * (n - 1)) `div` 2
    let
        x =
            (sum . map f . map length . group . sort . map (`mod` m) . scanl
                    (+)
                    0
                )
                list
    putStrLn $ show x


Measured memory_bytes: 13820
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N,A; cin >> N >> A;
    cout << N*N - A << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

bool isP(ll x){
    for(int i = 2; i*i <= x; i++){
        if(x %i == 0)
            return 0;
    }
    return 1;
}


int main()
{
   ll x;
   cin >> x;

    while(x){
        if(isP(x))
        return cout << x << endl,0;
        x++;
    }




}


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

int main(){
  int n;
  cin>>n;
  vector<int> h(n);
  for(int i=0;i<n;i++){
    cin>>h.at(i);
    }
  vector<int> dp(n);
  dp.at(0)=0;
  int ans=0;
  for(int i=1;i<n;i++){
    if(h.at(i)<=h.at(i-1)){
      dp.at(i)=dp.at(i-1)+1;
      }else{
      dp.at(i)=0;
      }
    ans=max(ans,dp.at(i));
    }
  cout<<ans<<endl;
}
  

Measured memory_bytes: 1024
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static int[] ans;
//	 static int mod = 998244353;
   public static void main(String[] args) {
	          
	   Scanner sc = new Scanner(System.in);
       String  N = sc.next();
       String ans;
       if(N.equals("AAA")||N.equals("BBB")) {
    	   ans="No";
       } else {
    	   ans="Yes";
       }
       System.out.println(ans); 
       return;
   }

}

Measured memory_bytes: 22996
using System;

class Program {
    private static int Main() {
        var input = Console.ReadLine();
        var values = input.Split( ' ' );

        var a = int.Parse( values[ 0 ] );
        var b = int.Parse( values[ 1 ] );
        var C = int.Parse( values[ 2 ] );

        var rad = C * Math.PI / 180;
        var S = a * b * Math.Sin( rad ) / 2;
        var L = Math.Sqrt( Math.Pow( a, 2 ) + Math.Pow( b, 2 ) - 2 * a * b * Math.Cos( rad ) );
        var h = b * Math.Sin( rad );

        Console.WriteLine( S );
        Console.WriteLine( a + b + L );
        Console.WriteLine( h );

        return 0;
    }
}

Measured memory_bytes: 5644
n = int(input())
t = x = y = 0
for i in range(n):
    next_t, next_x, next_y = map(int, input().split())
    diff = abs(next_x - x) + abs(next_y - y)
    if((diff - (next_t - t) % 2 == 0) or (diff == (next_t - t))):
        t, x, y = next_t, next_x, next_y
    else:
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int,int> P;

const ll INF = 9000000000000000000;
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

int N, M;
std::vector<P> S[153];
ll dp[153][20][80];

ll value(const P& lp, const P& rp){
    return (lp.second+rp.second) * std::abs(lp.first-rp.first);
}

ll rec(int y, int x, int t){
    if(y > N){return 0;}
    if(dp[y][x][t] != -1){return dp[y][x][t];}

    ll res = INF;
    REP(i, S[y+1].size()){
        res = std::min(res, rec(y+1, i, t) + value(S[y][x], S[y+1][i]));
    }

    if(t < M){
        REP(i, S[y+2].size()){
            res = std::min(res, rec(y+2, i, t+1) + value(S[y][x], S[y+2][i]));
        }
    }

    return dp[y][x][t] = res;
}

int main(){
    while(std::cin >> N >> M, N){
        REP(i, N+3){
            S[i].clear();
        }

        REP(i, N){
            int k;
            std::cin >> k;

            REP(j, k){
                int x, d;
                std::cin >> x >> d;
                x--;

                S[i+1].push_back(mp(x, d));
            }
        }

        REP(i, S[1].size()){
            S[0].push_back(S[1][i]);
        }

        REP(i, S[2].size()){
            S[0].push_back(S[2][i]);
        }

        REP(i, S[N].size()){
            S[N+1].push_back(S[N][i]);
            S[N+2].push_back(S[N][i]);
        }

        REP(i, S[N-1].size()){
            S[N+1].push_back(S[N-1][i]);
        }

        REP(i, N+3){
            REP(j, 20){
                REP(k, M+1){
                    dp[i][j][k] = -1;
                }
            }
        }

        ll res = INF;
        REP(i, S[0].size()){
            res = std::min(res, rec(0, i, 0));
        }

        std::cout << res << std::endl;
    }
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string S;


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	int cur=0;
	map<int,int> M;
	
	M[0]++;
	cin>>S;
	ll ret=0;
	reverse(ALL(S));
	ll num=1;
	FORR(c,S) {
		cur=(cur+(c-'0')*num)%2019;
		num=num*10%2019;
		ret+=M[cur];
		M[cur]++;
	}
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N; cin >> N; string S; cin >> S;
    if(N>=3200) cout << S << endl;
    else cout << "red" << endl;

    return 0;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int n,m;
int *dp;

int dfs(int s,vector<int>* graph){
  if(graph[s].size() == 0){
    dp[s] = 0;
    return dp[s];
  }
  int temp = -1;
  for(int i=0;i<graph[s].size();i++){
    int next = graph[s][i];
    if(dp[next] != -1){
      temp = max(temp,dp[next]+1);
    }
    else{
      temp = max(temp,dfs(next,graph)+1);
    }
  }
  dp[s] = temp;
  return temp;
}

int main(){
  cin >> n >> m;
  int x,y;
  vector<int> graph[n];
  int start[n];
  dp = new int[n];
  for(int i=0;i<n;i++){
    start[i] = 1;
    dp[i] = -1;
  }
  for(int i=0;i<m;i++){
    cin >> x >> y;
    graph[x-1].push_back(y-1);
    start[y-1] = 0;
  }
  
  for(int i=0;i<n;i++){
    if(start[i] == 1) dfs(i,graph);
  }

  int ans = -1;
  for(int i=0;i<n;i++){
    ans = max(ans,dp[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 11136
#include<stdio.h>
int main(void){
    int a,b,c,d,x,y,e,f,g,h;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    x=0;
    x+=a;
    x+=b;
    x+=c;
    x+=d;
    scanf("%d %d %d %d",&e,&f,&g,&h);
    y=0;
    y+=e;
    y+=f;
    y+=g;
    y+=h;
    if(x>y)printf("%d\n",x);
    else printf("%d\n",y);
    return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

inline ld dist(ld &x1, ld &y1, ld &x2, ld &y2) {
    return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

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

    int n;
    cin >> n;
    ld x[8], y[8];
    rep(i, n) cin >> x[i] >> y[i];
    vector<int> p;
    rep(i, n) p.push_back(i);

    ld ave = 0.0;

    do {
        ld sum = 0.0;

        rep(i, n - 1) {
            sum += dist(x[p[i]], y[p[i]], x[p[i + 1]], y[p[i + 1]]);
        }
        ave += sum;
    } while (NP(p));

    for (ld i = 1.0; i <= n; i++) ave /= i;
    cout << ave << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        final int n = sc.nextInt();
        int[] A = new int[n];
        int M = 0;
        for(int i = 0;i < n;i++){
            A[i] = sc.nextInt();
            M = Math.max(M, A[i]);
        }
        int m = 0;
        for(int i = 0;i < n;i++){
            if(A[i] != M && Math.abs(M-A[i]*2) <= Math.abs(M-m*2))   m = A[i];
        }
        System.out.println(M+" "+m);
    }
}

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    ll m;
    cin >> n >> m;
    vector<ll> a(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        a[i] += a[i - 1];
    }

    map<ll, ll> memo;
    for (ll x : a) {
        memo[x % m]++;
    }

    ll ans = 0;
    for (auto& p : memo) {
        ans += p.second * (p.second - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<pair<int, int> > v;
    for (int i = 0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        v.emplace_back(b, a);
    }
    sort(v.begin(), v.end());
    set<int> s;
    for (int i = 1; i <= m; ++i)
        s.insert(i);
    long long ans = 0;
    for (int i = n - 1; i >= 0; --i) {
        auto it = s.lower_bound(v[i].second);
        if (it == s.end()) continue;
        ans += v[i].first;
        s.erase(it);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8804
#include <stdio.h>
#include <stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main()
{
    int i;
    int a[3];
    for(i=0;i<3;i++) scanf("%d", &a[i]);
    qsort(a, 3, sizeof(int), compare_int);
    
    printf("%d", a[2]-a[0]);
    

    return 0;
}

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

#define ll long long

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

    int n;
    cin >> n;
    if (n%1000 == 0)   cout << "0\n";
    else cout << 1000 - (n%1000) << "\n";
}


Measured memory_bytes: 3576
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const N = Number(input[0][0]);

  return N % 1000 === 0 ? 0 : 1000 - (N % 1000);
};

console.log(main(read()));


Measured memory_bytes: 29692
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int closest(int a, int b, int *c, int *d, int M) {
	int i;
	int x, y;
	int ol_dist, new_dist;
	int point;
	for(i = 0; i < M; i += 1) {
		x = abs(a - c[i]);
		y = abs(b - d[i]);
		if(i == 0) {
			ol_dist = x + y;
			point = 0;
		} else {
			new_dist = x + y;
			if(new_dist < ol_dist) {
				ol_dist = new_dist;
				point = i;
			}
		}
	}
	return point;
}

int main(void) {
	int i;
	int N, M;
	int *a, *b, *c, *d;
	char buf[128], *ch;

	fgets(buf, sizeof(buf), stdin);
	ch = strtok(buf, " ");
	N = atoi(ch);
	ch = strtok(NULL, " ");
	M = atoi(ch);

	a = (int *)calloc(N, sizeof(int));
	b = (int *)calloc(N, sizeof(int));
	c = (int *)calloc(M, sizeof(int));
	d = (int *)calloc(M, sizeof(int));

	for(i = 0; i < N; i += 1) {
		fgets(buf, sizeof(buf), stdin);
		ch = strtok(buf, " ");
		a[i] = atoi(ch);
		ch = strtok(NULL, " ");
		b[i] = atoi(ch);
	}
	for(i = 0; i < M; i += 1) {
		fgets(buf, sizeof(buf), stdin);
		ch = strtok(buf, " ");
		c[i] = atoi(ch);
		ch = strtok(NULL, " ");
		d[i] = atoi(ch);
	}

	for(i = 0; i < N; i += 1) {
		printf("%d\n", 1 + closest(a[i], b[i], c, d, M));
	}

	free(a);
	free(b);
	free(c);
	free(d);
	return 0;
}


Measured memory_bytes: 2088
n,m=map(int, input().split())

if n==1 and m==1:
    print(1)
elif n>=2 and m==1 or n==1 and m>=2:
    print(n*m-2)
elif n==2 and m>2 or n>=2 and m==2:
    print(0)
else:
    print((n-2)*(m-2))

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

int main(){
    int N;
    cin>>N;
    vector<int> P(N);
    for(auto &p:P)cin>>p;
    auto test = [&](){
        for(int i=0;i<N-1;i++){
            if(P[i]>P[i+1]) return false;
        }
        return true;
    };
    if(test()){
        cout<<"YES"<<endl;
        return 0;
    }
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            swap(P[i],P[j]);
            if(test()){
                cout<<"YES"<<endl;
                return 0;
            }
            swap(P[i],P[j]);
        }
    }
    cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<cmath>
#include<string>

int main(int, char**)
{
	std::string a_str, b_str;
	std::cin >> a_str >> b_str;

	int a = std::stoi(a_str);
	int b = std::stoi(b_str);

	std::cout << (a * b) << " " << (2 * a + 2 * b) << std::endl;
}


Measured memory_bytes: 3148
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] A = new int[5];
		for(int i = 0; i < 5; i++)
			A[i] = sc.nextInt();
		Arrays.sort(A);
		if(A[4]-A[0] <= sc.nextInt())
			System.out.println("Yay!");
		else
			System.out.println(":(");
	}

}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	ll sum=0;
	for(int i=1;i<=n;i++)
	{
		if(i%3==0 || i%5==0)
		{
			continue;
		}
		else
		sum+=i;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) int((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<int> V;
typedef vector<vector<int>> VV;
typedef pair<int, int> P;
typedef map<string, int> M;
typedef unordered_map<int, int> HM;
typedef set<int> S;
typedef queue<int> Q;

int INF = -10000000;
V nums{2,5,5,4,5,6,3,7,6};
int main(){
    int n,m; cin>>n>>m;
    V a(m);
    for(int i=0; i<m; i++){
        int tmp; cin>>tmp;
        tmp--;
        a[i] = tmp;
    }
    sort(ALL(a), greater<int>());
    V dp(n+1, INF);
    dp[0] = 0;
    for(int i=0; i<=n; i++){
        for(int j=0; j<m; j++){
            if(i >= nums[a[j]]) dp[i] = max(dp[i], dp[i-nums[a[j]]]+1);
        }
    }
    int len=dp[n];
    V ans(len);
    for(int i=0; i<len; i++){
        for(int j=0; j<m; j++){
            if(n>=nums[a[j]] && dp[n-nums[a[j]]] != INF && dp[n-nums[a[j]]] == dp[n]-1){
                ans[i] = a[j]+1;
                n -= nums[a[j]];
                break;
            }
        }
    }
    for(int i: ans) cout<<i;
    cout<<endl;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        s: Chars
    };
    let mut vec = vec![];
    for c in s {
        match c {
            '0' | '1' => vec.push(c),
            _ if !vec.is_empty() => {
                vec.pop().unwrap();
            }
            _ => (),
        }
    }
    println!("{}", vec.iter().collect::<String>());
}


Measured memory_bytes: 2144
/* --- author: dxm --- */
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

void qread(int &x){
	int neg=1;x=0;
	char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')neg=-1;c=getchar();}
	while(c>='0'&&c<='9')x=10*x+c-'0',c=getchar();
	x*=neg;
}

const int maxn=200005;
const int maxm=3005;
const int mod=1e9+7;
int n,h,w;
int r[maxm],c[maxm],p[maxm],dp[maxm][2];
int fac[maxn],ifac[maxn];

bool cmp(int a,int b){
	if(r[a]!=r[b])return r[a]<r[b];
	return c[a]<c[b];
}

int C(int a,int b){
	return a<b?0:1LL*fac[a]*ifac[b]%mod*ifac[a-b]%mod;
}

int main(){
#ifdef FILE
	freopen("FILE.in","r",stdin);
	freopen("FILE.out","w",stdout);
#endif
	fac[0]=fac[1]=ifac[0]=ifac[1]=1;
	for(int i=2;i<=200000;i++){
		fac[i]=1LL*fac[i-1]*i%mod;
		ifac[i]=1LL*(mod-mod/i)*ifac[mod%i]%mod;
	}
	REP(i,200000)ifac[i]=1LL*ifac[i-1]*ifac[i]%mod;
	scanf("%d%d%d",&h,&w,&n);
	REP(i,n)scanf("%d%d",&r[i],&c[i]);
	r[++n]=1;c[n]=1;
	r[++n]=h;c[n]=w;
	REP(i,n)p[i]=i;
	sort(p+1,p+1+n,cmp);
	dp[1][1]=1;
	REP(i,n)rep(f,2){
		int cur=dp[i][f];
		if(!cur)continue;
		for(int j=i+1;j<=n;j++){
			if(r[p[j]]>=r[p[i]]&&c[p[j]]>=c[p[i]]){
				int a=r[p[j]]-r[p[i]],b=c[p[j]]-c[p[i]];
				dp[j][f^1]=(dp[j][f^1]+1LL*cur*C(a+b,a)%mod)%mod;
			}
		}
	}
	printf("%d\n",(dp[n][0]-dp[n][1]+mod)%mod);
#ifdef TIME
	printf("Running Time = %d ms\n",int(clock()*1000.0/CLOCKS_PER_SEC));
#endif
	return 0;
}

/*
Input:
-----------------
Output:
*/


Measured memory_bytes: 1920
#include<stdio.h>

long long int check(int);
long long int solve();

long long int num,van_num;
long long int cab[1000000];

int main(){
  long long int i;
  long long int ans;

  scanf("%d %d",&num,&van_num);
  for(i=0;i<num;i++){
    scanf("%d",&cab[i]);
  }
  ans=solve();
  printf("%d\n",ans);
  
  return 0;
}

long long int check(int max_burd){
  long long int i=0,j;
  long long int van_burd;
  for(j=0;j<van_num;j++){
    van_burd=0;
    while(van_burd+cab[i]<=max_burd){
      van_burd+=cab[i];
      i++;
      if(i==num) return num;
    }
  }
  return i;
}

long long int solve(){
  long long int left=0;
  long long int right=100000*100000;
  long long int mid;
  long long int num_pie;

  while(right-left>1){
    mid=(left+right)/2;
    num_pie=check(mid);
    if(num_pie>=num){
      right=mid;
    }else{
      left=mid;
    }
  }

  return right;
}

Measured memory_bytes: 1380
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000

typedef long long ll;
const int dx[] = {0, 1, 1, 0, -1, -1};
const int dy[2][6] = {{1, 0, -1, -1, -1, 0}, {1, 1, 0, -1, 0, 1}};

bool ng[256][256];
int sx, sy, gx, gy, lx, ly;
const int base = 128;

struct edge {
    int tox;
    int toy;
    int tot;
    int cost;
    edge() {}
    edge(int x, int y, int t, int cost) : tox(x), toy(y), tot(t), cost(cost) {}
};

vector<edge> G[256][256][7];

struct point {
    int x;
    int y;
    int time;
    point() {}
    point(int x, int y, int time) : x(x), y(y), time(time) {}
};

bool operator<(const point& lhs, const point& rhs) {
    return lhs.x < rhs.x;
}

bool operator>(const point& lhs, const point& rhs) {
    return lhs.x > rhs.x;
}

bool isIn(int x, int y) {
    return abs(x-base) <= lx && abs(y-base) <= ly;
}

int dijkstra() {
    int d[256][256][6];
    for (int i = 0; i < 256; i++) {
        for (int j = 0; j < 256; j++) {
            for (int k = 0; k < 6; k++) {
                d[i][j][k] = INF;
            }
        }
    }
    d[sx][sy][0] = 0;
    priority_queue<pair<int, point>, vector<pair<int, point> >, greater<pair<int, point> > > que;
    que.push(make_pair(0, point(sx, sy, 0)));
    while (!que.empty()) {
        auto now = que.top(); que.pop();
        point p = now.second;
        int dist = now.first;
        if (dist > d[p.x][p.y][p.time]) continue;
        for (int i = 0; i < G[p.x][p.y][p.time].size(); i++) {
            int nx = G[p.x][p.y][p.time][i].tox;
            int ny = G[p.x][p.y][p.time][i].toy;
            if (ng[nx][ny]) {
                continue;
            }
            if (!isIn(nx, ny)) continue;
            int nt = (p.time+1) % 6;
            int cost = G[p.x][p.y][p.time][i].cost;
            if (d[nx][ny][nt] > d[p.x][p.y][p.time] + cost) {
                d[nx][ny][nt] = d[p.x][p.y][p.time] + cost;
                que.push(make_pair(d[nx][ny][nt], point(nx, ny, nt)));
            }
        }
    }
    int ret = INF;
    for (int i = 0; i < 6; i++) {
        ret = min(ret, d[gx][gy][i]);
    }
    if (ret < INF) return ret;
    else return -1;
}

int main() {
    cin >> sx >> sy >> gx >> gy;
    sx += base;
    sy += base;
    gx += base;
    gy += base;
    int n;
    cin >> n;
    while (n--) {
        int x, y;
        cin >> x >> y;
        ng[base+x][base+y] = true;
    }
    cin >> lx >> ly;
    for (int x = 1; x <= 128+lx; x++) {
        for (int y = 1; y <= 128+ly; y++) {
            for (int i = 0; i < 6; i++) {
                for (int j = 0; j < 6; j++) {
                    G[x][y][i].push_back(edge(x+dx[j], y+dy[x%2][j], (i+1)%6, 1));
                }
                G[x][y][i].push_back(edge(x, y, (i+1)%6, 1));
                int tmp = abs((x-base)*(y-base)*i) % 6;
                G[x][y][i][tmp].cost = 0;
            }
        }
    }
    cout << dijkstra() << endl;
    return 0;
}

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

using namespace std;

#define PB push_back
#define f first
#define s second
#define what_is(x) cerr << #x << " is " << x << endl;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    while(b <= a)
    {
        b *= 2;
        k--;
    }
    while(c <= b)
    {
        c *= 2;
        k--;
    }
    if(k<0)
    {
        cout << "No";
    }
    else
    {
        cout << "Yes";
    }
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

int maximumPoints(vector<vector<int>> days) {
	int dyasCount = days.size();
	int possibleActivitesCount = 3;
	vector<vector<int>> dp(dyasCount, vector<int>(possibleActivitesCount));

	dp[0] = days[0];
	for (int i = 1; i < dyasCount; ++i)
		for (int j = 0; j < 3; ++j)
			dp[i][j] = max(dp[i - 1][(j + 1) % possibleActivitesCount], dp[i - 1][(j + 2) % possibleActivitesCount]) + days[i][j];


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


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

	vector<vector<int>> days(n, vector<int>(3));
	for (auto& day : days)
		cin >> day[0] >> day[1] >> day[2];

	cout << maximumPoints(days) << endl;

	return 0;
}



Measured memory_bytes: 16640
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin >> n >>k;
	int p[n];
	for (int i = 0; i < n;i++) cin>>p[i];
	sort(p,p+n);
	int ans = 0;
	for (int i = 0; i < k;i++){
		ans += p[i];
	}
	printf("%d",ans);
}


Measured memory_bytes: 3696
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>

#ifdef GONGKUNPENG
#include <cassert>
#endif

#define GG 0
#define GIO 1
#define uint unsigned
#define max(a, b) std::max((a), (b))
#define min(a, b) std::min((a), (b))
#define sort(...) std::sort(__VA_ARGS__)
#define ms(a, v) memset(a, v, sizeof(a))
#define sfor(i, n) for (int i = 1; i <= n; ++i)
#define tfor(i, n) for (int i = 0; i < n; ++i)

#if __cplusplus >= 201103L
using ll = long long;
using ull = unsigned long long;
#else
typedef long long ll;
typedef unsigned long long ull;
#endif

#if GIO
class GLIB
{
#define BUFSIZE 1 << 20
#define uns(x) (x == ' ' || x == '\t' || x == '\n' || x == '\r')
	char ruf[BUFSIZE], wuf[BUFSIZE], *p, *q, *r, rcha;
	bool rneg;

public:
#if GG
#else
	GLIB() : p(ruf), q(ruf), r(wuf), rcha(' ')
	{
	}

	~GLIB()
	{
		fwrite(wuf, 1, r - wuf, stdout);
	}
#endif
	inline void flush()
	{
		fwrite(wuf, 1, r - wuf, stdout), r = wuf;
	}

	inline int readc()
	{
#if GG
		return getchar();
#else
		return (p == q && (q = (p = ruf) + fread(ruf, 1, BUFSIZE, stdin), p == q) ? -1 : *p++);
#endif
	}

	template <typename T, typename... Args>
	void read(T &x, Args &... args)
	{
		read(x), read(args...);
	}

	inline void read() {}

	inline void read(char *s)
	{
		while (uns(rcha))
			rcha = readc();
		while (!uns(rcha) && rcha > 0)
			*s++ = rcha, rcha = readc();
		*s = '\0';
	}

	inline void readl(char *s)
	{
		while (uns(rcha))
			rcha = readc();
		while (rcha != '\n' && rcha > 0)
			*s++ = rcha, rcha = readc();
		*s = '\0';
	}

	template <typename T>
	inline void read(T &x)
	{
#ifdef GONGKUNPENG
		static_assert(std::is_integral<T>::value);
#endif
		x = rcha = rneg = 0;
		while (!isdigit(rcha) && rcha != '-')
			rcha = readc();
		rcha == '-' && (rneg = true, rcha = readc());
		while (isdigit(rcha))
			x = (x << 3) + (x << 1) - 48 + rcha,
			rcha = readc();
		rneg && (x = -x);
	}

	inline void writec(const char &c)
	{
#if GG
		putchar(c);
#else
		(r - wuf == BUFSIZE) && (fwrite(wuf, 1, BUFSIZE, stdout), r = wuf);
		*r++ = c;
#endif
	}

	template <typename T, typename... Args>
	void write(const T &x, const Args &... args)
	{
		write(x), write(args...);
	}

	inline void write() {}

	inline void write(const char &x)
	{
		writec(x);
	}

	template <typename T>
	void write(T x)
	{
#ifdef GONGKUNPENG
		static_assert(std::is_integral<T>::value);
#endif
		if (x < 0)
		{
			writec('-');
			write(-ll(x));
			return;
		}
		if (x > 9)
			write(x / 10);
		writec(x % 10 ^ 48);
	}

	inline void write(const char *s)
	{
		while (*s)
			writec(*s++);
	}
#undef BUFSIZE
} io;
#endif

const ll INF = 0x3f3f3f3f;
const uint MAXN =
#ifdef GONGKUNPENG
	15
#else
	1000005
#endif
	;

int main()
{
	int n, r;
	io.read(n, r);
	io.write(n > 9 ? r : 1000 - 100 * n + r, '\n');
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	string s; cin >> s;
	reverse(ALL(s));
	cout << s << endl;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
int read() {
	int x = 0,f = 0;char ch = getchar();
	while(!isdigit(ch)) {if(ch == '-') f = 1;ch = getchar();}
	while(isdigit(ch)) {x = x*10 + ch - '0';ch = getchar();}
	return f?-x:x;
}
const int N = 2e6+ 100;
#define LL long long 
int n,f[N];
LL ans = 0;
int main() 
{
	n = read();
	for(int i = 1;i <= n;i++) {
		for(int j = i;j <= n;j+=i) f[j]++;
	}
	for(int i = 1;i < n;i++) {
		ans = ans + f[i];
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

typedef long long int ll;

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll x,y,n,m,p;
    cin >> x >>y >>n >> m >> p;
    ll a[n],b[m],c[p];
    for(int i=0 ; i<n ; i++)
        cin >> a[i];
    for(int i=0 ; i<m ; i++)
        cin >> b[i];
    for(int i=0 ; i<p ; i++)
        cin >> c[i];

    sort(a,a+n);
    reverse(a,a+n);

    sort(b,b+m);
    reverse(b,b+m);

    sort(c,c+p);
    reverse(c,c+p);

    ll ans = 0;
    vector<ll> v;
    for(int i=0 ; i<x ; i++)
        v.push_back(a[i]);
    for(int i=0 ; i<y ; i++)
        v.push_back(b[i]);

    for(int i=0 ; i<v.size() ; i++)
            ans+=v[i];

    sort(v.begin(),v.end());

    ll j=0,k=0;

    for(int i=0 ; i<p ; i++)
    {
        if(v[j] < c[i])
        {
            ans-=v[j];
            ans+=c[i];
            j++;
        }
        else
            break;
    }
    cout << ans;




    return 0;
}


Measured memory_bytes: 4852
#include <bits/stdc++.h>
#include <complex>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef std::pair<int, int> ii;
typedef tuple<int,int,int> i3;
typedef std::pair<int, ii> iii;
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::vector<ii> vii;
typedef std::vector<iii> viii;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll mod = 998244353;
const ll MOD = 998244353;
const ld pi=acos(-1);
const double PI = acos(-1);
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);  // greater than or equal
#define ub(v,n) upper_bound(v.begin(), v.end(), n);  // greater than
#define all(x) (x).begin(), (x).end();
#define fi first;
#define se second;
#define endl '\n';
#define loop(i,n) for(int i=0;i<(n);i++);
#define FOR(i, m, n) for(int i = m; i < n; i++);

ll gcd(ll a, ll b) {return b==0 ? a : gcd(b,a%b);}
ll add(ll x, ll y) { return ((x + y) % MOD + MOD) % MOD;}
ll sub(ll x, ll y) { return ((x - y) % MOD + MOD) % MOD;}
ll mult(ll x, ll y) { return (x * y) % MOD;}
ll po(ll base, ll exp, ll mod){
	if(exp==0) return 1;
	if(exp&1) return (base*po(base,exp-1,mod))%mod;
	else return po((base*base)%mod, exp/2,mod);
}

ll fact[200002];
ll rfact[200002];


ll C(ll n, ll k){
	if (fact[0]==-1){
		fact[0]=1;
		for (int i=1; i<200002; i++){
			fact[i]=mult(fact[i-1],i);
		}
		for (int i=0; i<200002; i++){
			rfact[i]=po(fact[i],mod-2,mod);
		}
	}

	return mult(fact[n],mult(rfact[n-k],rfact[k]));
}


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  fact[0]=-1;
  ll n,m,k;
  cin >> n >> m >> k;
  ll ans=0;
  for (int i=0; i<=k; i++){
  	ans=add(ans,mult(m,mult(C(n-1,i),po(m-1,n-1-i,mod))));
  }
  cout<<ans<<endl;


}




Measured memory_bytes: 6728
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,M;
    cin >> N >> M;
    vector<int>H(N);
    for(int i = 0; i < N; i++) {
        cin >> H[i];
    }
    vector<vector<int>>cnt(N);
    for(int i = 0; i < M; i++) {
        int A,B;
        cin >> A >> B;
        A--;B--;
        cnt[A].push_back(B);
        cnt[B].push_back(A);
    }
    int ans = 0;
    for(int i = 0; i < N; i++) {
        bool ok = true;
        for(int j = 0; j < cnt[i].size(); j++) {
            if(H[cnt[i][j]] >= H[i]) {
                ok = false;
            }
        }
        if(ok) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 9768
#include<bits/stdc++.h>
using namespace std;
long long a, b, c;
int main()
{
    cin >> a >> b >> c;
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) cout << 0;
    else cout << min (min (a*b, a*c), b*c);
    return 0;
}


Measured memory_bytes: 256
program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n,ans
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
    ans=0
    c=10

    do i=1,5
    read(*,*) a
    ans=ans+(a-1)/10+1
    b=mod(a,10)
    if(b<c .and. b/=0)then
        c=b
    end if
    end do
    
    write(*,*)ans*10-10+c
   
    stop
end program sample
  



Measured memory_bytes: 2796
import glob
import math


# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\159\\C'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    def resolve(self):

        q = [int(i) for i in self.input_data().split()]

        a = q[0]
        b = q[1]
        c = q[2]

        if 4 * a * b < (c - a - b)**2 and c-a-b > 0:
            print("Yes")
        else:
            print("No")

solver = Solver(REL_PATH)
solver.exec_resolve()


Measured memory_bytes: 3956
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int N;
    int lis[100];
    long long int ans=1;
    cin>>N;
    long long int karians=1;
    for(int i=0;i<N;i++){
        cin>>lis[i];
        if(lis[i]%2==0)karians*=2;
    }
    for(int i=0;i<N;i++){
        ans*=3;
    }
    cout<<ans-karians<<endl;
    return 0;
}


Measured memory_bytes: 384
N, M, K = map(int, input().split())
MOD = 998244353
ans = 0
comb = 1
for k in range(K + 1):
    ans += M * comb * pow(M - 1, N - k - 1, MOD)
    ans %= MOD
    comb *= (N - k - 1) * pow(k + 1, MOD - 2, MOD)
    comb %= MOD
print(ans)


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

using namespace std;

int main() {
   double t,x;
   cin >> t >> x;
   cout << t/x << endl; 
}

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

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

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

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

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

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int h,w; cin>>h>>w;
    vector<vector<char>> g(h, vector<char>(w));
    rep(i,h) rep(j,w) {
        cin>>g[i][j];
    }

    deque<P> q;
    P s = P(0,0);
    P t = P(h-1,w-1);
    vector<vector<int>> dp(h, vector<int>(w, INF));
    constexpr int dy[] = {0,1};
    constexpr int dx[] = {1,0};
    q.push_back(s);
    dp[s.first][s.second] = 0;

    while (!q.empty()) {
        P v = q.front(); q.pop_front();
        int cy = v.first; int cx = v.second;
        rep(i,2) {
            int ny = cy+dy[i]; int nx = cx+dx[i];
            int cost = 0;
            if (ny < 0 || ny>=h || nx<0 || nx>=w) continue;
            if (g[cy][cx] == '.' && g[ny][nx]=='#') cost = 1;
            if (dp[ny][nx] > dp[cy][cx]+cost) {
                dp[ny][nx] = dp[cy][cx]+cost;
                if (cost) q.emplace_back(ny,nx);
                else q.emplace_front(ny,nx);
            }
        }
    }

    int hoge = 0;
    if (g[0][0]=='#') hoge++;
    cout << dp[t.first][t.second]+hoge << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

typedef pair<double, double> XY;

XY solve(double a, double b, double c, double d, double e, double f) {
    double x, y;
    x = (c*e - b*f)/(a*e - b*d);
    y = (a*f - c*d)/(a*e - b*d);
    return make_pair(x,y);
}

int main() {
    double a,b,c,d,e,f;
    while(cin >> a >> b >> c >> d >> e >> f) {
        double x, y;
        XY xy = solve(a,b,c,d,e,f);
        x = xy.first;
        y = xy.second;
        printf("%.3f %.3f\n", round(1000 * x)/1000. + 0.00001, round(1000 * y)/1000. + 0.00001);
    }
    return 0;
}

Measured memory_bytes: 1252
#include<bits/stdc++.h>
#define MAXN 10005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int N,M,cnt;
vector<int> v,a,b;
int main()
{
    scanf("%d%d",&N,&M);
    for(int i=0;i<M;i++)
    {
        int x;
        scanf("%d",&x);
        if(x&1) cnt++;
        v.push_back(x);
    }
    if(cnt>2) {puts("Impossible"); return 0;}
    int odd1=-1,odd2=-1;
    for(int i=0;i<M;i++)
    {
        if(v[i]&1) {if(odd1==-1) odd1=v[i]; else odd2=v[i];}
        else a.push_back(v[i]);
    }
    if(odd1!=-1) a.push_back(odd1);
    if(odd2!=-1) {reverse(a.begin(),a.end()); a.push_back(odd2); reverse(a.begin(),a.end());}
    int sum=0;
    for(int i=0;i<(int)a.size();i++)
    {
        int x=a[i];
        if(i==0) x--; else if(i==(int)a.size()-1) x++;
        sum+=x;
        if(x) b.push_back(x);
    }
    if(sum<N) b.push_back(1);
    for(auto x:a) printf("%d ",x);
    puts("");
    printf("%d\n",(int)b.size());
    for(auto x:b) printf("%d ",x);
    puts("");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long ; 
int main(){
  ll a , b ; 
  cin >> a >> b ; 
  ll ans = a + b ; 
  if ( ans & 1 ) puts("IMPOSSIBLE"); 
  else cout << ans / 2LL << endl;
  return 0 ; 
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main(void){
    int n;
    long box = 0;
    cin >> n;
    vector<int> a(n);
    vector<int> mo(n);
    vector<int> al(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
        al[i] = a[i];
    }
    while(al.size() != 1){
        box = al[0] + al[2] - al[1];
        al.erase(al.begin());
        al.erase(al.begin());
        al[0] = box;
    }
    mo[0] = al[0];
    cout << mo[0] << " ";
    for(int i=0;i<n-1;i++){
        mo[i+1] = 2*(a[i] - mo[i]/2);
        cout << mo[i+1] <<" ";
    }
    cout << "" << endl;
}

Measured memory_bytes: 2432
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

ll K;

signed main(){
    cin >> K;
    ll tmp = 0;
    rep(i, K+5){
        tmp = (tmp*10+7)%K;
        if(tmp == 0){
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 3564
package main

import(
	"fmt"
)

const MAXN = 100000

func main(){
	var(
		n int
		a [MAXN]int
	)

	alt_sum:=0

	fmt.Scanln(&n)
	for i:=0; i<n; i++{
		fmt.Scan(&a[i])
		if i%2==0{
			alt_sum+=a[i]
		} else {
			alt_sum-=a[i]
		}
	}
	m:=alt_sum/2
	fmt.Print(m*2," ")
	for i:=0;i<n-1;i++{
		m=a[i]-m
		fmt.Print(m*2)
		if i<n-2{
			fmt.Print(" ")
		} else {
			fmt.Println()
		}
	}
}

Measured memory_bytes: 6528
from sys import stdin

n = int(input())
a = [ int(x) for x in stdin.readline().rstrip().split()]
b = [ int(x) for x in stdin.readline().rstrip().split()]
c = [ int(x) for x in stdin.readline().rstrip().split()]
cnt = 0

for i in range(n):
    j = a[i]-1
    cnt += b[j]
    if i>0:
        if a[i]-1 == a[i-1]:
            if  j> a[i-1]-1:
                cnt+=c[a[i-1]-1]

print(cnt)

Measured memory_bytes: 3064