akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)
#define REPIT(i,x) for(auto i{(x).begin()}; i != (x).end(); i++) 

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef double dbl;
typedef vector<bool> Vb;
typedef vector<char> Vc;
typedef vector<double> Vd;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<string> Vs;
typedef vector<vector<int>> VVi;
typedef vector<vector<ll>> VVl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }
inline void YES() { cout << "YES" << endl; } inline void Yes() { cout << "Yes" << endl; }
inline void NO() { cout << "NO" << endl; } inline void No() { cout << "No" << endl; }

const int inf = 1 << 30;
const ll linf = 1LL << 60;
const int MOD = 1000000007;

#include <set>

int n, founder = 0;
Vi slimes;
multiset<int> duty;

void init()
{
	cin >> n;

	REP(_i, (1 << n))
	{
		int s; cin >> s;
		duty.insert(s);
		chmax(founder, s);
	}
}

int main()
{
	init();

	slimes.PB(founder);
	duty.erase(duty.find(founder));

	REP(i, n)
	{
		Vi newgen(slimes);
		for (int par : slimes)
		{
			auto it = duty.lower_bound(par);
			if (it == duty.begin())
			{
				// cout << "trying to produce " << *it << " from parent " << slimes[par] << endl;
				No(); return 0;
			}

			newgen.PB(*(--it));
			duty.erase(it);
		}
		sort(ALL(newgen), greater<>());
		swap(slimes, newgen);
	}

	Yes();

}


Measured memory_bytes: 14200
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=1e9+7;

ll dp[110][4][4][4];

bool ng(int a,int b,int c){
  return a==1&&b==2&&c==3;
}

bool check(int a,int b,int c,int d){
  return ng(a,b,c)||ng(b,a,c)||ng(a,c,d)||ng(a,c,b)||ng(a,b,d);
}

ll f(int idx,int a,int b,int c){
  if(~dp[idx][a][b][c])return dp[idx][a][b][c];
  if(!idx)return 1;
  ll res=0;
  for(int i=0;i<4;i++)if(!check(i,a,b,c))res+=f(idx-1,i,a,b);
  return dp[idx][a][b][c]=res%MOD;
}

int main(){
  memset(dp,-1,sizeof(dp));
  int n;cin>>n;
  cout<<f(n,5,5,5)<<endl;
}


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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();

        string answer = n < 1000 ? "ABC" : "ABD";

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 11092
#include<stdio.h>
double dp[16][3][3];
char s[2];
char t[2];
char b[2];
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<16;i++)
			for(int j=0;j<3;j++)
				for(int k=0;k<3;k++)
					dp[i][j][k]=0;
		scanf("%s%s%s",s,t,b);
		int row=(s[0]-'A')/3;
		int col=(s[0]-'A')%3;
		int NGrow=(b[0]-'A')/3;
		int NGcol=(b[0]-'A')%3;
		dp[0][row][col]=1;
		for(int i=0;i<a;i++){
			for(int j=0;j<3;j++)
				for(int k=0;k<3;k++){
					if(j>0&&(j-1!=NGrow||k!=NGcol))dp[i+1][j-1][k]+=dp[i][j][k]*0.25;
					else dp[i+1][j][k]+=dp[i][j][k]*0.25;
					if(k>0&&(j!=NGrow||k-1!=NGcol))dp[i+1][j][k-1]+=dp[i][j][k]*0.25;
					else dp[i+1][j][k]+=dp[i][j][k]*0.25;
					if(j<2&&(j+1!=NGrow||k!=NGcol))dp[i+1][j+1][k]+=dp[i][j][k]*0.25;
					else dp[i+1][j][k]+=dp[i][j][k]*0.25;
					if(k<2&&(j!=NGrow||k+1!=NGcol))dp[i+1][j][k+1]+=dp[i][j][k]*0.25;
					else dp[i+1][j][k]+=dp[i][j][k]*0.25;
				}
		}
		int Grow=(t[0]-'A')/3;
		int Gcol=(t[0]-'A')%3;
		printf("%.8lf\n",dp[a][Grow][Gcol]);
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

struct UnionFind
{
    vector<int> Parent;
    UnionFind(int n)
    {
        Parent=vector<int>(n,-1);
    }
    
    int root(int a)
    {
        if(Parent[a]<0) return a;
        return root(Parent[a]);
    }
    
    int size(int a)
    {
        return -Parent[root(a)];
    }
    
