akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main() {
    ll x, k, d; cin >> x >> k >> d;
    x = abs(x);

    ll len = x % d;
    ll cnt = x / d;
    if(cnt > k){
        cout << abs(x - (k*d)) << endl;
        return 0;
    }

    if( k-cnt > 0  && (k-cnt) % 2 == 1){
        len -= d;
    }
    cout << abs(len) << endl;

}

/*
g++ c.cpp
./a.out

oj d https://atcoder.jp/contests/abc172/tasks/abc172_c
g++ c.cpp
oj t
*/


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

using namespace std;


int n, k;

int result(int n, int sep){
  int ret = 1;
  for(int i=0; i<n; ++i){
    if(i<sep){
      // operation A
      ret *= 2;
    }else{
      // operation B
      ret += k;
    }
  }
  return ret;
}
int main(){
  cin >> n >> k;

  vector<int> separations(n+2);
  for(int i=0; i<n+2; ++i){
    separations[i] = result(n, i);
  }
  
  cout << (*min_element(begin(separations), end(separations))) << endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

s = input().split()
print(s[0][0],s[1][0],s[2][0], sep="")

Measured memory_bytes: 3884
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 

int main(){
    fastio
    int n ; 
    int a , b ;
    cin >> n >> a >> b ; 
    cout << min(a*n,b) << endl;
    return 0 ;
}


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

int main() {

  int X, Y;
  cin >> X >> Y;
  
  for(int i = 0; i <= X; i++) {
    if(i*4 + (X-i)*2 == Y) {
      cout << "Yes" << endl;
      break;
    }    
    else if(i == X) cout << "No" << endl;
  }
}

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

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

	for (long long a = -500; a < 500; ++a) {
		for (long long b = -500; b < 500; ++b) {
			if (a * a * a * a * a - b * b * b * b * b == x) {
				cout << a << " " << b;
				return 0;
			}
		}
	}
	
	return 0;
}
	

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

#define FOR(i,a,b)  for(ll i=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll i=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      v.begin(), v.end()
#define UNIQ(v)     sort(ALL(v)); v.erase(unique(ALL(v)), v.end())
#define BIT(n)      (1LL<<(n))
#define DEBUG(a)    cerr << #a << " = " << a << endl

const int inf = 1001001001;
const int mod = (int)1e9+7;
//const ll inf = 1e15;
//const ll mod = 1e9+7;

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

