akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n,a[105],ans=1e18;
int32_t main(){
CODE_START;
cin>>n;
for(ll i=0;i<n;i++)
{
    cin>>a[i];
}
for(ll i=1;i<=100;i++)
{
    ll s=0;
    for(ll j=0;j<n;j++)
        s=s+(i-a[j])*(i-a[j]);
    ans=min(ans,s);
}
cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <stdio.h>


int main(void)
{
    int N, H1, H2;
    char c;
    int i;
    int ctr = 0;
    int max = 0;
    
    
    scanf("%d%c", &N, &c);
    scanf("%d%c", &H1, &c);
    
    
    for(i=1; i<N; i++)
    {
        scanf("%d%c", &H2, &c);
        
        
        if(H1 >= H2)
            ctr++;
        else
        {
            if(max < ctr)
                max = ctr;
            
            ctr = 0;
        }
        
        H1 = H2;
    }
    
    if(max < ctr)
        max = ctr;
    
    
    printf("%d\n", max);
    
    
    //system("pause");
    
    return 0;
}

Measured memory_bytes: 128
import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
count = 0
b = []
for i in a:
  if i <0:
    count += 1
  b.append(abs(i))
b.sort()
b = np.array(b)
if count % 2 ==0:
  print(b.sum())
else:
  print(b.sum()-b[0]*2)

Measured memory_bytes: 23336
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int n,ans;
    cin>>n;
    if(n<105)ans=0;
    if(105<=n)ans=1;
    if(135<=n)ans=2;
    if(165<=n)ans=3;
    if(189<=n)ans=4;
    if(195<=n)ans=5;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
class Main {
 
    public static void main(String[] args) {
 
        Scanner sc = null;
        try {
            sc = new Scanner(System.in);
            while (sc.hasNextDouble()) {
                double x = sc.nextDouble();
 
                 double n = Math.ceil(((((x/9.8)*(x/9.8)*4.9)+5)/5));
                System.out.println((int)n);
            }
        } finally {
            sc.close();
        }
    }
}

Measured memory_bytes: 28208
#include <stdio.h>

void main(){
  int n,i,k;
  scanf("%d",&n);
  int buka[n];
  for(i=0;i<n;i++)
    buka[i]=0;
  for(i=1;i<n;i++){
    scanf("%d",&k);
    buka[k-1]++;
  }
  for(i=0;i<n;i++){
    printf("%d\n",buka[i]);
  }
}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		for(int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
		}
		int[] b = new int[N];
		for(int i = 0; i < N; i++)
		{
			b[i] = 0;
		}
		int sum = 0;
		for(int i = N; i > (N+ 1) / 2; i--)
		{
			if(a[i-1] == 0)
			{
				b[i-1] = 0;
			}
			else
			{
				b[i-1] = 1;
			}
		}
		for (int i = (N+1)/2; i > 0; i--)
        {
            int temp = 0;
            for(int j = 1; j * i <= N; j++)
            {
                if(b[j*i-1] == 1)
                {
                    temp++;
                }
            }
            if (temp % 2 == 1)
            {
                if (a[i - 1] == 1)
                {
                    b[i - 1] = 0;
                }
                else
                {
                    b[i - 1] = 1;
                }
            }
            else
            {
                if (a[i - 1] == 1)
                {
                    b[i - 1] = 1;
                }
                else
                {
                    b[i - 1] = 0;
                }
            }
        }
        for(int i = 0; i < N; i++)
        {
            if(b[i] == 1)
            {
                sum++;
            }
        }
        System.out.println(sum);
        for (int i = 0; i < N; i++) {
            if(b[i] == 1)
            {
                System.out.println(i + 1);
            }
        }

		sc.close();
	}

}

Measured memory_bytes: 88228
n,k = map(int,input().split())
top = [0]*n
sub = []
for i in range(n):
    t,d = map(int,input().split())
    t -=1
    if top[t]==0:
        top[t]=d
    else:
        if top[t]>=d:
            sub.append(d)
        else:
            sub.append(top[t])
            top[t]=d
 
top.sort()
top = top[::-1]
res = [0]
for i in range(n):
    if top[i]!=0:
        res.append(res[-1]+top[i])
    else:
        res.append(-1)
sub.sort()
sub = sub[::-1]
w = [0]
for i in range(len(sub)):
    w.append(w[-1]+sub[i])
tmp = 0
for i in range(1,k+1):
    if len(w)-1>=k-i and res[i]!=-1:
        tmp = max(res[i]+w[k-i]+i*i,tmp)
 
print(tmp)
    

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