    bool connect(int a,int b)
    {
        if(root(a)==root(b)) return false;
        if(size(a)<size(b)) swap(a,b);
        Parent[root(a)]-=size(b);
        Parent[root(b)]=root(a);
        return true;
    }
};

int main()
{
  int n,m;
  cin>>n>>m;
  UnionFind friends(n);
  for (int i = 0; i < m; ++i)
  {
    int a,b;
    cin>>a>>b;
    a--;b--;
    friends.connect(a,b);
  }
  int ans=0;
  for (int i = 0; i < n; ++i)
  {
    ans=max(ans,friends.size(i));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4048
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <bitset>
#include <string>
#include <cmath>
#include <set>
#include <map>
#define Rep(i, x, y) for (int i = x; i <= y; i ++)
#define Dwn(i, x, y) for (int i = x; i >= y; i --)
#define RepE(i, x) for (int i = pos[x]; i; i = g[i].nex)
#define ev g[i].y
using namespace std;
typedef long long ll;
typedef double db;
const int N = 200010, mod = 1e9 + 7;
int n, X, Y, b[N], a[N], c[N], w[N], sum, inf, m1, m2;
ll ans, fac[N], inv[N];
ll mypow(ll x, int y) {
	ll z = 1;
	while (y) {
		if (y & 1) (z *= x) %= mod;
		y >>= 1; (x *= x) %= mod;
	}
	return z;
}
int main()
{
	scanf ("%d%d%d", &n, &X, &Y);
	fac[0] = 1;
	Rep(i, 1, n) fac[i] = fac[i - 1] * i % mod;
	inv[n] = mypow(fac[n], mod - 2);
	Dwn(i, n, 1) inv[i - 1] = inv[i] * i % mod;
	inf = max(X, Y) + 1;
	Rep(i, 0, n) b[i] = inf;
	Rep(i, 1, n) {
		scanf ("%d%d", &c[i], &w[i]);
		b[ c[i] ] = min(b[ c[i] ], w[i]);
	}
	Rep(i, 1, n) {
		if (b[i] < b[m1]) m2 = m1, m1 = i;
		else if (b[i] < b[m2]) m2 = i;
	}
	Rep(i, 1, n) {
		if (c[i] == m1) {
			if ((m2 && w[i] + b[m2] <= Y) || w[i] + b[m1] <= X) {
				sum ++, a[ c[i] ] ++;
			}
		} else {
			if ((w[i] + b[ c[i] ] <= X && b[ c[i] ] + b[m1] <= Y) || w[i] + b[m1] <= Y) {
				sum ++, a[ c[i] ] ++;
			}
		}
	}
	// Rep(i, 1, n) if (a[i]) {}
	ans = fac[sum];
	Rep(i, 1, n) ans = ans * inv[ a[i] ] % mod;
	printf("%lld\n", ans);

	return 0;
}

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

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
*/

using namespace std;

#if DEBUG && !ONLINE_JUDGE
    #include "debug.h"
#else
    #define debug(...)
#endif

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef pair<ll,ll> iil;
typedef vector<vector<int> > vvi;
typedef vector<vector<ii> > vvii;

#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define ff first
#define ss second
#define trav(a, x) for(auto& a : x) 
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
const ll INF = 1e18;
const int mod = 1e9 + 7;
ll gcd(ll a,ll b){if (a==0) return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return a*(b/gcd(a,b));}
ll Abs(ll a){if(a>0)return a;return -a;}
ll Ceil(ll a,ll b){if(a%b==0)return a/b;else return a/b+1;}
double Abs(double a){if(a>0)return a;return -a;}

//*X.find_by_order(2) element at index=2
//X.order_of_key(1) how many elements strictly less than 1

//#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_NOde_update> 

inline int pow_(ll x, ll y,ll p){
  int r = 1; while(y){if(y & 1) r = r * x % p; y >>= 1; x = x * x % p;} return r;
}
inline int inv_(int x){return pow_(x, mod - 2, mod);}
inline int add(int a, int b){a += b; if(a >= mod) a -= mod; return a;}
inline int mul(int a, int b){return a * 1LL * b % mod;}
inline int sub(int a, int b){a -= b; if(a < 0) a += mod; return a;}



int main()
{
	#ifdef LOCAL_TEST
	freopen("in.txt","r",stdin);
	//freopen("out.txt", "w", stdout);
	#else
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	#endif

	ll n,d;
	cin>>n>>d;
	vector<vector<int> > v(15);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=d;j++)
		{
			ll t;
			cin>>t;
			v[i].pb(t);
		}
	}
	ll ans = 0;
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			ll dist = 0;
			for(int k=0;k<d;k++)
			{
				dist += (v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
			}

			ll p = sqrt(dist);

			if(p*p == dist)
			{
				ans++;
			}
		}
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
 
int main(void) {
 
  long n;
  scanf("%ld", &n);
  long a,b;
  for (a = sqrt(n); a >= 1; a--) {
    if (n%a == 0) {
      b = n/a;
      break;
    }
  }
  int digit = 0;
  while (b > 0) {
    digit++;
    b /= 10;
  }
  printf("%d\n", digit);
 
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<vector<int>> graph(N);
  for (int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    A--, B--;
    graph[A].push_back(B);
    graph[B].push_back(A);
  }
  int prev[N];
  fill(prev, prev + N, -1);
  int dist[N];
  fill(dist, dist + N, 1e9);
  queue<pair<int, int>> que;
  que.push(make_pair(0, 0));
  dist[0] = 0;
  while (!que.empty()) {
    int v, p;
    tie(v, p) = que.front();
    que.pop();
    if (prev[v] != -1) continue;
    prev[v] = p;
    for (int u : graph[v]) {
      if (dist[u] > dist[v] + 1) {
        dist[u] = dist[v] + 1;
        que.push(make_pair(u, v));
      }
    }
  }
  bool isok = true;
  for (int i = 1; i < N; i++) isok &= prev[i] != -1;
  if (isok) {
    cout << "Yes" << endl;
    for (int i = 1; i < N; i++) cout << prev[i] + 1 << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 10800
def solve():
    P.sort()
    M.sort(reverse = True)
    p, m = [], []
    while len(p) + len(m) < k:
        if len(P) > 0 and len(M) <= 0: p.append(P.pop())
        elif len(P) <= 0 and len(M) > 0: m.append(M.pop())
        elif P[-1] < -M[-1]: m.append(M.pop())
        else: p.append(P.pop())
    if len(m)%2:
        Mi = M.pop() if len(p)*len(M) else 1  #  1 is no data
        Pi = P.pop() if len(m)*len(P) else -1 # -1 is no data
        if Mi < 0 and Pi >= 0:
            if abs(p[-1] * Pi) < abs(m[-1] * Mi):
                p.pop()
                m.append(Mi)
            else:
                m.pop()
                p.append(Pi)
        elif Mi < 0:
            p.pop()
            m.append(Mi)
        elif Pi >= 0:
            m.pop()
            p.append(Pi)
        else:
            p = sorted(p+P+m+M, key=lambda x:abs(x))[:k]
            m = []
    return p + m

n, k = map(int, input().split())
P, M = [], [] # plus, minus
for a in map(int, input().split()):
    if a < 0: M.append(a)
    else: P.append(a)
ans, MOD = 1, 10**9 + 7
for a in solve(): ans *= a; ans %= MOD
ans += MOD; ans %= MOD
print(ans)


Measured memory_bytes: 32088
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class BBetweenAAndB {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            long a = in.longs(), b = in.longs(), x = in.longs();
            out.println((b / x) - ((a + x - 1) / x) + 1);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long longs() {
            return Long.parseLong(string());
        }

    }
}



Measured memory_bytes: 22868
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n;
  cin>>n;
  long long int ans=0;
  for(int i=1; i<=n; i++){
    if(i%3!=0&&i%5!=0){
      ans+=i;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>

using namespace std;


int main(){
    string S; cin >> S;
    bool f = false;

    if (S.length() >= 4){
        if (S[0] == 'Y' && S[1] == 'A' && S[2] == 'K' && S[3] == 'I'){
            f = true;
        }
    }
    
    if (f == true) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <climits>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using namespace std;

const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(2000005);

mint g(int r, int c) {
	return comb(r + c + 2, r + 1) - 1;
}

bool comp(int i, int j) {
	return i > j;
}

int main()
{
	int n;
	cin >> n;
	int data[100000];
	for (int i = 0; i < n; i++)
	{
		cin >> data[i];
	}

	int mm = data[n - 1];
	for (int i = n - 2; i >= 0; i--)
	{
		if (mm > data[i])
		{
			mm = data[i];
		}
		else if (mm + 1 < data[i])
		{
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}


Measured memory_bytes: 31872
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque, Counter
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math
INF = 10 ** 20

def main():
    n = getN()
    nums = getList()
    mid = sum(nums) // n
    ans1 = 0
    for num in nums:
        ans1 += (num - mid) ** 2

    # print(ans1)

    ans2 = 0
    mid += 1
    for num in nums:
        ans2 += (num - mid) ** 2

    # print(ans2)
    mid -= 2
    ans3 = 0
    for num in nums:
        ans3 += (num - mid) ** 2

    print(min(ans1, ans2, ans3))

if __name__ == "__main__":
    main()



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

#define H_MAX 50
#define W_MAX 50

int field[H_MAX][W_MAX];

int w, h;

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

void dfs(int y, int x) {
    field[y][x] = 0;
    for (int i = 0; i < 8; i++) {
        int nx = x + dx[i];
        int ny = y + dy[i];
        if (0 <= nx && nx < w && 0 <= ny && ny < h && field[ny][nx]) {
            dfs(ny, nx);
        }
    }
}

int count() {
    int c = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (field[i][j]) {
                c++;
                dfs(i, j);
            }
        }
    }
    return c;
}

int main() {
    memset(field, 0, sizeof(field));
    while (cin >> w >> h) {
        if (w == 0 && h == 0) break;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                cin >> field[i][j];
            }
        }
        cout << count() << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

int main() {
	int p[10][5], sum = 0, y, x, cnt = 2;
	bool f[10][5] = {};
	for (int h; cin >> h&&h;) {
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < 5; j++) {
				cin >> p[i][j];
			}
		}
		while (1) {
			y = 0;
			for (int i = 0; i < h; i++) {
				x = 0;
				for (int j = 2; j < 5; j++) {
					if (p[i][j] == p[i][j - 1] && p[i][j - 1] == p[i][j - 2] && p[i][j]) {
						x = p[i][j];
						cnt++;
						f[i][j - 2] = 1;
						f[i][j - 1] = 1;
						f[i][j] = 1;
						y = 1;
					}
				}
				sum += x*cnt;
				cnt = 2;
				for (int k = 0; k < 5; k++)if (f[i][k])p[i][k] = 0;
				/*
				putchar('\n');
				for (int i = 0; i < h; i++) {
					for (int j = 0; j < 5; j++) {
						cout << p[i][j] << ' ';
					}
					putchar('\n');

				}
				putchar('\n');


				putchar('\n');
				for (int i = 0; i < h; i++) {
					for (int j = 0; j < 5; j++) {
						cout << f[i][j] << ' ';
					}
					putchar('\n');

				}
				putchar('\n');
				*/

			}
			if (!y)break;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < 5; j++) {
					if (f[i][j]) {
						f[i][j] = 0;
						for (int k = i; k > 0; k--) {
							swap(p[k][j], p[k - 1][j]);
						}
					}
				}
			}
			/*
			putchar('\n');
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < 5; j++) {
					cout << p[i][j] << ' ';
				}
				putchar('\n');

			}
			putchar('\n');




			putchar('\n');
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < 5; j++) {
					cout << f[i][j] << ' ';
				}
				putchar('\n');

			}
			putchar('\n');
			*/

		}
		cout << sum << endl;;
		sum = 0;

	}
	return 0;
}

Measured memory_bytes: 1160
program answer
  implicit none
  integer :: N, i, count
  integer, allocatable :: a(:)
  read(*,*) N
  allocate(a(N))
  read(*,*) a

  count=0
  do i = 1, N, 2
     if(mod(a(i),2)==1) then
        count=count+1
     end if
  end do

  write(*,*) count
  deallocate(a)
  stop
 end program answer

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

using namespace std;
#define rep(i,n) for(int i=0; i<n;i++)
#define vi vector<int>
int INF=1;
int main(){
  rep(i,9)INF*=10;
  int n,lim;cin>>n>>lim;
  vi v(n),w(n);
  rep(i,n)cin>>v[i]>>w[i];
  vector<vector<int> > dp(n+1,vi(lim+1,-INF));
  dp[0][0]=0;
  for(int i=0; i<n;i++){
    for(int j=0; j<=lim;j++){
      if(dp[i][j]== -INF)continue;
      dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
      if(j+w[i]<=lim)dp[i][j+w[i]]=max(dp[i][j+w[i]],dp[i][j]+v[i]);
    }
  }
  int ans=-INF;
  rep(i,lim+1)ans=max(ans,dp[n][i]);
  cout<<ans<<endl;
}

Measured memory_bytes: 6744
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define int long long
#define inf (int)1e18 + 7

const int mod = (int)1e9+7;

int dp[2][3010] = {0};
int sum[2][3010] = {0};

int getsum(int len, int whobeg, int whofin) {
  int res = sum[len & 1][whofin] - sum[len & 1][whobeg - 1];
  if (res < 0) res += mod;
  return res;
}

signed main() {

  int n;
  cin >> n;
  string s;
  cin >> s;
  
  int len = 1;
  dp[len & 1][1] = 1;
  sum[len & 1][1] = 1;
  for (len = 2; len <= n; len ++) {
    char flag = s[len - 2];
    for (int who = 1; who <= len; who ++) {
      if (flag == '>') {
        dp[len & 1][who] = getsum(len - 1, who, len - 1);
      } else {
        dp[len & 1][who] = getsum(len - 1, 1, who - 1);
      }
      sum[len & 1][who] = (sum[len & 1][who - 1] + dp[len & 1][who]) % mod;
    }
  }
  cout << sum[n & 1][n] << endl;
  return 0;
}

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

#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long int
#define MAX 1e9
#define MIN -1e9
#define mod 1000000007
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define output(x) cout << ( x ? "YES" : "NO" ) << '\n' ;
#define mxn 100005
using namespace std;

void solve(){
    string s,t;
    cin >> s >> t;
    int ans = -1;
    int n = (int)s.size();
    int m = (int)t.size();
    for(int i = 0; i <= n - m; i++){
        int cnt = 0;
        int  k = i;
        for(int j = 0; j < m; j++,k++){
            if(s[k] != t[j])cnt++;
        }
        if(ans == -1 || ans > cnt){
            ans = cnt;
        }
    }


    cout << ans;
}

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



Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define rank qwertyuio
#define next dfghjk
#define prev fhsgfhjf
#define plus fsghsf
#define minus ytryr
  
using namespace std;
  
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
  
const int N = 10;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
//const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD = 998244353;
const ld eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;
 
string a[N];
 
int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 10.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int n, m, k;
    cin >> n >> m >> k;
    rep(i, 0, n) {
        cin >> a[i];
    }
    int ans = inf;
    rep(mask, 0, (1 << (n - 1))) {
        int cnt = __builtin_popcount(mask);
        int tot = cnt;
        vector<int> cur(cnt + 1, 0);
        rep(j, 0, m) {
            int p = 0;
            rep(i, 0, n) {
                cur[p] += (a[i][j] == '1');
                if ((mask >> i) & 1) {
                    p++;
                }
            }
            bool bad = false;
            rep(i, 0, sz(cur)) {
                if (cur[i] > k) {
                    bad = true;
                }
            }
            if (bad) {
                tot++;
                fill(cur.begin(), cur.end(), 0);
                int p = 0;
                rep(i, 0, n) {
                    cur[p] += (a[i][j] == '1');
                    if ((mask >> i) & 1) {
                        p++;
                    }
                }
                bool bad = false;
                rep(i, 0, sz(cur)) {
                    if (cur[i] > k) {
                        bad = true;
                    }
                }
                if (bad) {
                    tot = inf;
                }
            }
        }
        setmin(ans, tot);
    }
    cout << ans << "\n";
    return 0;
}

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