int main() {
    ll A, B, N;
    cin >> A >> B >> N;

    //int mx = 0;
    //if (N < B) {
    //    mx = floor(A*N/B) - A*floor(N/B);
    //} else {
    //    REP(i, B) {
    //        int diff = floor(A*i/B) - A*floor(i/B);
    //        mx = max(mx, diff);
    //    }
    //}

    ll x = min(B-1, N);
    ll diff = A*x/B - A*(x/B);
    cout << diff << endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int h[2011];
bool cmp(int x,int y){
    return x > y;
}
int main(){
    int n;
    cin>>n;
    for(int i = 1;i <= n;i++){
        cin>>h[i];
    }
    sort(h + 1,h + n + 1,cmp);
    int ans = 0;
    for(int i = 1;i <= n;i++){
        for(int j = i + 1;j <= n;j++){
            for(int k = j + 1;k <= n;k++){
                if(h[i] < h[j] + h[k] && h[j] < h[i] + h[k] && h[k] < h[i] + h[j]){
                    ans++;
                }
                else break;
            }
        }
    }
    cout<<ans<<endl;
}

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

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

int main() {
  int n;
  long ans = 0;

  cin >> n;

  for (int i = 1; i < n + 1; i++) {
    for (int j = 1; j < n + 1; j++) {
      for (int k = 1; k < n + 1; k++) {
        ans += gcd(gcd(i, j), k);
      }
    }
  }

  cout << ans;

  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
long N;
void solve()
{
    int tag=0;
    for (long h=1;h<=3500;h++)
    {
        for (long n=1;n<=3500;n++)
        {
            long x=4*h*n-N*n-N*h,y=N*h*n;
            if (x>0&&y>=x&&y%x==0) {tag=1;cout<<h<<" "<<n<<" "<<y/x<<endl;break;}
        }
        if (tag) break;
    }
}
int main()
{
    while(cin>>N)
        solve();
}

Measured memory_bytes: 256
w, h, n = map(int, input().split())
a = [[0], [w], [0], [h]]
for _ in range(n):
    x, y, z = map(int, input().split())
    if z == 1 or z == 2:
        a[z-1].append(x)
    else:
        a[z-1].append(y)

dx = min(a[1]) - max(a[0])
dy = min(a[3]) - max(a[2])

if dx <= 0 or dy <= 0:
    print(0)
else:
    print(dx * dy)

Measured memory_bytes: 62480
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>

using namespace std;

#define INF 1000000007
#define LINF 1000000000000000007

typedef long long i64;
typedef pair<i64,i64> P;


i64 a;

int main(){
	cin >> a;
	
	i64 b = (i64)sqrt(a);
	if(b*b < a) b++;
	int x1,x2,x3,y1,y2,y3;
	
	more:
	x1 = 0; y1 = 0;
	int c = (b*b - a) / b + !!((b*b - a) % b);
	x2 = b; y2 = c;
	if(c == 0){
		x3 = b; y3 = b;
	}
	else{
		int d = (a - (b * b - c*b)) / c;
		d = b-d;
		if(b*b*2 - c*b - d*b - (b-d)*(b-c) != a){
			b++;
			goto more;
		}
		x3 = d; y3 = b;
	}
	cout << x1 << " " << y1 << " ";
	cout << x2 << " " << y2 << " ";
	cout << x3 << " " << y3 << endl;
	
	return 0;
}

Measured memory_bytes: 256
public class Main {

	public static void main(String[] args) {
		java.util.Scanner scanner = new java.util.Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		if (a < b && b < c) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	
					}
}

Measured memory_bytes: 26176
def the_sieve_of_eratosthenes(i):
    s = [j for j in range(2, i + 1)]
    j = 0
    while True:
        if j >= i - 3:
            for k in range(len(s) - 1, 0, -1):
                if s[k] == 0:
                    del s[k]
            return s
        if s[j] != 0:
            for k in range(2 * s[j] - 2, i - 1, s[j]):
                s[k] = 0
        j += 1

n = int(input())
p = the_sieve_of_eratosthenes(n)
c = [1] * len(p)
for i in range(2, n + 1):
    if not i in p:
        j = 0
        while True:
            if i == 1 or j == len(p):
                break
            if i % p[j] == 0:
                i /= p[j]
                c[j] += 1
            else:
                j += 1
a1, a2, a3, a4, a5 = 0, 0, 0, 0, 0
ans = 0
for i in c:
    if i >= 2:
        a1 += 1
    if i >= 4:
        a2 += 1
    if i >= 14:
        a3 += 1
    if i >= 24:
        a4 += 1
    if i >= 74:
        a5 += 1
ans = ((a1 - 2) * a2 * (a2 - 1) // 2) + (a2 - 1) * a3 + (a1 - 1) * a4 + a5
print(ans)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define ll long long
#define pi pair<int, int>
#define vi vector<int>
#define pll pair<ll, ll>
#define pb push_back
#define inf 1000000007
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	// int t;
	// cin>>t;
	// while(t--){
		
	// }
	ll n, d, a;
	cin>>n>>d>>a;
	vector<pll> p(n);
	for(int i = 0; i < n; i++){
		cin>>p[i].first>>p[i].second;
		p[i].second = (p[i].second + a - 1) / a;
	}
	sort(p.begin(), p.end());
	ll ans = 0;
	int j = 0;
	vector<ll> decr(n);
	ll sum = 0;
	for(int i = 0; i < n; i++){
		while(j < n && p[j].first <= 2 * d + p[i].first){
			j++;
		}
		p[i].second = max(0ll, p[i].second - sum);
		ans += p[i].second;
		decr[j - 1] += p[i].second;
		sum += p[i].second - decr[i];
	}
	cout<<ans<<endl;
	return 0;
}

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

#define int long long
#define MAX_N (300005)
#define INF (1LL<<60)
#define debug(x) cerr << #x <<":"<< x << endl;
#define debugVec(x) cerr << #x <<": "; for(auto p:(x)) cerr << p <<" "; cerr << endl;
#define debugVecPair(x) for(auto p:(x)) cerr << #x <<": "<< p.first <<", "<< p.second << endl;
#define debug2(x, y) cerr << #x <<" : "<< x <<", "<< #y <<" : "<< y << endl;
#define debug3(x, y, z) cerr << #x <<" : "<< x <<", "<< #y <<" : "<< y <<", "<< #z <<" : "<< z << endl;
const int MOD = (int)1e9+7;
typedef pair<int,int> P;

signed main() {
    int N;
    string S;
    cin >> N >> S;
    N = S.length();
    
    vector<int> csumw(N+1,0), csumb(N+1,0);
    for(int i=0; i<N; i++){
        if(S[i]=='#'){
            csumb[i+1] = csumb[i] + 1;
            csumw[i+1] = csumw[i];
        } else {
            csumb[i+1] = csumb[i];
            csumw[i+1] = csumw[i]+1;
        }
    }

    //debugVec(csumw);
    //debugVec(csumb);
    int ans=1e9;
    for(int i=0; i<=N; i++){
        int w, b;
        w = csumb[i] - csumb[0];
        b = csumw[N] - csumw[i];

        //debug3(i, w, b);
        ans = min(ans, w+b);
    }

    cout << ans << endl;
}

Measured memory_bytes: 3716
#include<cstdio>
#include<algorithm>

using namespace std;

// x ^ 5
long long f(long long x) {
  return x * x * x * x * x;
}

int g(int x) {
  for (int i = 0; i <= 177; i++) {

  }
  // error
  return 1000000000;
}

int x;
long long fp[200];

int main() {
  scanf("%d", &x);
  for (int i = 0; i <= 177; i++) {
    fp[i] = f(i);
  }
  long long a, b;
  for (int i = 0; i <= 177; i++) {
    if (binary_search(fp, fp + 177, llabs(x - fp[i]))) {
      a = i;
      if (x - fp[i] > 0) {
        b = -(lower_bound(fp, fp + 177, llabs(x - fp[i])) - fp);
      } else {
        b = lower_bound(fp, fp + 177, llabs(x - fp[i])) - fp;
      }
    }
  }
  printf("%lld %lld\n", a, b);
}


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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];

  int ans = INT_MIN;
  for (int l = 0; l <= n; ++l) {
    for (int r = 0; l + r <= n; ++r) {
      if (l + r > k) continue;

      vector<int> w;
      for (int i = 0; i < l; ++i) w.push_back(v[i]);
      for (int i = 0; i < r; ++i) w.push_back(v[n - 1 - i]);

      int sum = accumulate(w.begin(), w.end(), 0);
      sort(w.begin(), w.end());
      for (int i = 0; i < min(k - l - r, (int)w.size()); ++i)
        sum -= min(0, w[i]);
      ans = max(ans, sum);
    }
  }
  cout << ans << endl;
  return 0;
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		Console.WriteLine((G-R)*2 + R);
	}
	int R,G;
	public Sol(){
		R = ri();
		G = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    int N,M,X,Y;
    cin >> N >> M >> X >> Y;

    vector<int> x(N);
    vector<int> y(M);

    rep(i,N) cin >> x[i];
    rep(i,M) cin >> y[i];
    sort(all(x));
    sort(all(y));
    
    REP(i,X+1,Y+1)
    {
        if(x[x.size()-1] < i && i <= y[0] ) 
        {
            cout << "No War" << endl;
            return 0;
        }
    }
    cout << "War" << endl;
}


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