int main(){
  string s, t; cin >> s >> t;
  
  if(s.size() + 1 != t.size()){
    cout << "No" << endl;
    return 0;
  }
  
  for(int i = 0; i < s.size(); i++){
    if(s.at(i) != t.at(i)){
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int l;
char s[110];
inline void read()
{
	register int i=0;
	s[i]=getchar();
	while(s[i]!=EOF)
		i++,s[i]=getchar();
}
int main()
{
	read(),l=strlen(s);
	for(register int i=0;i<l;i++)
		if(s[i]=='C')
			for(register int j=i+1;j<l;j++)
				if(s[j]=='F')
					printf("Yes\n"),exit(0);
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
import java.lang.Math

fun main(args: Array<String>)
{
    val (n) = readLongs()
    val ans: Long = n * (n - 1L) / 2L

    println(ans)
}

fun readInts(): List<Int> = readLine()!!.split(" ").map(String::toInt)
fun readLongs(): List<Long> = readLine()!!.split(" ").map(String::toLong)

fun readIntArr(): IntArray = readLine()!!.split(" ").map(String::toInt).toIntArray()
fun readLongArr(): LongArray = readLine()!!.split(" ").map(String::toLong).toLongArray()

fun readIntArrS(): IntArray = readLine()!!.split(" ").map(String::toInt).toIntArray().sortedArray()
fun readLongArrS(): LongArray = readLine()!!.split(" ").map(String::toLong).toLongArray().sortedArray()

fun readIntArrSD(): IntArray = readLine()!!.split(" ").map(String::toInt).toIntArray().sortedArrayDescending()
fun readLongArrSD(): LongArray = readLine()!!.split(" ").map(String::toLong).toLongArray().sortedArrayDescending()

fun readString() = readLine()!!


Measured memory_bytes: 35960
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
void solve(){
	int n;
	cin>>n;
	ll ans=0;
	rep(i,1,n+1){
		if(i%3&&i%5){
			ans+=i;
		}
	}
	cout<<ans;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}






Measured memory_bytes: 3652
#define _DEBUG
#include "bits/stdc++.h"
#include <atcoder/all>
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
using namespace atcoder;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int N,Q;
	scan(N>>Q);
	dsu uf(N);
	rep(i,Q){
		int t,u,v;
		scan(t>>u>>v);
		if(t==0) uf.merge(u,v);
		else prin(uf.same(u,v));
	}
	return 0;
}


Measured memory_bytes: 4028
import sys

class Point(object):
    def __init__(self, x, y):
        self.x = x
        self.y = y
    def isLeft(self, vector):
        tmpVector = DirectedVector(vector.start, self)
        sin = tmpVector * vector
        if sin > 0:
            return True
        else:
            return False

class DirectedVector(object):
    def __init__(self, start, end):
        self.start = start
        self.end = end
    @property
    def x(self):
        return self.end.x - self.start.x
    @property
    def y(self):
        return self.end.y - self.start.y
    def __mul__(self, other):
        return self.x * other.y - self.y * other.x

def getDataSets():
    for line in sys.stdin.readlines():
        line = line.strip()
        x1, y1, x2, y2, x3, y3, xp, yp = [float(x) for x in line.split()]
        p1 = Point(x1, y1)
        p2 = Point(x2, y2)
        p3 = Point(x3, y3)
        px = Point(xp, yp)
        yield p1, p2, p3, px

def main():
    for p1, p2, p3, px in getDataSets():
        evaluate = [
                px.isLeft(DirectedVector(p1, p2)),
                px.isLeft(DirectedVector(p2, p3)),
                px.isLeft(DirectedVector(p3, p1)),
                ]
        if(all(evaluate) or not any(evaluate)):
            print 'YES'
        else:
            print 'NO'

if __name__ == "__main__":
    main()

Measured memory_bytes: 4324
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
         
        String input = sc.nextLine();
		
      	if (input.equals("AAA") || input.equals("BBB")) {
          System.out.println("No");
        } else {  
          System.out.println("Yes");
        }
	}
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
int64_t INF = 1000000007;
// int64_t INF = 9223372036854775807;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t a,b,c,k;
    cin >> a >> b >> c >> k;
    int64_t res = 0;
    if(k<=a){
        res = k;
    }else{
        res += a;
        if(k>a+b){
            res -= k-(a+b);
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3640
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int a[5], l;
    for (int i = 0; i < 5; i++) {
        cin >> a[i];
    }
    cin >> l;

    bool flag = true;
    for (int i = 0; i < 5 - 1; i++) {
        for (int k = i + 1; k < 5; k++) {
            if (l < a[k] - a[i]) {
                flag = false;
            }
        }
    }

    if (flag) {
        cout << "Yay!" << endl;
    } else {
        cout << ":(" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;


int main() {
	int n, m;
	cin >> n >> m;
	int x=1;
	for (int i = 0; i < m; ++i) x *= 2;
	
	cout << (1900 * m + 100 * (n - m)) * x << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
using namespace std;

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<string,int>      P;
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

signed main(){
	int last[26][200001],len[200000],nxt[200000];
	string s;
	cin >> s;
	for(int i = 0;i < 26;i++) last[i][s.length()] = -1;
	for(int i = s.length() - 1;i >= 0;i--){
		len[i] = INF;
		for(int j = 0;j < 26;j++){
			if(j == s[i] - 'a') last[j][i] = i;
			else last[j][i] = last[j][i + 1];
		}
	}
	for(int i = s.length() - 1;i >= 0;i--){
		for(int j = 0;j < 26;j++){
			if(last[j][i + 1] == -1){
				nxt[i] = j;
				len[i] = 1;
				break;
			}
			else {
				if(len[i] > len[last[j][i + 1]] + 1){
					len[i] = len[last[j][i + 1]] + 1;
					nxt[i] = j;
				}
			}
		}
	}
	int mi = INF,mia;
	for(int i = 0;i < 26;i++){
		if(last[i][0] == -1){
			cout << (char)('a' + i) << endl;
			return 0;
		}
		if(mi > len[last[i][0]]){
			mi = len[last[i][0]];
			mia = i;
		}
	}
	cout << (char)('a' + mia);
	int pos = last[mia][0];
	while(pos != -1){
		cout << (char)('a' + nxt[pos]);
		pos = last[nxt[pos]][pos + 1];
	}
	cout << endl;
	return 0;
}

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


bool eq(vector<int>& a, vector<int>& b) {
	if (a.size() != b.size()) {
		return false;
	}

	for (int i = 0; i < a.size(); ++i) {
		if (a[i] != b[i]) {
			return false;
		}
	}

	return true;
}

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

	vector<int> s(n);

	vector<int> p(n);
	for (int i = 0; i < n; ++i) {
		cin >> p[i];
		s[i] = i + 1;
	}

	int px;
	int x = 1;
	do {
		if (eq(p, s)) {
			px = x;
			break;
		}
		++x;
	} while (next_permutation(s.begin(), s.end()));


	vector<int> q(n);
	for (int i = 0; i < n; ++i) {
		cin >> q[i];
		s[i] = i + 1;
	}

	int qx;
	x = 1;
	do {
		if (eq(q, s)) {
			qx = x;
			break;
		}
		++x;
	} while (next_permutation(s.begin(), s.end()));

	cout << abs(px - qx);
	
	return 0;
}
	

Measured memory_bytes: 256
import math

N, T = map(int, input().split())

c_list = []
for i in range(N):
    c1, t1=[int(i) for i in input().split()]
    if t1 <= T:
        c_list.append(c1)

if not c_list:
    print('TLE')
else:
    print(min(c_list))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <db,db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD=998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

const int N=100005;

int dp[N][101];
void solve()
{
int n,w;
cin>>n>>w;

pair<int,int> p[n+1];
for(int i=1;i<=n;i++)
cin>>p[i].fi>>p[i].se;
for(int i=1;i<=w;i++)
{
for(int j=1;j<=n;j++)
{
dp[i][j]=dp[i][j-1];
if(i>=p[j].fi)
dp[i][j]=max(dp[i][j],p[j].se+dp[i-p[j].fi][j-1]);
}
}
cout<<dp[w][n]<<endl;


}




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

Measured memory_bytes: 82464
n = int(input())
a = list(map(int,input().split()))
t = [0 for _ in range(3)]

for i in range(n):
	if a[i] % 2 == 0:
		if a[i] % 4 == 0:
			t[2] += 1
		else:
			t[1] += 1
	else:
		t[0] += 1

if t[0] + (t[1]%2) <= t[2] + 1:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 20016
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i32,
        b: i32
    }
    let answer = a - (b * 2);
    println!("{}", if answer > 0 {answer} else {0});
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int H,A;
    cin >> H>>A;
    int amari = H % A;
    if(amari != 0) {
        cout << H / A + 1 << endl;
    } else {
        cout << H / A << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SIZE 10
#define PI 3.141592653589793

using namespace std;
typedef long long ll;

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

	int i,j;
	int answer=0;
	ll N;
	ll counter=0;
	string tmp;
	vector<string> given;

	cin >> N;

	for(i=0;i<N;i++){
		cin >> tmp;
		given.push_back(tmp);
	}

	sort(given.begin(),given.end());
	given.erase(unique(given.begin(),given.end()),given.end());
	//sort(given.begin(),given.end(),greater<int>());
	
	answer=given.size();
	cout << answer << endl;

	return 0;
}



Measured memory_bytes: 11540
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  double w,h,x,y;
  cin >> w >> h >> x >> y;

  if(w==2*x && h==2*y){
    printf("%0.12f",w*h/2);
    cout << " " << 1 << endl;
  }
  else{
    printf("%0.12f",w*h/2);
    cout << " " << 0 << endl;
  }

}

Measured memory_bytes: 256
n,m = map(int,input().split())
py = [list(map(int,input().split())) for i in range(m)]
for i in range(m):
    py[i].append(i)
pysorted = sorted(py,key=lambda x:x[1])
#県の出現回数をカウント
appear = [1]*(n+1)
for i in range(m):
    pysorted[i].append(str(pysorted[i][0]).zfill(6) + str(appear[pysorted[i][0]]).zfill(6))
    appear[pysorted[i][0]] += 1
pyresorted = sorted(py,key=lambda x:x[2])
for i in range(m):
    print(py[i][3])

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

long long modpow(long long a, long long n, long long mod) {
    long long x = 1;
    while (n > 0) {
        if (n & 1) x = x * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return x;
}

int main(){
  map<ll,int> mp;
  ll n,k;
  cin >> n >> k;
  //10^100のあまり
  const ll C = modpow(10, 100, 1000000007);
  //cout << C << endl;
  ll count = 0;
  for(ll i=k; i<=n+1; i++){
    ll simoiketa = i*(i-1)/2;
  	ll kamiiketa = (2*n+1-i)*i/2;
    count += (kamiiketa - simoiketa)%1000000007 + 1;
    count = count%1000000007;
  }
  cout << count << endl;
}



Measured memory_bytes: 3644
n = int(input())
a = list(map(int, input().split()))
a.sort()
anslist = []
for i in range(1, n - 1):
    if a[i] >= 0:
        anslist.append([a[0], a[i]])
        a[0] -= a[i]
    else:
        anslist.append([a[-1], a[i]])
        a[-1] -= a[i]

anslist.append([a[-1], a[0]])
ans = a[-1] - a[0]
print(ans)
for i, j in anslist:
    print(i, j)
#
# a.sort()
# ans = a[0]
# for i in range(1, n - 1):
#     ans += a[i] * (-1)
#
# print(a[-1] - ans)
# key = a[0]
# for i in range(1, n - 1):
#     print(key, a[i])
#     key = key - a[i]
# print(a[-1], key)

# a.sort()
# plusa = []
# minusa = []
# for i in a[1:-1]:
#     if i < 0:
#         minusa.append(i)
#     else:
#         plusa.append(i)
# #
# # print(minusa, plusa)
# anslist = []
# # if len(a) == 2:
# #     print(max(a) - min(a))
# #     print(max(a), min(a))
# # if min(a) >= 0:
# #     for i in range(1, n - 1):
# #         anslist.append([a[0], a[i]])
# #         a[0] -= a[i]
# #     anslist.append([a[-1], a[0]])
# #     print(a[-1] - a[0])
# #     for i, j in anslist:
# #         print(i, j)
# # else:
# #     if len(plusa) == 0:
# #         plusa.append(minusa[-1])
# #         del minusa[-1]
# #
# #     for i in minusa:
# #         # print(plusa[0], i)
# #         anslist.append([plusa[0], i])
# #         plusa[0] -= i
# #
# #     for i in plusa:
# #         # print(a[0], i)
# #         anslist.append([a[0], i])
# #         a[0] -= i
# #     # print(a[0])
# #     print(a[-1] - a[0])
# #     for i, j in anslist:
# #         print(i, j)
# #     # print(anslist)
# #     print(a[-1], a[0])

Measured memory_bytes: 67404
#include<stdio.h>

main(){
  int n1, count = 0;
  scanf("%d", &n1);

  int i, j, array1[n1];
  for( i = 0; i < n1; i++){
    scanf("%d", &array1[i]);
  }
  int n2;
  scanf("%d", &n2);
  int array2[n2+1];
  for( i = 0; i < n2; i++){
    scanf("%d", &array2[i]);
  }

  for( i = 0; i < n2; i++){
    int left = 0, right = n1 + 1, mid;
    mid = (left + right) / 2;
    while( left < right ){
      if( array2[i] == array1[mid] || array2[i] == array1[left] || array2[i] == array1[right]){
	count++;
	break;
      }else if( array2[i] > array1[mid]){
	left = mid + 1;
	mid = (left + right) / 2;
      }else{
	right = mid;
	mid = (left + right) / 2;
      }		
    }
  }
  
  printf("%d\n", count);
  
  return 0;
}
 

Measured memory_bytes: 1184
import re
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

MOD = 10**9+7
N = int(input())
CHAR = ["A", "C", "G", "T"]
invalid_pattern = r'ACG|GAC|A.?GC|AG.?C'
invalid_reg = re.compile(invalid_pattern)

# 一個前の状態だけあればいいので、一次元のdpでいい
dp = {a+b+c: 1 if not invalid_reg.search(a+b+c)
      else 0 for a in CHAR for b in CHAR for c in CHAR}


# dpで、最後の３文字を記憶-> 新しく加える文字4通りで、加えても大丈夫なら遷移。
# loop iでは、i+4文字の長さの条件を満たす文字列の数を数える
for i in range(N-3):
    next_dp = {key: 0 for key, _ in dp.items()}
    for key, val in dp.items():
        for c in CHAR:
            next_val = key+c
            if invalid_reg.search(next_val):
                # 新しい文字を追加した時に、条件に違反するなら遷移なし
                continue
            else:
                # 加えても大丈夫なので遷移
                next_dp[(key+c)[1:]] += dp[key]
    dp = next_dp
    for key in dp.keys():
        dp[key] %= MOD
# sumの後のMODを忘れない
print(sum(dp.values()) % MOD)


Measured memory_bytes: 3188
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from itertools import chain, accumulate
from functools import reduce
from collections import OrderedDict, Counter, deque
import operator

IS = lambda: int(input())
IA = lambda: [int(x) for x in input().split()]
IM = lambda N: [IA() for _ in range(N)]

N, Q = IA()
S = input()
LR = IM(Q)

a = [0] * (N+5)
l = 0
while True:
    p = S[l:].find('AC')
    if p == -1: break
    a[l + p + 1] = 1
    l += p + 2
a = list(accumulate(a))

for l, r in LR:
    print(a[r-1] - a[l-1])

Measured memory_bytes: 26608
n = int(input())
A = list(map(int, input().split(' ')))

import numpy as np

neg_cnt = len(list(filter(lambda x: x<0, A)))
abs_lis = np.abs(A)
sum_abs = sum(abs_lis)
if neg_cnt % 2 ==0:
    print(sum_abs)
else:
    print(sum_abs-2*min(abs_lis))


Measured memory_bytes: 31616
import math
import sys
a,b,x = map(int, input().split())

h1 = 0
_tan = 0

if x<=(b*a**2)/2:
	h1 = 2*x/(a*b)
	_tan = h1/b
else:
	h1 = (2*x/a**2)-b
	if b==h1:
		print(0)
		sys.exit()
	else:
		_tan = a/(b-h1)

print(90 - math.degrees(math.atan(_tan)))

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

int gcd(int a,int b){
    if(b == 0)return a;
    else return gcd(b,a%b);
}
int main() {
    int a,b;
    while(cin >> a >> b){
        cout << gcd(a, b) << endl;
    }
    return 0;
}

Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;
typedef pair<int,int> pii;

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

//UnionFind
struct UnionFind {
    vector<ll> par;
    vector<ll> siz;

    UnionFind(ll N) : par(N),siz(N,1LL) {
        for(int i = 0; i < N; i++) par[i] = i;
    }
    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        if(siz[rx]<siz[ry])swap(rx,ry);
        siz[rx]+=siz[ry];
        par[ry] = rx;
    }
    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    ll size(ll x){
        return siz[root(x)];
    }
};

int main(){
    int N,K,L;
    cin >> N >> K >> L;
    UnionFind load(N),rail(N);
    rep(i,K){
        int p,q;
        cin >> p >> q;
        p--;q--;
        load.unite(p,q);
    }
    rep(i,L){
        int r,s;
        cin >> r >> s;
        r--;s--;
        rail.unite(r,s);
    }
    map<pii,int> mp;
    rep(i,N){
        mp[make_pair(load.root(i),rail.root(i))]++;
    }
    rep(i,N){
        cout << mp[make_pair(load.root(i),rail.root(i))] << " ";
    }
    cout << endl;
    return 0;
}

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

int main()
{
  long long a,b,c;
  cin>>a>>b>>c;
  long long ans=0ll;
  ans=min({((a+1)/2-(a)/2)*b*c,((b+1)/2-b/2)*a*c,((c+1)/2-c/2)*a*b});
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = inputs[0]
    n = len(S)
    is_even = True if n % 2 == 0 else False

    if is_even:
        front = S[:n//2]
        back = S[n//2:]
    else:
        front = S[:n//2+1]
        back = S[n//2:]
    count = 0

    for i, c in enumerate(reversed(back)):
        if front[i] != c:
            count += 1
    return count


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int n,a;
	cin>>n>>a;
	if(n%500==0){
		cout<<"Yes"<<endl;
	}
	else{
		n=n%500;
		if(n<=a){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s1 = "CODEFESTIVAL2016";
		String s2 = scanner.next();
		int count = 0;
		for(int i = 0; i < s1.length(); ++i){
			if(s1.charAt(i) != s2.charAt(i))
				++count;
		}
		System.out.println(count);
		scanner.close();
	}

}


Measured memory_bytes: 9044
/*--------------------------"SABUJ-JANA"------"JADAVPUR UNIVERSITY"--------*/
/*-------------------------------@greenindia-----------------------------------*/
/*---------------------- Magic. Do not touch.-----------------------------*/
/*------------------------------God is Great/\---------------------------------*/
#include <bits/stdc++.h>
using namespace std;
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
//cout<<fixed<<showpoint<<setprecision(12)<<ans<<endl;
#define dbg(x) cerr << #x << " = " << x << endl
#define endl "\n"
#define int long long int
#define double long double
#define pb push_back
#define mp make_pair
#define PI acos(-1)

//const int INF=1e9+5;//billion
int primes[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89};
string alpha = "abcdefghijklmnopqrstuvwxyz";
/*----------JU IS LOVE----------*/
//int power(int a,int b,int m){int ans=1;while(b){if(b&1)ans=(ans*a)%m;b/=2;a=(a*a)%m;}return ans;}
//int power(int a, int b){int ans=1;while(b){if(b&1)ans=ans*a;b/=2;a=a*a;}return ans;}


signed main() {
    
	 
	crap;

	int n;
	cin>>n;

	int a[n+1];
	for (int i = 1; i <= n; ++i)
	{
		/* code */
		cin>>a[i];
	}

	int box[n+1];
	std::vector<int> ans;

	for (int i = n; i > n/2; i--)
	{
		/* code */
		box[i] = a[i];
		if(box[i] == 1)
			ans.push_back(i);

	}

	for (int i = n/2 ; i >= 1; i--)
	{
		/* code */
		int curr = i;
		int sum=0;
		//check multiples of curr index
		for(int j=i + i ; j<=n;  j+=i){
			sum+=box[j];
		}

		if(sum%2 == a[i])
			box[i]=0;
		else
			box[i]=1;

		if(box[i] == 1)
			ans.push_back(i);

	}

	cout<< ans.size() <<endl;
	for(auto x: ans)
		cout<< x <<" ";
 
 	
 	

	return 0;
}






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

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)

int w,h;
char f[32][32];

int fill(int x, int y){
	if( x<0 || y<0 || x>=w || y>=h || f[y][x]=='#' )return 0;
	f[y][x] = '#';
	return 1 + fill(x-1,y) + fill(x+1,y) + fill(x,y+1) + fill(x,y-1);
}

int main(){
	int x,y;
	while(cin>>w>>h,w|h){
		rep(i,h)cin>>f[i];
		rep(i,h)rep(j,w)if( f[i][j]=='@' ){
			x=j; y=i;
		}
		printf("%d\n",fill(x,y));
	}
	return 0;
}

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

#define pb push_back
#define fi first
#define se second

typedef long long ll;


void sove() {
	
}


int main() {
	int k;
	string str;
	cin >> k >> str; 
	
	string sub = str.substr(0, k);
	if(sub == str) {
		cout << str;
	} else {
		cout << sub << "...";
	}
}


Measured memory_bytes: 3624
s = list(input())
l = ['A', 'T', 'C', 'G']
max_cnt = 0
cnt = 0
for i in range(len(s)):
    if s[i] in l:
        cnt += 1
    elif s[i] not in l:
        cnt = 0
    if max_cnt <= cnt:
        max_cnt = cnt
print(max_cnt)

Measured memory_bytes: 3060
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


m = I()
ans = 24 + 24 - m
print(ans)


Measured memory_bytes: 9188
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		String T = sc.next();
		String ans = "";

		for(int i=0; i<N; i++){
			ans += S.substring(i, i+1);
			ans += T.substring(i, i+1);
		}

		System.out.println(ans);
    }
}


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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

const int INF=1e9;
const int MOD=1e9+7;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

struct Edge{
	int src,dst;
	Edge(){}
	Edge(int s,int d):src(s),dst(d){}
};
typedef vector<vector<Edge>> Graph;

void DFS(const Graph& g,const vi& ps,int u,vi& vis,int cur,int rem,int& res)
{
	int n=g.size();
	if(cur+rem<=res) return;
	res=max(res,cur);
	if(u==n) return;
	
	if(vis[u]){
		DFS(g,ps,u+1,vis,cur,rem,res);
		return;
	}
	
	// use u
	vi tmp=vis;
	vis[u]=1;
	rep(i,g[u].size()){
		int v=g[u][i].dst;
		if(!vis[v]) vis[v]=2,rem-=ps[v];
	}
	DFS(g,ps,u+1,vis,cur+ps[u],rem-ps[u],res);
	swap(vis,tmp);
	rep(i,g[u].size()){
		int v=g[u][i].dst;
		if(!vis[v]) rem+=ps[v];
	}
	
	if(u==0) return;
	
	// don't use u
	if(g[u].size()>=1){
		vis[u]=2;
		DFS(g,ps,u+1,vis,cur,rem-ps[u],res);
		vis[u]=0;
	}
}

int MaxIndependentSet(const Graph& g,const vi& ps)
{
	vi vis(g.size());
	int res=0;
	DFS(g,ps,0,vis,0,accumulate(all(ps),0),res);
	return res;
}

int main()
{
	for(int n;cin>>n && n;){
		Graph g(n);
		vi ps(n); // 軍事力
		map<string,int> f;
		rep(i,n){
			string s; cin>>s;
			f.insert(mp(s,f.size()));
			int u=f[s];
			cin>>ps[u];
			int m; cin>>m;
			rep(j,m){
				string t; cin>>t;
				f.insert(mp(t,f.size()));
				int v=f[t];
				g[u].emplace_back(u,v);
			}
		}
		
		cout<<MaxIndependentSet(g,ps)<<endl;
	}
}

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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

vector<ll> A;
// vectorのリサイズ
// A.resize(N);

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


// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i, a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

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

  ll x, y;
  cin >> x >> y;
  if ((x+y)%3) {
    cout << 0 << endl;
    return 0;
  }
  ll n = (2*y-x)/3; // i+1, j+2 pattern
  ll m = (2*x-y)/3; // i+2, j+1 pattern
  if (n < 0 || m < 0) {
    cout << 0 << endl;
    return 0;
  }
  //cout << n << ", " << m<< endl;
  cout << choose(n+m, n)<< endl;

  return 0;
}


Measured memory_bytes: 256
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

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

const int N = 1e5 + 10;

int main() {
	fast_cin();
	int x; cin >> x;
	cout << 360 / __gcd(x, 360) << endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
using namespace std;
void WA(){cout << "WA" << endl;}
void AC(){cout << "AC" << endl;}

int main(){
  string s;
  cin >> s;
  
  if(s[0] != 'A'){
    WA();
    return 0;
  }
  int c = 1000;
  for(int i=2;i<s.length()-1;i++){
    if(s[i] == 'C'){
      c=i;
      break;
    }
  }
  if (c == 1000){
    WA();
    return 0;
  }
  for(int i=1;i<s.length();i++){
    if(i!=c && (s[i] < 'a' || s[i] > 'z')){
      WA();
      return 0;
    }
  }
  AC();
}


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

long long gcd (ll x, ll y)
{
	if (y == 0) return x;
	return gcd(y, x % y);
}
 
long long lcm(ll x, ll y)
{
	return x * y / gcd(x, y);
}

signed main(void)
{
	int n, m;
	long long g, ans;
	string s, t;

	cin >> n >> m >> s >> t;
	ans = lcm(n, m);
	g = gcd(n, m);
	for(long long k = 0; k < g; k++)
	{
		if (s[k * n / g] != t[k * m / g])
			ans = -1;
	}
	cout << ans << endl;
	return 0;
}


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

int main()
{
    int a, b, c, d;
    string ans("Yes");

    cin >> a >> b >> c >> d;
    while (a > 0 && c > 0)
    {
        c -= b;
        if (a > 0 && c > 0)
        {
            a -= d;
        }
    }

    if (a <= 0)
    {
        ans = ("No");
    }

    cout << ans << endl;
}

Measured memory_bytes: 3624
def main():
    n = int(input())
    a = [int(an) for an in input().split()]
    exist2 = False
    not4 = 0
    count4 = 0
    for an in a:
        if an % 2 == 0:
            if an % 4 == 0:
                count4 += 1
            else:
                if not exist2:
                    exist2 = True
                    not4 += 1
        else:
            not4 += 1
    print('Yes' if count4 >= not4 - 1 else 'No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 85432
n,m=map(int,input().split())
lst=[list(map(int,input().split())) for i in range(m)]
lst.sort(key=lambda x:x[1])
ans=1
pin=lst[0][1]-1

for i in range(1,m):
  if lst[i][0]>pin:
    ans+=1
    pin=lst[i][1]-1

print(ans)

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

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll N, M;
    cin >> N >> M;
    ll ki, si, pi;
    vector<ll> S;
    vector<ll> P;
    for(int i=0;i<M;i++){
        cin >> ki;
        int tmp = 0;
        for(int j=0;j<ki;j++){
            cin >> si;
            tmp |= 1<<(si-1);
        }
        S.push_back(tmp);
    }
    for(int i=0;i<M;i++){
        cin >> pi;
        P.push_back(pi);
    }
    ll res = 0;
    for(int bit = 0; bit < 1<<N; bit++){
        bool allOn = true;
        for(int i=0;i<M;i++){
            if(__builtin_parity(bit & S[i]) != P[i]) allOn = false;
            if(!allOn) break;
        }
        if(allOn) res++;
    }
    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner()
	X := sc.NextInt()

	if X >= 30 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 1772
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<stack>
#include<queue>
using namespace std;
using Graph=vector<vector<int>>;
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; }

int main(){
    long long sum=0;
    vector<long long> t(110010,0);
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        int temp;
        cin>>temp;
        ++t[temp];
        sum+=temp;
    }
    
    int q;
    cin>>q;
    vector<long long> ans(q);
    for(int i=0;i<q;++i){
        int b,c;
        cin>>b>>c;
        sum+=(c-b)*t[b];
        ans[i]=sum;
        t[c]+=t[b];
        t[b]=0;
    }
    
    //for(int i=0;i<q;++i) cout<<ans[i]<<endl;
    for(int i=0;i<q;++i) printf("%lld \n",ans[i]);
}


Measured memory_bytes: 4828
while n = gets.to_i
  break if n.zero?
  teams = {}
  n.times do
    id, m1, s1, m2, s2, m3, s3, m4, s4 = gets.split.map(&:to_i)
    teams[id] = 60*(m1+m2+m3+m4) + (s1+s2+s3+s4)
  end
  result = teams.sort_by{|k,v| v}.map{|kv| kv.first}
  puts result[0]
  puts result[1]
  puts result[-2]
end

Measured memory_bytes: 6376
#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>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const ll inf = 1 << 30;
const ll mod = 1000000000 + 7;

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

	int a = 0;
	int b = 0;

	for (int i = 0; i < s.length(); i++)
	{
		if (s.substr(i, 1) == "0")
		{
			a++;
		}
		else
		{
			b++;
		}
	}

	cout << min(a, b) * 2 << endl;
}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

template <class T, class Op = multiplies<T>>
constexpr T power(T a, long long n, Op op = Op(), T e = {1}) {
  assert(n >= 0);
  while (n) {
    if (n & 1) e = op(e, a);
    if (n >>= 1) a = op(a, a);
  }
  return e;
}

template <unsigned M> struct modular {
  using m = modular;
  static constexpr unsigned mod = M;
  unsigned v;
  modular(long long x = 0) : v((x %= mod) < 0 ? x + mod : x) {}
  m operator-() const { return m() -= *this; }
  m& operator+=(m b) { if ((int)(v += b.v - mod) < 0) v += mod; return *this; }
  m& operator-=(m b) { if ((int)(v -= b.v) < 0) v += mod; return *this; }
  m& operator*=(m b) { v = (uint64_t)v * b.v % mod; return *this; }
  m& operator/=(m b) { return *this *= power(b, mod - 2); }
  friend m operator+(m a, m b) { return a += b; }
  friend m operator-(m a, m b) { return a -= b; }
  friend m operator*(m a, m b) { return a *= b; }
  friend m operator/(m a, m b) { return a /= b; }
  friend bool operator==(m a, m b) { return a.v == b.v; }
};

using mint = modular<power(10, 9) + 7>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, a, b;
  cin >> n >> a >> b;
  if (a > b) {
    swap(a, b);
  }
  vector f0(n + 1, vector<mint>(b));
  vector f1(n + 1, vector<mint>(b));
  vector<mint> g(n + 1);
  f1[n][0] = 1;
  g[n] = 1;
  vector cum(n + 1, vector<mint>(n + 1));
  for (int i = n; i--; ) {
    for (int x = a; x <= min(b - 1, n - i); ++x) {
      f0[i][x] += cum[i + x][i + a] - cum[i + x][i + x];
      f0[i][x] += x == n - i;
    }
    for (int x = 1; x <= min(b - 1, n - i); ++x) {
      if (x == 1) {
        f1[i][x] = g[i + 1];
      } else {
        f1[i][x] = f0[i + 1][x - 1] + f1[i + 1][x - 1];
      }
      f1[i][0] += f1[i][x];
      cum[i + x][i] = f1[i][x] + cum[i + x][i + 1];
    }
    for (int j = 1; j <= min(a - 1, n - i); ++j) {
      g[i] += f1[i + j][0];
    }
  }
  mint res = f1[0][0] + g[0];
  for (int x = 1; x < b; ++x) {
    res += f0[0][x];
  }
  res = power<mint>(2, n) - res;
  cout << res.v << '\n';
}


Measured memory_bytes: 296568
#include <iostream>

#define FOR(i , num) for(i = 0; i < num; i++)

using namespace std;

int main()
{
    int N;
    cin >> N;
    N = N % 10;
    switch(N)
    {
        case 3:
            cout << "bon" << endl;
        break;
        
        case 0:
        case 1:
        case 6:
        case 8:
            cout << "pon" << endl;
        break;
        default:
            cout << "hon" << endl;
    }    
    return 0;   
}

Measured memory_bytes: 3632