int main(){
	string s;
  	int t;
  	cin >> s >> t;
  	set<string> da;
  	int n=s.size();
  	for (int i=0;i<n;i++){
    	for (int j=1;j<=min(t,n-i);j++){
      	string u=s.substr(i,j);
        da.insert(u);
        }
    }
  	auto pos = da.begin();
    for(int i = 0; i < t-1; i++) pos++;
  	cout << *pos << endl;
}


Measured memory_bytes: 1664
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))


int main(){
	int n;
	double x[4],y[4],t;
	scanf("%d",&n);
	rep(j,n){
		rep(i,4)scanf("%lf%lf",x+i,y+i);
		rep(i,2){
			x[i]=x[i*2]-x[i*2+1];
			y[i]=y[i*2]-y[i*2+1];
		}
		puts(x[0]*y[1]-y[0]*x[1]==0?"YES":"NO");
	}
	return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;


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

    string s; cin >> s; 
    int q; cin >> q;

    vector<pair<int, string>> t;
    for(int i=0; i<q; i++){
        int tmp; cin >> tmp;
        if(tmp==1){
            t.push_back(make_pair(0,""));
        }
        else{
            int tmp2; cin >> tmp2;
            string tmp3; cin >> tmp3;
            t.push_back(make_pair(tmp2, tmp3));
        }
    }

    bool flag = false;
    for(int i=0; i<q; i++){
        if(t.at(i).first==0){
            flag = !flag;
        }
        else if(t.at(i).first==1){
            string tmp = t.at(i).second;
            if(!flag) s.insert(0,tmp);
            else s.append(tmp);
        }
        else{
            string tmp = t.at(i).second;
            if(!flag) s.append(tmp);
            else s.insert(0, tmp);
        }
    }

    if(flag){
        for(ll i=s.size()-1; i>=0; i--){
            cout << s.at(i);
        }
        cout << endl;
        return 0;
    } 

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 13308
t=0
s=0
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
for i in range(N):
  A=list(map(int,input().split()))
  for j in range(M):
    s+=A[j]*B[j]
  s+=C
  if s>0:
    t+=1
  s=0
print(t)

Measured memory_bytes: 9036
from sys import stdin
import re
import bisect
import numpy as np

N, K = map(int, stdin.readline().rstrip().split())
frag = np.zeros((K,N), dtype=bool)
for i in range(K):
    _ = stdin.readline()
    line = map(int, stdin.readline().rstrip().split())
    for j in line:
        j -= 1
        frag[i][j] = True
        
count = int(0)
frag = frag.T
for i in range(N):
    if np.count_nonzero(frag[i] == 1) == 0:
        count += 1
print(count)

Measured memory_bytes: 27256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

int gcd(int a, int b)
{
  if (a%b==0){
    return(b);
  }
  else{
    return(gcd(b,a%b));
  }
}

int main(){
  ll N;
  cin >> N;
  ll ans = N*(N-1)/2;
  cout << ans  << endl;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

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

Measured memory_bytes: 4060
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include<set>
#include<queue>
#include <iomanip>

typedef long long ll;

#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h,n, w,m,t; string s;
ll R, C;
ll sy, sx, gy, gx;
char maze[20][20];
ll dis[20][20];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
ll Combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> numerator(r);
	vector<ll> denominator(r);

	for (int k = 0; k < r; k++)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	for (int p = 2; p <= r; p++)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	for (int k = 0; k < r; k++)
	{
		if (numerator[k] > 1) result *= numerator[k];
		result %= ma;
	}

	return result;
}

ll bfs() {
	queue<P> que;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) dis[i][j] = INF;
	}
	que.push(P(sy - 1, sx - 1));
	dis[sy - 1][sx - 1] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == gy - 1 && p.second == gx - 1) break;
		for (ll i = 0; i < 4; i++) {
			ll ny = p.first + dy[i];
			ll nx = p.second + dx[i];
			if (0 <= ny && ny < R && 0 <= nx && nx < C && maze[ny][nx] == '.' && dis[ny][nx] == INF) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	return dis[gy - 1][gx - 1];
}
ll dp[20500];
int main() {
	ll k;
	cin >> n >> k;
	if (n % k==0)cout << 0 << endl;
	else {
		ll a, b;
		a=n % k;
		b = abs(a - k);
		cout << min(a, b) << endl;
	}
}



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