using namespace std;

using ll =  long long;

int main() {
    ll n, u, v;
    cin >> n;
    ll ans = (n * (n+1) * (2*n+1) / 6 + n * (n+1) / 2) / 2;
    for(int i=0;i<n-1;++i) {
        cin >> u >> v;
        if(u < v) ans -= u*(n-v+1);
        else ans -= v*(n-u+1);
    }
    cout << ans << endl;
}


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

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)

int main() {
    string s;
    int a[51];
    while(cin >> s) {
        memset(a, -1, sizeof(a));
        repr(i,s.length() - 1,0) {
            if(s[i] == 'I') a[i] = 1;
            else if(s[i] == 'V') a[i] = 5;
            else if(s[i] == 'X') a[i] = 10;
            else if(s[i] == 'L') a[i] = 50;
            else if(s[i] == 'C') a[i] = 100;
            else if(s[i] == 'D') a[i] = 500;
            else if(s[i] == 'M') a[i] = 1000;
        }

        int prev = -1, ret = 0;
        repr(i,s.length() - 1,0) {
            if(a[i] >= prev) {
                prev = a[i];
                ret += a[i];
            }
            else {
                ret -= a[i];
            }
        }

        cout << ret << endl;
    }
    return 0;
}

Measured memory_bytes: 1180
H,W=map(int,input().split())

mat=[]
for i in range(H):
  array=[x=="." for x in input()]
  mat.append(array)
#print(mat)

allW_row=[]
for i in range(H):
  allW_line=True
  for j in range(W):
    if not mat[i][j]:
      allW_line=False
      break
  allW_row.append(allW_line)
  
allW_col=[]
for j in range(W):
  allW_line=True
  for i in range(H):
    if not mat[i][j]:
      allW_line=False
      break
  allW_col.append(allW_line)
  
#print(allW_row)
#print(allW_col)
for i in range(H):
  if allW_row[i]:
    continue
    
  array_list=[]
  for j in range(W):
    if not allW_col[j]:
      if mat[i][j]:
        array_list.append(".")
      else:
        array_list.append("#")
  print("".join(array_list))

Measured memory_bytes: 3188
def main():
  x = 0
  n = int(input())
  a = list(map(int,(input().split())))
  for i in range(n-1):
    a1 = a[i:i+1]
    a2 = a[i+1:i+2]
#    print(a1,a2)
    if a1 > a2:
#      print(a1,a2,a1[0]-a2[0])
      sa = a1[0]-a2[0]
      x +=(sa)
      a[i+1]+=sa
  if a[n-2] > a[n-1]:
    x +=a[n-2][0]-a[n-1][0]
  print(x)  

if __name__ == '__main__':
  main()

Measured memory_bytes: 32100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

#define MAX 55555

vector<bool> pr(MAX,true);
void era() {
	pr[0] = false;
	pr[1] = false;
	for (int i = 0 ; i*i<MAX ; i++) {
		if (pr[i]) {
			for (int j = i*i; j < MAX; j = j + i) {
				pr[j] = false;
			}
		}
	}
}


int main() {
	era();
	int n;
	cin >> n;
	vi v;
	rep(i,MAX) {
		if (pr[i]&&i%5==1)v.push_back(i);
	}
	rep(i, n) {
		cout << v[i];
		cout << (i != n - 1 ? " " : "");
	}
	cout << endl;
	
}

