akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vishal Burman
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BCraneAndTurtle solver = new BCraneAndTurtle();
        solver.solve(1, in, out);
        out.close();
    }

    static class BCraneAndTurtle {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int y = in.nextInt();
            String ans = "No";
            for (int i = 0; i <= x; i++) {
                int j = x - i;
                if ((i * 2) + (j * 4) == y)
                    ans = "Yes";
            }
            out.println(ans);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 32584
#include <bits/stdc++.h>
       
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
  double L;
  cin >> L;

  printf("%.10lf\n", (L * L * L / 27.0));
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
#define ALL(s) (s).begin(), (s).end()
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;

const string D_blue    = "\x1b[36m";
const string D_green   = "\x1b[32m";
const string D_red     = "\x1b[31m";
const string D_yellow  = "\x1b[33m";
const string Db_red    = "\x1b[41m";
const string Db_yellow = "\x1b[43m";
const string D_end     = "\x1b[39m";
const string Db_end    = "\x1b[49m";

int main (){
  int N;
  while (cin >> N){
    
    cout << N/3 << endl;
  }
  return 0;
}


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

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll, ll> pii;

#define REP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define PER(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)

int main(){
    ll N, M;
    cin >> N >> M;
    if(N>M){
        REP(i,0,N){
            cout << M;
        }
    }else{
        REP(i,0,M){
            cout << N;
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 10;
const ll MOD = 1000000007;

int main() {
	int N;
	cin >> N;
	vector<ll> a(3*N);
	REP(i, 3*N) {
		cin >> a[i];
	}
	sort(ALL(a));
	ll ans = 0;
	FOR(i, N, 2 * N - 1) {
		ans += a[i];
	}
	ll ans2 = 0;
	for (int j = N; j < 3 * N; j += 2) {
		ans2 += a[j];
	}

	cout << max(ans, ans2) << endl;
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include<tr1/unordered_map>
using namespace std;
typedef long long ll;
#define pb push_back
const ll INF=1e18;
const int inf=0x3f3f3f3f;
const int M=2e6+6;
void py(){
    cout<<"Yes"<<'\n';
}
void pn(){
    cout<<"No"<<'\n';
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    ll ans=0;
    for(ll i=1;i<=n;i++)
        if(i%5!=0&&i%3!=0)
            ans+=i;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <set>

using namespace std;

double calc(double w, double h) {
    return w / (h * h);
}

int main() {
    double weight, height; // 体重、身長
    int num; //学籍番号
    char d; //dummy

    set<int> fats; // 肥満児の学籍番号

    while (cin >> num >> d >> weight >> d >> height) {
        if (calc(weight, height) >= 25.0) {
            fats.insert(num);
        }
    }

    for (set<int>::iterator i = fats.begin(); i != fats.end(); i++) {
        cout << *i << endl;
    }
    
    return 0;
}

Measured memory_bytes: 0
// #include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define trace(x) cerr << #x << ": " << x << " " << endl;
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
 
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
}
     
 //using namespace __gnu_pbds;
 //#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set
// mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count()); for randomized solution

int32_t main()
{
    IOS
    
    int n,k;
    cin>>k>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
    	cin>>a[i];
    }
    int ans=a[n-1]-a[0];
    for(int i=1;i<n;i++)
    {
    	int te=a[i-1];
    	ans=min(ans,k-a[i]+te);
    }
    cout<<ans<<endl;
}       


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
int n;
ll a[100005];
ll s[100005];
const ll inf=1e18;
int main()
{

    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%lld",&a[i]);
            s[0]=0;

    ll minn1=0,minn2=0;
    for(int i=1;i<=n;i++)
{
    s[i]=s[i-1]+a[i];

if(i%2==0)
    {
        if(s[i]>=0)
            {minn1+=s[i]+1;
            s[i]=-1;
    }
    }

    else
    {
        if(s[i]<=0)
            {minn1+=1-s[i];
            s[i]=1;
    }
      }
}
         s[0]=0;


     for(int i=1;i<=n;i++)
{
        s[i]=s[i-1]+a[i];


        if(i%2==1)
    {
        if(s[i]>=0)
            {minn2+=s[i]+1;
            s[i]=-1;
    }
    }
    else
    {
        if(s[i]<=0)
            {minn2+=1-s[i];
            s[i]=1;
    }
       }
}
    printf("%lld\n",min(minn1,minn2));
    return 0;
}


Measured memory_bytes: 1792
w,h,x,y,r = gets.split.map(&:to_i)

if x - r < 0 || x + r > w || y - r < 0 || y + r > h
  puts "No"
elsif x - r >= 0 && x + r <= w || y - r >= 0 && y + r <= h
  puts "Yes"
end

Measured memory_bytes: 8692
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    if(n == 0) {
        cout << 1 << endl;
        return 0;
    }

    vector<int> dp(n+1);

    dp[0] = dp[1] = 1;
    rep(i, n-1) {
        dp[i+2] = dp[i+1] + dp[i];
    }

    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 3084
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <bitset> 
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
 
#define int long long
#define ll long long 
#define F first
#define sqr(x) ((x) * (x))
#define S second
#define make make_pair
#define pb push_back
#define sz(x) (ll)(x.size()) 
#define all(x) x.begin (), x.end ()

using namespace std;
                        
typedef unsigned long long ull;
typedef long double ld;

const int MOD = (int)1e9 + 7;
const int N = (int)2e6+ 222;
const ll INF = (ll)1e18;
const double eps = (double)1e-6;

int h, w, ans[311][311], x;
char a[311][311];

void solve () {

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

	int timer = 0;
	for (int i = 1; i <= h; ++i) {
		int l = 1;
		bool ok = 0;
		for (int j = 1; j <= w; ++j) {
			if (a[i][j] == '#') {
				++timer;
				for (int k = l; k <= j; ++k) {
					ans[i][k] = timer; 
				} 
				l = j + 1;
				ok = 1;
			}	
		}
		if (!ok) continue;
		for (int j = l - 1; j <= w; ++j) ans[i][j] = timer;
	}	
	for (int pos = 1; pos <= h; ++pos) {
		if (ans[pos][1]) {
			for (int i = pos + 1; i <= h; ++i) {
				for (int j = 1; j <= w; ++j) {
					if (ans[i][j]) break;
					ans[i][j] = ans[i - 1][j];
				}
			}
			for (int i = pos - 1; i >= 1; --i) {
				for (int j = 1; j <= w; ++j) {
					if (ans[i][j]) break;
					ans[i][j] = ans[i + 1][j];
				}
		   	}
		   	break;
		}
	}
	for (int i = 1; i <= h; ++i) {
		for (int j = 1; j <= w; ++j) {
			cout << ans[i][j] << " ";
		}
		cout << endl;
	}
		
}

signed main () {
    #ifdef Maga
        freopen("input", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);                                              
    int t = 1;
    while (t --) {
    	solve ();
    }
    return 0;
}





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


int main(){
	int n,data;
	long long sum;
	scanf("%d %d", &n, &data);
	int min, max;
	min = max = sum = data;
	
	while( --n > 0){
		scanf("%d", &data);
		sum += data;
		if(data<min){
			min = data;
		}
		if(data>max){
			max = data;
		}
	}
	printf("%d %d %lld\n", min, max, sum);
	return 0 ;
}


Measured memory_bytes: 2108
use std::io;
use std::cmp;


fn main() {
    let (a, b) = {
        let i = read::<isize>();
        (i[0], i[1])
    };
    println!("{}", cmp::max(0, a - b * 2));
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        String S = sc.nextLine();
        boolean n = false;
        boolean s = false;
        boolean w = false;
        boolean e = false;
        for (int i = 0; i < S.length(); ++i) {
            char ch = S.charAt(i);
            switch (ch) {
                case 'N':
                    n = true;
                    break;
                case 'S':
                    s = true;
                    break;
                case 'W':
                    w = true;
                    break;
                case 'E':
                    e = true;
                    break;
            }
        }
        if (s && n && w && e || s && n && !w && !e || !s && !n && w && e) {
            _out.println("Yes");
        } else {
            _out.println("No");
        }
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ldouble = long double;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s) cout << fixed << setprecision(10) << s << endl;


int main()
{
	ll x, a, b;
	cin >> x >> a >> b;
	x -= a;

	for (; ;)
	{
		if (x - b < 0)
		{
			println(x);
			break;
		}

		x -= b;
	}
}

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

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

int main() {
    int n,l;
    cin >> n >> l;
    vector<string> s(n);
    rep(i,n) cin >> s.at(i);

    sort(all(s));
    rep(i,n) cout << s.at(i);
}

Measured memory_bytes: 3636
// JavaProgram.cpp
// Author : Priydarshi Singh (@dryairship)
// One cat just leads to another. One bug leads to two others.

#include <bits/stdc++.h>
using namespace std;

// I like my types defined.
typedef long long           ll;
typedef pair<int, int>      pii;
typedef vector<int>         vi;
typedef vector<pii>         vii;
typedef set<int>            si;
typedef map<string, int>    msi;
typedef map<int, int>       mii;

// Traditional science is all about finding "hashtag define"s.
#define fr(i, n)            for(int i=0; i<(n); ++i)
#define frC(i, n, c)        for(int i=0; (i<(n)) && (c); ++i)
#define frA(i, a, n)        for(int i=a; i<=(n); ++i)
#define frD(i, a, n)        for(int i=a; i>=(n); --i)
#define fill(a)             memset(a, 0, sizeof(a))
#define fill1(a)            memset(a, -1, sizeof(a))
#define revsort(a, b)       sort(a, b, greater<int>())
#define ff                  first
#define ss                  second
#define pb                  push_back 
#define dout                if(DEBUGGING) cout
#define dbg                 if(DEBUGGING) 
#define endl                "\n"

// When you realize MOD > INF...
int DEBUGGING    =          0;
const int INF    =          1000000000;
const int MOD    =          1000000007;
const ll LINF    =          1e18;
const double PI  =          3.1415926535897932;
const double EPS =          1e-7;

// I'D SPAM. Hehe.
ll gcdEx                    (ll a, ll b, ll *x, ll *y){if(!a){*x=0;*y=1;return b;} 
ll x1,y1,gcd=gcdEx          (b%a,a,&x1,&y1); *x=y1-(b/a)*x1;*y=x1; return gcd;}
ll modI(ll b, ll m)         {ll x,y;gcdEx(b,m,&x,&y);return (x%m+m)%m;}
ll modD(ll a, ll b)         {return (modI(b,MOD)*(a%MOD))%MOD;}
ll modS(ll a, ll b)         {return ((a%MOD)-(b%MOD)+MOD)%MOD;}
ll modP(ll x, ll y)         {ll r=1; x%=MOD; while(y>0){if(y&1){r=(r*x)%MOD;} y=y>>1; x=(x*x)%MOD;} return r;}
ll modA(ll a, ll b)         {return ((a%MOD)+(b%MOD))%MOD;}
ll modM(ll a, ll b)         {return ((a%MOD)*(b%MOD))%MOD;}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve(int TEST_CASE){
    int f, bk,n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    if(n==1){
        cout << 1;
        return;
    }
    f=0;
    bk=0;
    int ck=0, mxn=0, cn=0;
    char lc='2';
    fr(i,n){
        if(s[i]=='0' && lc!='0'){
            if(ck<k){
                ck++;
            }else{
                dout << "Recalling" << endl;
                while(s[bk]=='1') bk++, cn--;
                while(s[bk]=='0') bk++, cn--;
            }
        }
            cn++;
            mxn=max(mxn,cn);
        dout <<lc <<" - "<< s[i] << ", "<< mxn << endl;
        lc=s[i];
    }
    cout << mxn;
}

int main(int argc, char* argv[]){
    if(argc==2 && argv[1][1]=='v') DEBUGGING = 1;
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin.exceptions(cin.failbit);
    int nTestCases=1;
    //cin >> nTestCases;
    frA(i,1,nTestCases) solve(i);
    return 0;
}

Measured memory_bytes: 512
import collections

N = int(input())
A = list(map(int,input().split(' ')))
C = collections.Counter(A)
L = C.most_common()

if N % 2 == 0:
  for i, j in L:
    if j == 2:
      pass
    else:
      print(0)
      exit()
else:
   for i, j in L:
    if j == 2:
      pass
    else:
      if i == 0:
        pass
      else:
        print(0)
        exit()
print(int((2**(N//2) % (10**9+7))))

Measured memory_bytes: 16096
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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 INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n;
    cin>>n;
    vl as(3 * n);
    cin>>as;
    sort(rng(as));

    ll ans = 0;
    rep(i, n) {
        ans += as[n + i * 2];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
class TEST
{
    static List<int[]> testlist;
    public static void Main()
    {
        (int x, int y) nowPosition = (0, 0);

        int N = int.Parse(Console.ReadLine());

        testlist = new List<int[]>();
        for (int i = 0; i < N; i++)
        {
            string[] values = Console.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            testlist.Add(GetStringtoInt(values));

        }

        for (int i = 0; i < testlist.Count; i++)
        {
            int needTimeToMove = 0;
            while (true)
            {
                if (nowPosition.x == testlist[i][1] && nowPosition.y == testlist[i][2])
                {
                    int value = GetNum(i);


                    if (value >= needTimeToMove && value % 2 == 0 && needTimeToMove % 2 == 0)
                        break;
                    else if (value >= needTimeToMove && value % 2 == 1 && needTimeToMove % 2 == 1)
                        break;
                    else
                    {
                        Console.WriteLine("No");
                        return;
                    }
                }
                else
                {
                    int sa = testlist[i][1] - nowPosition.x;
                    nowPosition.x += sa;
                    needTimeToMove += Math.Abs(sa);

                    sa = testlist[i][2] - nowPosition.y;
                    nowPosition.y += sa;
                    needTimeToMove += Math.Abs(sa);
                }
            }
        }
        Console.WriteLine("Yes");
    }

    static private int[] GetStringtoInt(string[] values)
    {
        int[] values_i = new int[values.Length];

        for (int i = 0; i < values.Length; i++)
        {
            values_i[i] = int.Parse(values[i]);
        }

        return values_i;
    }
    static private int GetNum(int index)
    {
        if (index == 0)
            return testlist[index][0];
        return testlist[index][0] - testlist[index - 1][0];
    }

}

Measured memory_bytes: 48660
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
#define INF 1000000000
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t)
{
    std::ostringstream os;
    os << t;
    return os.str();
}
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main()
{
    int h, w;
    cin >> h >> w;
    vector<vector<int>> v(h + 1, vector<int>(w + 1, 0));
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            cin >> v[i][j];
        }
    }
    vector<P> be, af;
    int ans = 0;
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            if (i != h)
            {
                if (v[i][j] % 2 == 0)
                {
                    continue;
                }
                else
                {
                    v[i + 1][j]++;
                    be.push_back({i, j});
                    af.push_back({i + 1, j});
                    ans++;
                }
            }
            else
            {
                if (v[i][j] % 2 == 0)
                {
                    continue;
                }
                else
                {
                    if (j < w)
                    {
                        v[i][j + 1]++;
                        be.push_back({i, j});
                        af.push_back({i, j + 1});
                        ans++;
                    }
                }
            }
        }
    }
    cout << ans << endl;
    for (int i = 0; i < ans; i++)
    {
        cout << be[i].first << " " << be[i].second << " " << af[i].first << " " << af[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 7312
var t = "6 5\n" +
        "8 6 9 1 2 1\n" +
        "1 3\n" +
        "4 2\n" +
        "4 3\n" +
        "4 6\n" +
        "4 6"

fun main(args: Array<String>) {

    read = stdin

    val (N, M) = readInts()
    val H = readInts()
    val (A, B) = readInts2(M)

    val flags = Array(N){true}

    for(i in 0 until M){
        A[i]--
        B[i]--
        if(H[A[i]] > H[B[i]]){
            flags[B[i]] = false
        }else if(H[A[i]] == H[B[i]]){
            flags[A[i]] = false
            flags[B[i]] = false
        }else{
            flags[A[i]] = false
        }
    }

    var cnt = 0
    for(flag in flags) {
        if(flag) cnt++
    }
    println(cnt)
}


fun answer(args: Array<String>){
    println("ほげ")
}



// #######################################################
//  入力用
// #######################################################

var ts = t.split("\n")
var c = 0
var debug = {ts[c++]}
var stdin = {readLine()!!}
var read = stdin

fun readInt(): Int{
    return read().toInt()
}

fun readInts(): Array<Int>{
    return read().split(" ").map(String::toInt).toTypedArray()
}

fun readInts2(n: Int) : Pair<Array<Int>, Array<Int>>{
    val a = Array(n){0}
    val b = Array(n){0}
    for(i in 0 until n){
        val r = readInts()
        a[i] = r[0]
        b[i] = r[1]
    }
    return Pair(a, b)
}



Measured memory_bytes: 70244
n = int(input())
ac, wa, tle, re = 0, 0, 0, 0

for i in range(n):
  s = input()
  
  if s == 'AC':
    ac += 1
  elif s == 'WA':
    wa += 1
  elif s == 'TLE':
    tle += 1
  elif s == 'RE':
    re += 1
    
print("AC x {0}\nWA x {1}\nTLE x {2}\nRE x {3}".format(ac, wa, tle, re))
  

Measured memory_bytes: 9164
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    //方針
    //毎日満足度は低下し続ける
    //満足度上昇の方法はコンテスト開催のみ
    //開催されてないコンテストを放置すると低下が著しくなる
    //実際にコンテストを開いた時の満足度上昇が最大のものを採用してみる
    //低下をなくせる分を上昇と捉えると、c_i(d-last(d,i)) + s_{d,i} だけペイすると考えられる？→あんまり適当じゃない
    //r日ずつ全探索を[D/r+1]回繰り返す
    //探索パターン数は26^rで、シミュレーションには26r回かかる、これを[D/r+1]回繰り返すので
    //計算量はO(D26^{r+1})
    //r = 3が限界
    int D;cin>>D;
    int c[26],last[26]={},s[365][26],lastcpy[26];
    REP(i,26) cin>>c[i];
    REP(i,D) REP(j,26) cin>>s[i][j];
    constexpr int r = 3;
    int all = 1;
    REP(i,r) all *= 26;
    int up,ptncpy;
    int res[r],calcres[r],reslast[26];
    for(int i=0;i<D;i+=r){
        int tmp = -1e9;
        for(int pattern = 0; pattern < all; pattern++){    //r日でそれぞれ何処を選ぶか全探索
            up = 0; ptncpy = pattern;
            memcpy(lastcpy,last,sizeof(int)*26);                //lastを更新しなければならないのでコピーを取る
            REP(j,r){                                           //r日探索
                if(i+j>=D) break;
                calcres[j] = ptncpy%26;
                REP(k,26){                                      //スコアに影響のある26パターンについて処理しなければならない
                    if(calcres[j] == k){                        //選ぶパターンのときはlastを更新してスコアを加算
                        last[k] = i+j;
                        up += s[i+j][k];
                    }
                    else up -= c[k]*(i+j - last[k]);            //そうでないときはlastを参照して減算
                }
                ptncpy /= 26;                                   //これをi+r-1日目まで繰り返して終了
            }
            
            if(tmp<up){                                         //もしスコアが高くなるならば結果を更新する
                tmp = up;
                memcpy(res, calcres, sizeof(int)*r);
                memcpy(reslast, last, sizeof(int)*26);
            }
            memcpy(last, lastcpy, sizeof(int)*26);
        }
        memcpy(last, reslast, sizeof(int)*26);
        REP(j,r) if(i+j<D){
            cout<<res[j]+1<<endl;
        }
    }
}


Measured memory_bytes: 3672
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sstream> //C++
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)

//scanf("%d",&x);
//printf("%d",x);
//for(i=0;i<N;i++){  }
//if( == ){  }else{  }
//while( ){  }

/*
int N, i;
int H[100];
scanf("%d", &N);
for (i = 0; i < N; i++) scanf("%s", &H[i]);
*/




int main()
{
	long long int n, k;
	long long int i=0;
	cin >> n >> k;
	long long int tmp2;

	if (k == 1) {
		cout << "0";
		return 0;
	}

	long long int tmp0 = n % k;

	

	tmp2 = abs(tmp0 - k);

	if (tmp0 >= tmp2) cout << tmp2;
	else cout << tmp0;

}




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

int main() {
  int64_t N, sum = 0;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  for (int i = 1; i < N; i++) {
    int64_t d = vec.at(i - 1) - vec.at(i);
    if (d > 0) {
      sum += d;
      vec.at(i) += d;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
#define REP(asd, fgh) for(int asd = 0; asd < fgh; asd++)
int n, q, m;
int A[20];

bool func(int i, int sum){
  if(sum > m) return false;
  if(sum == m) return true;
  if(i >= n) return false;
  return func(i+1,sum+A[i]) || func(i+1, sum);
}

int main(void){
  cin >> n;
  REP(i, n) cin >> A[i];
  cin >> q;
  REP(i, q){
    cin >> m;
    if(func(0, 0)){
      cout << "yes" << endl;
    }else{
      cout << "no" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
ll A[MAX_N];

void solve() {
	cin >> N;
	rep(i, 0, N) {
		cin >> A[i];
		A[i] -= i;
	}
	sort(A, A + N);
	ll v = A[N / 2];
	ll res = 0;
	rep(i, 0, N) {
		res += abs(A[i] - v);
	}
	cout << res << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



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

int main()
{
	vector<int> a;
	for (int i = 0; i < 3; i++)
	{
		int t;
		cin >> t;
		a.push_back(t);
	}
	sort(a.begin(), a.end());

	int ans = a[0] + a[1] + a[2] * 10;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		int ans = 0;

		ans = A * B;
		if(A > 9){
			ans = -1;
		}
		else if(B > 9){
			ans = -1;
		}

		System.out.println(ans);

		stdIn.close();
	}
}

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

int cmp1(const void *p,const void *q)
{
    return *(int *)p - *(int *)q;
}

int main()
{
    int n,m,ans=0;
    int piv=0,pick=0;
    int i,j,k;
    int a[1000010]={0};
    scanf("%d",&n);

    for(i=0;i<n;i++)
    {
        scanf("%d",&m);
        a[m]++;
    }

    //furui
    for(j=1;j<=1000000;j++)
    {
        if(a[j]==0)continue;
        else
        {
            if(a[j]==1)ans++;
            else a[j]=0;

            for(k=j*2;k<=1000000;k+=j)a[k]=0;
        }
    }
    //ans=0;
    //for(i=0;i<n;i++)if(b[i]==0)ans++;
    printf("%d",ans);
}


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

int main(){
	string S;
	cin >> S;
	int c[26],l;
	for(int i=0;i<26;i++)c[i]=0;
	l=S.length();
	for(int i=0;i<l;i++){
		c[(int)S[i]-97]++;
		if(c[(int)S[i]-97]==2){
			cout << "no" << endl;
			return 0;
		}
	}

	cout << "yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i, l, r) for(register int i = l;i <= r; ++ i)
int MAXN = 100010;
inline int read()
{
	register char cc = getchar(); register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - 48; cc = getchar();}
	return cn * flus;
}
signed main()
{
	int x = read();
	for(register int i = -1000; ; ++ i)
	{
		for(register int j = -1000; j <= 1000; ++ j)
		{
			//printf("i = %d j = %d \n",i,j);
			if(i * i * i * i * i - j * j * j * j * j == x)
			{
				printf("%lld %lld \n",i,j);
				return 0;
			}
		}
	}
	return 0;
}


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

int main() {
  int n, m; cin >> n >> m;
  if (n == m) cout << "Yes";
  else cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  vector<int>list(1000000);
  list.at(0)=s;
  bool frag=true;
  int i=1;
  while(frag==true){
    if(list.at(i-1)%2==0){
      list.at(i)=list.at(i-1)/2;
    }
    else{
      list.at(i)=3*list.at(i-1)+1;
    }
    for(int j=0;j<i;j++){
      if(list.at(i)==list.at(j)){
        cout<<i+1<<endl;
        frag=false;
        break;
      }
      else{
      }
    }
    i=i+1;
  }
}
    
  

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

int main(){
    
    int N,M,S,C; cin >> N >> M;
    map<int,int>mp{};
    
    if(N == 1 && M == 0){ cout << 0 << endl; return 0; }
    for(int i=0;i<M;i++){
        cin >> S >> C;
        if(mp.count(S) == 0 || mp[S] == C){ mp[S] = C; }
        else{ cout << -1 << endl; return 0; }
    }
    
    for(int i=1;i<=N;i++){
        if(mp.count(i) == 0){
            if(i == 1) mp[i] = 1;
            else mp[i] = 0;
        }
    }
    
    if(mp[1] == 0 && N !=1) cout << -1 << endl;
    else { for(int i=1;i<=N;i++){cout << mp[i]; } cout <<endl;}

} 

Measured memory_bytes: 3612
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
    int a,p,sum;
    scanf("%d%d",&a,&p);
    sum=(a*3+p)/2;
    printf("%d",sum);
    return 0;
}


Measured memory_bytes: 256
class UnionFindNode(object):
    """
    Union-Find構造
    ノードのグループ併合や、所属グループ判定を高速に処理する
    """

    def __init__(self, group_id, parent=None, value=None):
        self.group_id_ = group_id
        self.parent_ = parent
        self.value = value
        self.size_ = 1

    def __str__(self):
        template = "UnionFindNode(group_id: {}, \n\tparent: {}, value: {}, size: {})"
        return template.format(self.group_id_, self.parent_, self.value, self.size_)

    def is_root(self):
        return not self.parent_

    def root(self):
        parent = self
        while not parent.is_root():
            parent = parent.parent_
            self.parent_ = parent
        return parent

    def find(self):
        parent = self.root()
        return parent.group_id_

    def size(self):
        parent = self.root()
        return parent.size_

    def unite(self, unite_node):
        parent = self.root()
        unite_parent = unite_node.root()

        if parent.group_id_ != unite_parent.group_id_:
            if parent.size() > unite_parent.size():
                unite_parent.parent_ = parent
                parent.size_ = parent.size_ + unite_parent.size_
            else:
                parent.parent_ = unite_parent
                unite_parent.size_ = parent.size_ + unite_parent.size_

    def same(self, node):
        return self.root() == node.root()


N, M = map(int, input().split())
uf = [UnionFindNode(i) for i in range(M)]
l = []
for i in range(N):
    k, *lang = list(map(int, input().split()))
    for j in range(k - 1):
        uf[lang[j] - 1].unite(uf[lang[j + 1] - 1])
    l.append(lang)
r = uf[lang[0] - 1].root()
for i in range(N):
    if uf[l[i][0] - 1].root() != r:
        print('NO')
        exit(0)
print('YES')


Measured memory_bytes: 77984
#include <iostream>
#include <stdlib.h>
#include <vector> //vector
#include <cmath>

#define rep(i, n) for(int i=0; i<(int)(n);i++)
#define all(x) (x).begin(), (x).end()
#define debug(a) if(flagdebug){cout << "debug (" #a "):" << endl << (a) << endl;}

typedef uint64_t ulint;
typedef int64_t lint;

using namespace std;



lint a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;

bool flagdebug = false;

int main(){
//////////////////////////////////////////////////////
    // flagdebug = true;
    string s;
    cin >> a;
    cin >> s;

    if(a >= 3200)cout << s << endl;
    else cout << "red" << endl;


    //cout <<  0    << endl;


//////////////////////////////////////////////////////
// Ctrl + Opt + N to make
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;

int main()
{
	int n, a, b;
	scanf("%d %d %d", &n, &a, &b);
	if(a+b>n+1 || (long long int)a*(long long int)b<(long long int)n){
		printf("%d\n", -1);
	}else if(b==1){
		for(int i=1; i<=n; i++){
			printf("%d ", i);
		}
		printf("\n");
	}else{
		int q=(n-a)/(b-1), r=(n-a)%(b-1);
		for(int i=1; i<=q; i++){
			for(int j=0; j<b; j++){
				printf("%d ", i*b-j);
			}
		}
		if(r!=0){
			for(int j=0; j<r+1; j++){
				printf("%d ", q*b+r+1-j);
			}
			for(int i=q*b+r+2; i<=n; i++){
				printf("%d ", i);
			}
		}else{
			for(int i=q*b+1; i<=n; i++){
				printf("%d ", i);
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 2048
#include <stdio.h>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <string>
using namespace std;
int gcd(int a,int b){
    return b==0?a:gcd(b,a%b);
}
int main(){
    int k;
    cin>>k;
    int sum = 0;
    for(int a=1; a<=k; a++){
        for(int b=1; b<=k; b++){
            for(int c=1; c<=k; c++){
                sum += gcd(a, gcd(b, c));
            }
        }
    }
    cout<<sum;
    return 0;
}




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

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define whole(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

const int N = int(1e5) + 2;
const int LG = 20;
const ll mod = 998244353;
const int INF = 2147483647;
const ll linf = 1e18;
const ld pi = acos(-1);
const ld EPS = 1e-10;

int n, ans[N];

struct bus {
    string s;
    int p, pos;
}a[N];

bool cmp (bus a, bus b){
    if (a.s == b.s){
        return a.p > b.p;
    }
    return a.s < b.s;
}

int main (){
    cin >> n;
    for (int i = 1; i <= n; ++i){
        cin >> a[i].s >> a[i].p;
        a[i].pos = i;
    }
    sort (a + 1, a + n + 1, &cmp);
    for (int i = 1; i <= n; ++i){
        ans[i] = a[i].pos;
    }
    for (int i = 1; i <= n; ++i) cout << ans[i] << "\n";
}


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

int main(){

    string S;
    cin >> S;
    string s;

    int a = 0,b = 0,c = 0;
    for(int i=0;i<3;i++){
        s = S[i];
        if(s == "a") a = 1;
        else if (s == "b") b = 1;
        else if (s == "c") c = 1;
    }

    if(a+b+c == 3) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
H = list(map(int, input().split()))
OK = [True] * N
for _ in range(M):
    A, B = map(lambda x: int(x)-1, input().split())
    if H[A] < H[B]:
        OK[A] = False
    elif H[A] > H[B]:
        OK[B] = False
    else:
        OK[A] = False
        OK[B] = False

ans = sum(OK)
print(ans)

Measured memory_bytes: 20100
#include <bits/stdc++.h>
using namespace std;
int main(){
    int ans = 0,n,i,j,p;
    cin >> n;
    for(i = 1;i < n;i++){
        if(n % i == 0){
            p = (n / i) - 1;
        }
        else{
            p = n / i;
        }
        ans += p;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int ans = 0;
	int cnt = 0;
	int cnt1 = 0;
	for (int i = 0; i < N; i++) {
		int P;
		cin >> P;
		if (P <= A) {
			ans++;
		}
		else if (P > A && P <= B) {
			cnt++;
		}
		else if (P > B) {
			cnt1++;
		}
	}
	cout << min(ans, min(cnt, cnt1)) << endl;
}

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

int main()
{
    double x1 , y1 , x2 , y2;
    cin >> x1 >> y1 >> x2 >> y2;

    printf("%f" , sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)));
    return 0;
}



Measured memory_bytes: 3292
def gcd(a, b):
    if a < b:
        tmp = a
        a = b
        b = tmp
    if a % b != 0:
        a = a % b
        return gcd(b, a)
    else:
        return b


A, B = map(int, input().split())

print(int(A * B // float(gcd(A, B))))


Measured memory_bytes: 2940
N,K = (int(T) for T in input().split())
Per = [int(T) for T in input().split()]
Wat = 0
for X in range(0,N-1):
    if Per[X]+K<=Per[X+1]:
        Wat += K
    else:
        Wat += Per[X+1]-Per[X]
print(Wat+K)

Measured memory_bytes: 30776
let () =
  let s = Scanf.scanf "%c%c%c%c\n" (fun a b c d -> [a;b;c;d]) in
  List.fold_left (fun sum x ->
      match x with
      | '+' -> sum + 1
      | '-' -> sum -1
    ) 0 s
|> Printf.printf "%d\n" 


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define FORalld(it, a) for (__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
template<class T> inline T isqrt(T k) {T r = sqrt(k) + 1; while (r * r > k) r--; return r;}
template<class T> inline T icbrt(T k) {T r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}

const int maxn = 1e5 + 5;
int n, c, k;
int t[maxn];

void solve() {
    cin >> n >> c >> k;
    FOR(i, 0, n) cin >> t[i];
    sort(t, t + n);
    int ans = 0, tms = 0, tot = c;
    FOR(i, 0, n) {
        if (tot == c || tms < t[i]) {
            ans++;
            tms = t[i] + k;
            tot = 1;
        }
        else {
            tot++;
        }
    }
    cout << ans << "\n";
}

int main() {
#ifdef _LOCAL_
    freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0); cin.tie(0);
#endif
    solve();
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
    return 0;
}


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

int main() {
  int n, a, b;
  cin >> n >> a >> b;

  if ((b - a) % 2 == 0)
    puts("Alice");
  else
    puts("Borys");
}

Measured memory_bytes: 256
using System;

namespace ConsoleApplication1{
    class Program{
        static void Main(string[] args){
            int n = int.Parse(Console.ReadLine());
            for (int i = 0; i < n; i++) {
                String[] str = Console.ReadLine().Split();
                int[] a = new int[3];
                for (int j = 0; j < 3; j++) {
                    a[j] = int.Parse(str[j]) * int.Parse(str[j]);
                }
                Array.Sort(a);
                if (a[0] + a[1] == a[2]) {
                    Console.WriteLine("YES");
                }
                else {
                    Console.WriteLine("NO");
                }
            }
        }
    }
}

Measured memory_bytes: 5604
import re

def main():
    s = input()
    if check(s):
        print('AC')
    else:
        print('WA')

def check(s):
    pat = re.compile(r'A[a-z][a-z]*C[a-z]*[a-z]')
    m = pat.fullmatch(s)
    return bool(m)

main()


Measured memory_bytes: 3188
import itertools


def actual(n, D):
    comb = itertools.combinations(D, 2)

    # return sum([x * y for x, y in comb])

    """
    「順番を考慮しない2要素の選び方」を全探索する際のポイント
        内側のループ変数の始点を外側のループ変数 +1 から始めるとよい。
        これにより、内側のループで選ぶインデックスが必ず外側のループで選ぶインデックスより大きくなり、
        同じ選び方を 2 回見てしまうことを回避できます。"""
    s = 0
    for i in range(len(D)):
        for j in range(i + 1, len(D)):
            s += D[i] * D[j]

    return s

n = int(input())
D = list(map(int, input().split()))

print(actual(n, D))

Measured memory_bytes: 3064