using namespace std;

int main() {
  long long n;
  scanf("%lld", &n);
  long long ans = LLONG_MAX;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ans = min(ans, (i + n / i) - 2);
    }
  }
  if (ans != (int) 1e6 + 1)
    printf("%lld\n", ans);
  else
    printf("%lld\n", n - 1);
  return 0;
}


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN4(s,t,a,b);
  string u;
  IN(u);
  if(s==u) cout << a-1 << " " << b << endl;
  else cout << a << " " << b-1 << endl;
}

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

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

int d[12][12];

void poyo(int i, int j)
{
  if (i < 0 || 12 <= i || j < 0 || 12 <= j) return;
  if (d[i][j] == 0)return;
  d[i][j] = 0;
  for (int k = 0; k < 4; k++){
    poyo(i + dy[k], j + dx[k]);
  }
}

int main()
{
  int n;

  while (~scanf("%1d", &n)){
    d[0][0] = n;
    for (int i = 0; i < 12; i++){
      for (int j = 0; j < 12; j++){
        if (i + j == 0) continue;
        scanf("%1d", &d[i][j]);
      }
    }

    int cnt = 0;
    for (int i = 0; i < 12; i++){
      for (int j = 0; j < 12; j++){
        if (d[i][j] == 1){
          cnt++;
          poyo(i, j);
        }
      }
    }

    cout << cnt << endl;
  }
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
int A, B;
int main()
{
	cin >> A >> B;
	for (int i = 0; i < 1300; i++)
	{
		if ((int)floor(i * 0.08) == A && (int)floor(i * 0.1) == B)
		{
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
xlist = list(map(int,input().split()))
ans = []
p = 0

for i in range(0,101):
    for k in range(0,n):
        p += (xlist[k] - (i+1))**2
    ans.append(p)
    p = 0

anss = min(ans)

print(anss)

Measured memory_bytes: 3064
<?php
$stack=[];
$top=0;
$data=explode(' ',trim(fgets(STDIN)));
foreach($data as $d){
  if($d=='+') $stack[$top-1]+=$stack[$top--];
  elseif($d=='-') $stack[$top-1]-=$stack[$top--];
  elseif($d=='*') $stack[$top-1]*=$stack[$top--];
  else $stack[++$top]=$d;
}
echo $stack[1];
?>

Measured memory_bytes: 15544
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    vector<pair<int,string>>s(m);
    for(int i=0; i<m; i++){
        cin>>s.at(i).first>>s.at(i).second;
    }
    vector<int>v(n);
     vector<bool>cv(n,false);
    int ca=0;
    int cw=0;
    for(int i=0; i<m; i++){
        if(s.at(i).second=="AC") v.at(s.at(i).first-1)=1;
    }
    for(int i=0; i<n; i++){
        if(v.at(i)==1)ca++;
    }
    for(int i=0; i<m; i++){
        if(s.at(i).second=="AC") cv.at(s.at(i).first-1)=true;
        if(s.at(i).second=="WA"){
            if(v.at(s.at(i).first-1)==1){
                if(cv.at(s.at(i).first-1)==false){
                    cw++;
                }
            }
        }
    }
    cout<<ca<<endl;
    cout<<cw<<endl;

}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;

ll xor0toN(ll N){
    if(N%2==1){
        if(((N+1)/2)%2==1) return 1ll;
        else return 0ll;
    }else{
        if((N/2)%2==1) return 1ll^N;
        else return 0ll^N;
    }
}

int main(){

    ll A,B; cin>>A>>B;
    ll ans=(A==0? 0ll:xor0toN(A-1))^xor0toN(B);

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
int main(){
    vector<string> s_ary{"SUN","MON","TUE","WED","THU","FRI","SAT"};
    string s;
    cin >> s;
    for(int i = 0; i < s_ary.size(); i++) {
        if(s == s_ary[i]) cout << 7-i << endl;
    }
    

    return 0;
}

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

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buf;
    while(getline(ss, buf, sep)){
        v.push_back(buf);
    }
    return v;
}

int main(){
    int n; cin >> n;
    vector<double> x(n);
    vector<string> y(n);
    for(int i = 0; i < n; i++)
        cin >> x[i] >> y[i];

    double res = 0;
    for(int i = 0; i < n; i++){
        if(y[i] == "JPY")
            res += x[i];
        else
            res += x[i] * 380000.0;
    }

    cout << res << endl;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
	int K; cin >> K;
	int odd = K / 2 + K % 2;
	int even = K / 2;
	cout << odd * even << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  char kazu;
  int count[26]={0},i;

  while(scanf("%c",&kazu)!=EOF){
    if(kazu>='a' && kazu<='z')count[kazu-'a']++;
    if(kazu>='A' && kazu<='Z')count[kazu-'A']++;
  }
  
  for(i=0;i<26;i++){
    printf("%c : %d\n",'a'+i,count[i]);
  }

  return 0;
}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U>
void chmax(T &a, U b) {
  if (a < b) a = b;
}

template <class T, class U>
void chmin(T &a, U b) {
  if (b < a) a = b;
}

template <class T>
T Sq(const T &t) {
  return t * t;
}

signed main() {
  int p, q, r;
  cin >> p >> q >> r;
  int ans = p + q;
  chmin(ans, p + r);
  chmin(ans, r + q);
  print(ans);
}


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

int main(){
    int n;
    cin >> n;
    vector<int> ans(n, 0);
    vector<vector<int> > in(n, vector<int>(3));
    for(int i=0; i<n; i++){
        for(int j=0; j<3; j++){
            cin >> in[i][j];
        }
    }
    for(int i=0; i<3; i++){
        for(int j=0; j<n; j++){
            bool get = true;
            for(int k=1; k<n; k++){
                if(in[j][i] == in[(j+k)%n][i]){
                    get = false;
                }
            }
            if(get){
                ans[j] += in[j][i];
            }
        }
    }
    for(int i=0; i<n; i++){
        cout << ans[i] << endl;
    }
    return 0;
}



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

int main(){
	string s, str1, str2;
	map<string, int> mp;
	while(cin >> s){
		mp[s]++;
		if(mp[s] > mp[str1])str1 = s;
		if(s.size() > str2.size())str2 = s;
	}
	cout << str1 << " " << str2 << endl;
	return 0; 
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll N, M;
ll dp[2020][2020];

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

    cin >> N >> M;
    vector<ll> S(N), T(M);
    REP(i, N) cin >> S[i];
    REP(j, M) cin >> T[j];

    REP(i, 2020)REP(j, 2020) dp[i][j] = 0;

    REP(i, N){
    	REP(j, M){
    		if(S[i] == T[j]){
    			dp[i+1][j+1] = 1;
    			dp[i+1][j+1] += dp[i+1][j];
    			dp[i+1][j+1] %= mod;
    			dp[i+1][j+1] += dp[i][j+1];
    			dp[i+1][j+1] %= mod;
    		}
    		else{
    			dp[i+1][j+1] = dp[i+1][j] + dp[i][j+1];
    			dp[i+1][j+1] %= mod;
    			dp[i+1][j+1] -= dp[i][j]; 
    			dp[i+1][j+1] += mod;
    			dp[i+1][j+1] %= mod;
    		}
    	}
    }

    cout << (dp[N][M]+1)%mod << endl;

    return 0;
}

Measured memory_bytes: 32128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define vvvel vector<vvel>
void mmin(int &a, int b) { a = min(a, b); }
void mmax(int &a, int b) { a = max(a, b); }
void sor(vel &v) { sort(v.begin(), v.end()); }
int dis(int x1, int y1, vel &x, vel &y, int i) {
	return abs(x1 - x[i]) + abs(y1 - y[i]);
}
signed main() {
	int w, h; cin >> w >> h;
	int n; cin >> n;
	vel x(n);
	vel y(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		x[i]--;y[i]--;
	}
	vel mx = x;
	vel my = y;
	sor(mx);
	sor(my);
	if (n % 2 == 1) {
		int ans = 0;
		int ma1 = 0;
		int mid = (n - 1) / 2;
		int x1 = mx[mid];
		int y1 = my[mid];
		for (int i = 0; i < n; i++) {
			int di = abs(x1 - x[i]) + abs(y1 - y[i]);
			ans += di;
			mmax(ma1,di);
		}
		cout << 2 * ans - ma1 << endl;
		cout << x1+1 << " " << y1+1 << endl;
	}
	else {
		vel mid(2);
		mid[1] = n / 2;
		mid[0] = mid[1]-1;
		vel ax(2);
		vel ay(2);
		for (int i = 0; i < 2; i++) {
			ax[i] = mx[mid[i]];
			ay[i] = my[mid[i]];
		}
		int adi = 0;
		int ami = 0;
		int axy = h*w;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 2; j++) {
				for (int k = 0; k < 2; k++) {
					int mi1 = dis(ax[j], ay[k], x, y, i);
					if (j*k == 1) {
						adi += mi1;
					}
					if (ami < mi1) {
						ami = mi1;
						axy = ax[j] * w + ay[k];
					}
					if (ami == mi1) {
						mmin(axy, ax[j] * w + ay[k]);
					}
				}
			}
		}
		cout << 2 * adi - ami << endl;
		cout << (axy / w) + 1 << " " << (axy%w) + 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 6072
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define eps 1e-8
//#define eq(x,y) (fabs((x)-(y)) < eps)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
const ll mod = 998244353;
long double PI = acosl(-1);
const ll infl = 3e18+10;
const int inf = 1e9+10;
const int nmax = 1e5+5;
const int MAXLG = log2(nmax)+1;
//mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ost;


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

    ll x;
    cin>>x;
    for(ll b = -300; b<=300; b++){
        ll num = x + b*b*b*b*b;
        ll z = nearbyint( powl(num, 1.0/5.0) );
        if(z*z*z*z*z == num){
            cout<<z<<" "<<b<<endl;
            exit(0);
        }
    }
    assert(false);
}
/*
3
1 1 0
AB
AC
BC
*/


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


int main(){
	//freopen("i.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	long long a, b;
	cin >> a >> b;
	
	long long g = __gcd(a,b);
	
	cout << (a*b)/g;
	
}


Measured memory_bytes: 256