Measured memory_bytes: 256
n = int(input())
t,a = map(int,input().split())
l = list(map(int,input().split()))
ans = 5000
count = 0
for i in range(n):
  x = t-0.006*l[i]
  if ans > abs(a-x):
    ans = abs(a-x)
    count = i+1
print(count)

Measured memory_bytes: 3060
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    vector<int> p;
    int num, idx, n = 1000001, i = 1;
    while (i < n) {
        i*=2;
        p.push_back(i);
    }
    scanf("%d", &num);
    idx = upper_bound(p.begin(), p.end(), num)-p.begin()-1;
    printf("%d\n", p[idx]);
    return 0;
}



Measured memory_bytes: 2792
#include<iostream>
#include<string>
#include<vector>

int main() {
	std::vector<std::vector<char>>tab;
	int w, h;
	std::cin >> h >> w;

	tab.resize(h);
	for (auto&e : tab)
		e.resize(w);

	for (auto& e : tab) 
		for (auto&ee : e) 
			std::cin >> ee;
		

	bool enable = true;
	for (int wi{}; wi < w; ++wi) {
		//if (!enable) break;
		//std::cout << wi<<" ";
		for (int hi{}; hi < h; ++hi) {

			//std::cout << hi<<"\n";
			if (tab[hi][wi] != '#')
				continue;

			bool alone = true;
			if (hi - 1 >= 0)
				alone &= tab[hi - 1][wi] != '#';

			if (hi + 1 < h)
				alone &= tab[hi + 1][wi] != '#';

			if (wi - 1 >= 0)
				alone &= tab[hi][wi - 1] != '#';

			if (wi + 1 < w)
				alone &= tab[hi][wi + 1] != '#';

			//std::cout << "Alone:" << (alone ? "true" : "false") << "\n";

			enable &= !alone;
		}
	}
		
	std::cout << (enable ? "Yes" : "No") << "\n";
	return 0;
}

Measured memory_bytes: 256
import math

def isPrime(x) :
    if x == 2 :
        return True

    if x < 2 or x % 2 == 0 :
        return False

    i = 3
    while i <= math.sqrt(x) :
        if x % i == 0 :
            return False
        i += 2

    return True


def main() :
    n = int(input())
    nums = []
    for i in range(n) :
        x = int(input())
        nums.append(x)

    count = 0
    for num in nums :
        if isPrime(num) :
            count += 1

    print(count)


if __name__ == '__main__' :
    main()

Measured memory_bytes: 8196
a, b = map(int,input().split())
list1 = list(range(1,b+1))
list2 = []
for i in range(a):
  c = list(map(int, input().split()))
  d = c[1:]
  for j in d:
    if j in list1:
      list2.append(j)
    else:
      continue     
  list1 = list2.copy()
  list2.clear()
print(len(list1))    

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    string s;
    ll w;
    cin >> s >> w;
    rep(i, s.size()) {
        if(i%w == 0) {
            cout << s[i];
        }
    }

    cout << endl;
    re0;
}

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

int main()
{
  int64_t N, M, a, sum = 0, cnt = 0;
  cin >> N >> M;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++)
  {
    cin >> a;
    sum += a;
    A.at(i) = a;
  }
  double b = 4 * M;
  double l = sum / b;
  int64_t lim = ceil(l);
  for (int i = 0; i < N; i++)
  {
    if (A.at(i) >= lim)
    {
      cnt++;
    }
  }
  cout << (cnt >= M ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl

const ll INF=1e9+7;
const ll N = 302;
ll n,k,ans;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>k;
	ans=k;
	FOR(i,0,n-1){
		ans*=(k-1);
	}
	pri(ans);
	return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

const int INF = int(1e9);
int d[1 << 26];
string s;
int n;

int main() {
    ios_base::sync_with_stdio(false);
    cin >> s;
    n = (int)s.size();
    forn(i, 1 << 26) d[i] = INF;
    d[0] = 0;
    int mask = 0;
    forn(i, n) {
        mask ^= 1 << int(s[i] - 'a');
        int res = d[mask] + 1;
        forn(j, 26) {
            res = min(res, d[mask ^ (1 << j)] + 1);
        }
        d[mask] = min(d[mask], res);
        if (i == n - 1) {
            cout << res << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 262804
def main():
    n, ma, mb = map(int, input().split())
    ABC = []
    for i in range(n):
        a, b, c = map(int, input().split())
        ABC.append((a, b, c))

    INF = 10**18
    dp = [[[INF]*405 for i in range(405)] for j in range(n+1)]
    dp[0][0][0] = 0
    for i in range(n):
        a, b, c = ABC[i]
        for j in range(405):
            for k in range(405):
                dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k])
                nj, nk = j+a, k+b
                if 1 <= nj <= 404 and 1 <= nk <= 404:
                    dp[i+1][nj][nk] = min(dp[i][nj][nk], dp[i][j][k]+c)

    import fractions
    ans = INF
    for j in range(1, 405):
        for k in range(1, 405):
            if ma*k == mb*j:
                ans = min(ans, dp[n][j][k])
    if ans == INF:
        print(-1)
    else:
        print(ans)

if __name__ == '__main__':
    main()


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

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

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

    // start
    int a, b;
    cin >> a >> b;
    cout << (a + b) % 24 << endl;
    // end

    return 0;
}


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

int main()
{
    long long int L, R;
    std::cin >> L >> R;

    int ans = 2019;
    for(long long int i = L; i < R; i++)
    {
        for(long long int j = i + 1; j <= R; j++)
        {
            int x = i * j % 2019;
            ans = std::min(ans, x);

            if(ans == 0)
            {
                goto res;
            }
        }
    }

    res:
    std::cout << ans << std::endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
const ll MOD = (ll)1e9+7;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

int n;
vector<double> p;
vector<double> sump;
vector<double> q;
vector<double> sumq;
vvector<double> dp;

double func(int l, int r){
	if(r<l)return 0;
	if(l==r){
		return p[l] + 2 * q[l-1] + 2 * q[l];
	}
	if(dp[l][r] >= 0)return dp[l][r];
	double res = INFLL;
	chmin(res, q[l-1]*2+p[l]+func(l+1, r)+sump[r]-sump[l]+sumq[r]-sumq[l-1]);
	chmin(res, q[r]*2+p[r]+func(l, r-1)+sump[r-1]-sump[l-1]+sumq[r-1]-sumq[l-2]);
	for(int mid=l+1;mid<r;++mid){
		double midsum = p[mid];
		double leftsum = func(l, mid-1) + sump[mid-1] - sump[l-1] + sumq[mid-1] - sumq[l-2];
		double rightsum = func(mid+1, r) + sump[r] - sump[mid] + sumq[r] - sumq[mid-1];
		chmin(res, midsum+leftsum+rightsum);
	}
	return dp[l][r] = res;
}

int main(){
	cin >> n;
	p.resize(n+2);
	q.resize(n+3);
	sump.resize(n+3, 0);
	sumq.resize(n+4, 0);
	for(int i=2;i<n+2;++i){
		cin >> p[i];
		sump[i] = sump[i-1] + p[i];
	}
	for(int i=1;i<n+2;++i){
		cin >> q[i];
		sumq[i] = sumq[i-1] + q[i];
	}
	dp.resize(n+2, vector<double>(n+2, -1));
	printf("%.8lf\n", func(2, n+1));
	return 0;
}



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

using namespace std;

using ll = long long;

int arr[2][100];
bool seen[2][100];

int n;
bool valid(int i, int j) {
  return i >= 0 && i < 2 && j >= 0 && j < n;
}

int ans;
int dfs(int i, int j) {
  if (i == 1 && j == n - 1) return arr[i][j];
  if (!valid(i, j)) return 0;
  return arr[i][j] + max(dfs(i + 1, j), dfs(i, j + 1));
}

int main() {
  cin >> n;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < n; j++) {
      cin >> arr[i][j];
    }
  }
  cout << dfs(0, 0);
  return 0;
}


Measured memory_bytes: 256
k, s = gets.split.map(&:to_i)

ans = 0
0.upto(k) do |x|
  0.upto(k) do |y|
    z = s - (x + y)

    ans += 1 if (z >= 0 && z <= k) && x + y + z == s
  end
end

puts ans


Measured memory_bytes: 1788
#include <iostream>

using namespace std;

int min(int a,int b)
{
	if(a<b)
	{
		return a;
	}
	else
	{
		return b;
	}
}
int main()
{
	int a,b;
	cin>>a>>b;
	int amin = a*25;
	amin /= 2;
	if(a%2==1)
	{
		amin++;
	}
	int amax = (a+1)*25;
	amax /= 2;
	int bmin = b*10;
	int bmax = (b+1)*10;
	int ans = 10000;
	if(amin<bmax)
	{
		if(bmin<amin)
		{
			ans=min(ans,amin);
		}
		if(amin<=bmin)
		{
			ans=min(ans,bmin);
		}
	}
	if(bmin<amax)
	{
		if(amin<bmin)
		{
			ans = min(ans,bmin);
		}
		if(bmin<=amin)
		{
			ans = min(ans,amin);
		}
	}
	if(amax<=bmin||bmax<=amin)
	{
		ans = min(ans,-1);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
use std::io::stdin;

fn main() {
    let mut st = String::new();
    stdin().read_line(&mut st).unwrap();
    let s:Vec<char> = st.trim().chars().collect();
    let mut start:usize = 0;
    let mut end:usize = 1;
    let mut result: i64 = 1;
    for i in 1..(s.len()) {
        if s[start..end] != s[end..i+1] {
            start = end;
            end = i+1;
            result += 1;
        };
    };
    println!("{}", result);
}

Measured memory_bytes: 4352
a = list(map(int, input().split()))
x = 0
y = 0
for i in range(0,a[1]):
    x = x + a[0]*(10**i)
for i in range(0,a[0]):
    y = y + a[1]*(10**i)
if x<=y:
    print(y)
else:
    print(x)

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

using namespace std;

int level[500][500];

void printVec(vector<int> a) {
	for (int x : a) {
		cout << x << ' ';
	}
	cout << endl;
}

int main() {
	int n;
	long long k;
	long long mo = 1000000000 + 7;
	cin >> n >> k;
	vector<int> a(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		int x = a[i];
		long long p = 0, q = 0;
		for (int j = 0; j < n; j++) {
			int y = a[j];
			if (x > y) {
				p++;
				if (i < j) {
					q++;
				}
			}
		}
		ans = (ans + (q * k) % mo) % mo;
		long long t = (k * (k - 1)) / 2;
		ans = (ans + (p * (t % mo)) % mo) % mo;
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

signed main(void){
    int H,W;
    cin >> H >> W;
    if(H==1 || W==1){
        cout << 1 << endl;
        return 0;
    }
    if(H%2==0 || W%2==0){
        cout << H*W/2 << endl;
        return 0;
    }
    cout << (H*W+1)/2 << endl;
    
    return 0;
}



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

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

    int s = 0;
    int t = S.size() - 1;

    int ans = 0;
    bool ok = true;    
    while (s < t) {
        if (S.at(s) == S.at(t)) {
            s++;
            t--;
        } else if (S.at(s) != 'x' && S.at(t) != 'x') {
            ok = false;
            break;
        } else if (S.at(s) == 'x') {
            s++;
            ans++;
        } else if (S.at(t) == 'x') {
            t--;
            ans++;
        } else {
            puts("error");
            return 1;
        }
    }

    cout << (ok ? ans : -1) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
pair<long,int> Je[200000];
vector<long> G[100000];
vector<long> G2[100000];
pair<long,int> O[100000];
int MaxThree[100000];
long ans[200001];
void Calc(){
	int N = rei();
	int K = rei();
	for(int i=0;i<N;i++){
		int c = rei()-1;
		long v = rei();
		Je[i] = {v*2,c};
	}
	sort(Je,Je+N);
	for(int i=N-1;i>=0;i--){
		G2[Je[i].second].push_back(Je[i].first);	
	}
	for(int i=0;i<K;i++){
		O[i] = {-G2[i][0]-G2[i][1],i};
		G2[i][0] = (G2[i][0]+G2[i][1])/2;
		G2[i][1] = G2[i][0];
	}
	sort(O,O+K);
	for(int i=0;i<K;i++){
		G[i] = G2[O[i].second];
	}
	MaxThree[K-1] = K;
	MaxThree[K] = K;
	for(int i=K-2;i>=0;i--){
		MaxThree[i] = MaxThree[i+1];
		if(G[i+1].size() >= 3 && (MaxThree[i] == K || G[i+1][0]+G[i+1][1]+G[i+1][2] >= G[MaxThree[i]][0]+G[MaxThree[i]][1]+G[MaxThree[i]][2])){
			MaxThree[i] = i+1;
		}
	}
	fill(ans,ans+N,-2);
	priority_queue<long> X;
	if(MaxThree[0] != K){
		ans[3] = G[MaxThree[0]][0] + G[MaxThree[0]][1] + G[MaxThree[0]][2];
	}
	long sum = G[0][0]+G[0][1];
	long min = 10000000000000000;
	for(int i=2;i<G[0].size();i++){
		X.push(G[0][i]);
	}
	ans[2] = sum;
	if(MaxThree[0] != K && N >= 5){
		ans[5] = sum + G[MaxThree[0]][0] + G[MaxThree[0]][1] + G[MaxThree[0]][2];
	}
	int p = 1;
	bool wait = false;
	for(int c=3;c<=N;c++){
		if(X.empty() && min == 10000000000000000){
			if(wait){
				wait = false;
				sum += G[p][0] + G[p][1];
				for(int i=2;i<G[p].size();i++){
					X.push(G[p][i]);
				}
				p++;
			}
			else{
				wait = true;
				continue;
			}
		}
		else{
			if(p < K && (X.empty() || min + X.top() < G[p][0] + G[p][1])){
				sum += G[p][0] + G[p][1] - min;
				X.push(min);
				min = 10000000000000000;
				for(int i=2;i<G[p].size();i++){
					X.push(G[p][i]);
				}
				p++;
			}
			else{
				sum += X.top();
				min = X.top();
				X.pop();
			}
		}
		ans[c] = max(ans[c],sum);
		if(c+3 <= N && MaxThree[p] != K){
			ans[c+3] = max(ans[c+3],sum + G[MaxThree[p]][0] + G[MaxThree[p]][1] + G[MaxThree[p]][2]);
		}
	}
	for(int i=1;i<=N;i++){
		cout << ans[i]/2 << "\n";
	}
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 20736
import java.util.Scanner;

public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] values = new int[w];
		for(int i = 0;i<values.length;i++){
			values[i]=i+1;
		}
		for(int i=0;i<n;i++){
			String str = sc.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0])-1;
			int b = Integer.parseInt(ab[1])-1;
			int c = values[a];
			values[a] = values[b];
			values[b] = c; 
		}
		for(int i = 0;i<values.length;i++){
			System.out.printf("%d\n",values[i]);
		}
	}
}

Measured memory_bytes: 17232
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
 
const ll mod=1e9+7;
 
ll n;long double p[10000000];
long double dp[3001][3001];
map<pair<ll,ll> ,double> m;
long double solve(ll c=0,ll d=0){
    // Base Case
    // dp[i][j] represents the probability of having j heads from first i tossed coins
    dp[1][0]=(1-p[0]);
    dp[1][1]=p[0];
    
    for(ll i=2;i<=n;i++){
        for(ll j=0;j<=n;j++){
            if(j>i)break;
            else{
                if(j==0){
                    dp[i][j]=dp[i-1][j]*(1-p[i-1]);
                }
                else
                    dp[i][j]=dp[i-1][j]*(1-p[i-1])+dp[i-1][j-1]*(p[i-1]);
            }
        }
    }
    long double ans=0;
    for(ll i=1;i<=n;i++){
        if(i>n-i)
            ans+=dp[n][i];
    }
    return ans;
}
 
int main() {
    cin>>n;
    memset(dp,0,sizeof(dp));
    for(ll i=0;i<n;i++){
        cin>>p[i];
    }    
 
    long double ans=solve();
    cout<<fixed<<setprecision(10)<<ans<<endl;
 
}

Measured memory_bytes: 141568
#include <bits/stdc++.h>
#define LL long long
#define mp make_pair
#define pb push_back
#define INF (1<<29)
using namespace std;
typedef pair<int,int>pii;
int n;
int main(){
	cin>>n;
	if(n<1200){
		puts("ABC");
	}else if(n<2800)puts("ARC");
	else puts("AGC");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll pair<ll,ll>
#define mp make_pair
#define bp __builtin_popcountll
#define MOD  1000000007
const int N = 200005;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));

void solve()
{
     ll n;
     cin >> n;
     map<string,bool> y;
     for(ll i=0;i<n;i++)
     {
          string s;
          cin >> s;
          y[s] = 1;
     }
     cout<<y.size();
}

int main()
{
     FAST;
     ll t = 1;
   //  cin >> t;
     while(t--)
     {
          solve();
     }
}

Measured memory_bytes: 19272
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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








int main(){
    int N; std::cin >> N;
    std::vector<int> A(N), cnt(1'000'001, 0);
    for(int i(0); i < N; ++i){
        std::cin >> A[i];
        ++cnt[A[i]];
    }
    int ans(0);
    for(int i(0); i < N; ++i){
        if(cnt[A[i]] > 1) continue;
        if(A[i] == 1){
            ++ans;
            continue;
        }
        bool okay(true);
        for(int j(1); j*j <= A[i]; ++j){
            if(!(A[i] % j)){
                if(cnt[j]){
                    okay = false; break;
                }
                if(j != 1 && cnt[A[i]/j]){
                    okay = false; break;
                }
            }
        }
        if(okay) ++ans;
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 8004
#include <iostream>
#include <string>

int main()
{
  int s,w;
  std::string result;
  
  std::cin>>s>>w;
  
  if(s<=w)
  {
    result="unsafe";
  }
  else
  {
    result="safe";
  }
  
  std::cout<<result<<std::endl;
  
  return 0;
}

Measured memory_bytes: 3640
/*bismillah ->                                                                                                         << Suirkhanov Meyirlan >>
  GL HF


                                                                                                                      42

    bless my code =)
                                                                                                            NEVER FOLLOW YOUR RULES :D HAHAHAHA
*/


///scanf ("%d%d", &x, &y);
///printf("%d", &a)

#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define pii pair < int , int >
#define pll pair < ll, ll >
#define pb push_back
#define pf psuh_front
#define mp make_pair
#define fi first
#define se second
#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define eb emplace_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll N = 2 * 1e3 + 7;
const ld pi = 3.14159265359;
const int INF = 1e20 + 7;
const double eps = 1e-9;

const int xi[4] = {-1, 0, +1, 0};
const int yj[4] = {0, +1, 0, -1};
const int xxi[4] = {+1, 0, -1, 0};
const int yyj[4] = {0, -1, 0, +1};

int a[N], n, cnt5, cnt7;

int main(){

  //freopen("bridge.in", "r", stdin);
  //freopen("bridge.out", "w", stdout);

  fast
  randoperation;

  ///           ||
  ///start here \/

  for(int i = 1; i <=  3; i++){
    cin >> a[i];
    if(a[i] == 5){
      cnt5++;
    }
    else if(a[i] == 7){
      cnt7++;
    }
  }

  if(cnt5 == 2 && cnt7 == 1){
    cout << "YES";
  }
  else{
    cout << "NO";
  }
}


Measured memory_bytes: 384
#include <iostream>
#include <string>

int main(){
    std::string S, ans;
    std::cin >> S;

    std::string mon = S.substr(5, 2);
    
    if(mon == "01" || mon == "02" || mon == "03" || mon == "04"){
        ans = "Heisei";
    }
    else{
        ans = "TBD";
    }

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


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		var A = new int[32]{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
		WriteLine(A[GetInt() - 1]);
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

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

int main(){
  int N;
  cin >> N;
  vector <int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  int n=0;
  bool flag=true;
  while(flag){
    for(int i=0;i<N;i++){
      if(A.at(i)%2!=0){
        flag=false;
        break;
      }
      A.at(i)=A.at(i)/2;
    }
    if(flag){
      n++;
    }
  }
  cout << n << endl;
  return 0;
}


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

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i =0;i<n;i++)cin >> a[i];
	sort(a.begin(),a.end(),greater<int>());
	ll tate = 0;
	for(int i = 0;i<n;i++)
	{
		if(tate&&a[i]==a[i+1])
		{
			cout<<tate*a[i]<<endl;
			return 0;
		}
		if(a[i]==a[i+1])
		{
			tate = a[i];
			i++;
		}
		
	}
	cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
typedef long long ll;
ll h, w, mn;

ll f(ll p, ll q, ll r) {
	ll x = max(p, max(q, r));
	ll y = min(p, min(q, r));
	return min(mn, x-y);
}

int main() {
	cin >> h >> w;
	mn = h*w%3 ? min(h,w) : 0;
	for (ll i=1; i<h; i++) mn = f(i*w, (h-i)*(w/2), (h-i)*(w-w/2));
	for (ll i=1; i<w; i++) mn = f(i*h, (w-i)*(h/2), (w-i)*(h-h/2));
	cout << mn;
	return 0;
}


Measured memory_bytes: 256
h={};("0%b"%gets[/\d+$/]).scan(/./){h[eval"0b#$`0".+$&<?1?$':?1*$'.size]=0};p$<.map{|s|a,b=s.split.map &:to_i;h.map{|k,_|h[k]+=a|k>k ?0:b}.max}.max

Measured memory_bytes: 2744
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
      string s1,s2,s3;
      cin>>s1>>s2>>s3;
      char dif='A'-'a';
      s1[0]+=dif;
      s2[0]+=dif;
      s3[0]+=dif;
      cout<<s1[0]<<s2[0]<<s3[0]<<endl;
      return 0;
      
    }

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        int i,j;
        
        Scanner sc=new Scanner(System.in);
        
        String str;
        Character c;
        int sum;
        
        while(true){
            str=sc.next();
            if(str.equals("0"))break;
            
            sum=0;
            for(i=0;i<str.length();i++){
                c=str.charAt(i);
                sum+=c-'0';
            }
            
            System.out.println(sum);
        }
    }
}



Measured memory_bytes: 26376
#include <stdio.h>



#ifndef DEBUG 
#define fprintf (void)
#endif 

double absval(double x);

int main(void){

	double x1,y1,x2,y2;
	double b=0;
	int n;
	scanf("%lf", &x1);
	scanf("%lf", &y1);
	scanf("%lf", &x2);
	scanf("%lf", &y2);
	double dx=absval(x1-x2);
	double dy=absval(y1-y2);
	
	double x=dx*dx+dy*dy;
	fprintf(stdout,"%lf\n",x);
	
	scanf("%d",&n);
	
	while(b*b<x){
		b++;
	}
	while(absval(b*b-x)>0.0001){
		b=(b*b+x)/(2*b);
		fprintf(stdout,"%f\n",b);
	}	
	printf("%f\n", b);
	
	return 0;
}

double absval(double x){
	if(x<0){
		return -x;
	}else{
		return x;
	}
}

Measured memory_bytes: 2736
n=int(input())
taro = 0
hana = 0
for i in range(n):
    val = list(input().split())
    if val[0]<val[1]:
        hana += 3
    elif val[0]>val[1]:
        taro += 3
    else:
        taro += 1
        hana += 1
print(taro,hana,sep=' ')
    


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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

ll n;
ll a[101010];
ll b[101010];
set<ll> st;
bool used[101010];

int main(){
  cin>>n;
  rep(i,n){
    cin>>a[i];
  }
  rep(i,n){
    cin>>b[i];
    st.insert(b[i]);
  }
  if(st.size()==n){
    cout<<"Yes"<<endl;
    return 0;
  }
  for(ll h : st){
    used[h]=true;
  }
  vector<P> res;
  repl(i,1,n+1){
    if(!used[i]){
      res.push_back(P(1,2));
    }else{
      res.push_back(P(1,1));
    }
  }
  cout<<"No"<<endl;
  cout<<res[a[0]-1].fi;
  repl(i,1,n){
    cout<<" "<<res[a[i]-1].fi;
  }
  cout<<endl;
  cout<<res[a[0]-1].se;
  repl(i,1,n){
    cout<<" "<<res[a[i]-1].se;
  }
  cout<<endl;
  return 0;
}



Measured memory_bytes: 10448
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

ll exor(ll n){
    if(!(n%4)) return n;
    if(n%4 == 1) return 1;
    if(n%4 == 2) return 1^n;
    else return 0;
}

int main(){
    ll a, b; cin >> a >> b;
    cout << (exor((a ? a-1 : 0)) ^ exor(b)) << "\n";
    return 0;
}

Measured memory_bytes: 256