akhauriyash/Code-Regression huggingface dataset:
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <iostream>
//end of libraries ;
#define INF 99999999
#define N 3000003
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
int gcd(int x , int y){
	if(x > y) swap(x,y);
	if(x==0) return y;
	return gcd(y%x , x);
}
int ans = 0;
int main(){
fcin;
	int k ; 
	cin >> k;
	for(int i = 1 ; i <= k ; i++){
		for(int j = 1 ; j <= k ; j++){
			for(int q = 1 ; q <= k ; q++){
				ans += gcd(q, gcd(i,j));
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3640
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef long double lb; 

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


int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N){
        cin >> A[i];
    }

    ll ans=0;
    while (true){
        rep(i,N){
            if(A[i] % 2 == 0){
                A[i] /= 2;
            }else{
                cout << ans << endl;
                return 0;
            }

            if(i == N-1){
                ans++;
            }
        }
    }
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        char[] ch = strToCharArray(sc.nextLine());
        boolean yesFlg = true;
        
        for(int i = 0; i < ch.length; i++) {
        	int count = 0;
        	for(int j = 0; j < ch.length; j++) {
        		if(ch[i] == ch[j]) {
        			count++;
        		}
        	}
        	if(count % 2 != 0) {
        		System.out.println("No");
        		yesFlg = false;
        		break;
        	}
        }
        if(yesFlg) System.out.println("Yes");
    }

    static String[] strCompare(String[] array) {
    	Arrays.sort(array, new Comparator<String>() {
    		public int compare(String s1, String s2) {
    			if(compareLength(s1, s2) == 0) {
    				return s1.compareTo(s2);
    			}
    			return compareLength(s1, s2);
    		}
    	});
    	return array;
    }

    static int compareLength(String s1, String s2) {
    	if(s1.length() > s2.length()) {
    		return 1;
    	} else if (s1.length() < s2.length()) {
    		return -1;
    	} else {
    		return 0;
    	}
    }
    
    static String[] strCompareReverse(String[] array) {
    	Arrays.sort(array, new Comparator<String>() {
    		public int compare(String s2, String s1) {
    			if(compareLengthReverse(s1, s2) == 0) {
    				return s1.compareTo(s2);
    			}
    			return compareLengthReverse(s1, s2);
    		}
    	});
    	return array;
    }

    static int compareLengthReverse(String s1, String s2) {
    	if(s1.length() > s2.length()) {
    		return 1;
    	} else if (s1.length() < s2.length()) {
    		return -1;
    	} else {
    		return 0;
    	}
    }

    static int[] toIntArray(String[] str) {
    	int[] num = new int[str.length];
    	for(int i = 0; i < str.length; i++) {
    		num[i] = Integer.parseInt(str[i]);
    	}
    	return num;
    }

    static char[] strToCharArray(String str) {
    	char[] chAr = new char[str.length()];
    	chAr = str.toCharArray();
    	return chAr;
    }


    static String[] toStringArray(String str, String delim) {
    	String[] stAr = str.split(delim);
    	return stAr;
    }

    static int[] strToIntArray(String str, String delim) {
    	String[] strAr = str.split(delim);
    	int[] intAr = new int[strAr.length];
    	for(int i = 0; i < strAr.length; i++) {
    		intAr[i] = Integer.parseInt(strAr[i]);
    	}
    	return intAr;
    }

    static int toInt(String str) {
    	int num = Integer.parseInt(str);
    	return num;
    }

    static double[] strToDoubleArray(String str, String delim) {
    	String[] strAr = str.split(delim);
    	double[] dAr = new double[str.length()];
    	for(int i = 0; i < strAr.length; i++) {
    		dAr[i] = Double.parseDouble(strAr[i]);
    	}
    	return dAr;

    }
}

Measured memory_bytes: 21844
-- | Main entry point to the application.
module Main where

import Control.Applicative
import Control.Monad
import Data.List
import Debug.Trace
import Text.Printf

rInt :: String -> Int
rInt str = read str :: Int

-- | The main entry point.
main :: IO ()
main = do
    --[w, h, x, y, r] <- (map rInt . words) <$> getLine
    s <- getContents
    let lst = map rInt $ lines s
    forM_ [0..(length lst - 2)] $ \i -> do
        printf "Case %d: %d\n" (i+1) (lst !! i)

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

ll dp[110][2][4]; // dp[i][j][k] : i:見た文字数, j:smaller?, k: 0でない数字の個数

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

    dp[0][0][0] = 1;
    rep(i, S.size()) {
        rep(j, 2) {
            rep(k, 4) {
                int nd = S[i] - '0';
                rep(d, 10) {
                    int ni = i + 1, nj = j, nk = k;
                    if (d != 0) nk++;
                    if (nk > K) continue;
                    if (j == 0) {
                        if (d > nd) continue;
                        if (d < nd) nj = 1;
                    }
                    dp[ni][nj][nk] += dp[i][j][k];
                }
            }
        }
    }

    cout << dp[S.size()][0][K] + dp[S.size()][1][K] << endl;
}


Measured memory_bytes: 256
import Control.Applicative
import qualified Data.Map as Map
import Data.List

main = do
    q <- readLn
    queries <- sequence $ replicate q (map read . words <$> getLine)
    mapM_ print $ map (\[a,b]->solve a b) queries

{-
f = x * (sum - x) の最大値を求める。つまり、対向等差数列 start, start + 1, ... ,endおよびsum - start, sum - start - 1, ... , sum - end
の積の最大値を求める。公差は1に固定されている。
start : xの初期値
end : xの最終値
-}
oppArith :: Integer -> Integer -> Integer -> Integer
oppArith sum start end | center < s = f s
                       | center > e = f e
                       | otherwise = f center
                       where f x = x * (sum - x)
                             center = div sum 2
                             s = min start end
                             e = max start end

solve :: Integer -> Integer -> Integer
solve a b = bsearch g 0 (2*b')
    where a' = min a b
          b' = max a b
          g = f a' b'

{-
judge : 整数を与えられたときに真偽を返す関数。
この関数がTrueを返すような最大の整数を返却する。
left : 探索域の最小値。judge left = Trueであることが必要。
right : 探索域の最大値。judge right = Falseであることが必要。
-}
bsearch :: (Integer->Bool)->Integer->Integer->Integer
bsearch judge left right | right == left + 1 = left
                         | right <= left = left
                         | otherwise = if judge mid 
                                       then bsearch judge mid right
                                       else bsearch judge left mid
                         where mid = div (right+left) 2

{-
a <= bであることを前提として、高橋君よりもスコアの良い人がx人つくれるときにTrueを返し、そうでないときにFalseを返す。
-}
f :: Integer->Integer->Integer->Bool
f a b x | x < a = oppArith (x+1) 1 x < a*b
        | a <= x && x < b = max (oppArith (x+1) 1 (a-1)) (oppArith (x+2) (x-a+1) 1) < a*b
        | x >= b && x > a+b-2 = maximum [c1,c2,c3] < a*b
        | x >= b && x < a+b-2 = maximum [c4,c5,c6] < a*b
        | x >= b && x == a+b-2 = max (oppArith (x+2) 1 (a-1)) (oppArith (x+2) (b-1) 1) < a*b
        where c1 = oppArith (x+2) 1 (a-1)
              c2 = oppArith (x+3) (a+1) (x-b+2)
              c3 = oppArith (x+2) (b-1) 1
              c4 = oppArith (x+2) 1 (x-b+1)
              c5 = oppArith (x+1) (x-b+2) (a-1)
              c6 = oppArith (x+2) (x-a+1) 1


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

int main (){
    char A[2];
    cin >> A[0] >> A[1];
    if (A[0] == A[1]){cout << "=\n";}
    else if (A[0] > A[1]){cout << ">\n";}
    else {cout << "<\n";}
    return 0;
}

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

using namespace std;

int abs(int n){
    if (n < 0){
        n = -1 * n;
    }
    return n;
}

int minimum(int a, int b){
    int ans = a;
    if (a > b){
        ans = b;
    }
    return ans;
}

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

    vector <int> A(N);
    for (int i = 0; i < N; i++){
        int a;
        cin >> a;
        A[i] = a - (i + 1);
    }
    
    sort(A.begin(), A.end());

    long long ans = 0;
    if (N % 2 == 0){
        int b1, b2;
        b1 = A[N / 2 - 1];
        b2 = A[N / 2];

        for (int i = 0; i < N; i++){
            ans += abs(A[i] - b1);
        }
        for (int i = b1; i <= b2; i++){
            long long sum = 0;
            for (int j = 0; j < N; j++){
                sum += abs(A[j] - i);
            }
            if (ans > sum){
                ans = sum;
            }
        }
    }else{
        int b;
        b = A[N / 2];
        for (int i = 0; i < N; i++){
            ans += abs(A[i] - b);
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <cmath>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

const double EPSILON = 1e-10;

const double g = 9.8;

const int N = 50 + 5;

struct Point {
  double x, y;
  Point(double x, double y): x(x), y(y) {}
};

static int n;

double L[N], B[N], R[N], T[N];

int dcmp(double x, double y) {
  if (fabs(x - y) < EPSILON) {
    return 0;
  }
  return x < y ? -1 : 1;
}

double farthest_x(double a, double b) {
  double x_t = -b / a;

  for (int i = 0; i < n; ++i) {
    double y0 = a * L[i] * L[i] + b * L[i];
    if (dcmp(B[i], y0) < 0 && dcmp(y0, T[i]) < 0) {
      x_t = min(x_t, L[i]);
    }

    double delta = b * b + 4 * a * B[i];
    if (dcmp(delta, 0.0) > 0) {
      double x0 = (-b + sqrt(delta)) / (2 * a);
      if (dcmp(L[i], x0) <= 0 && dcmp(x0, R[i]) < 0) {
        x_t = min(x_t, x0);
      }
    }

    delta = b * b + 4 * a * T[i];
    if (dcmp(delta, 0.0) >= 0) {
      double x1 = (-b - sqrt(delta)) / (2 * a);
      if (dcmp(L[i], x1) <= 0 && dcmp(x1, R[i]) < 0) {
        x_t = min(x_t, x1);
      }
    }
  }

  return x_t;
}

int main() {
#ifdef DEBUG
  freopen("in.txt", "r", stdin);
#endif

  double v, x, y;

  while (scanf("%d%lf%lf%lf", &n, &v, &x, &y) != EOF) {
    vector<Point> points;
    points.push_back(Point(x, y));

    for (int i = 0; i < n; ++i) {
      scanf("%lf%lf%lf%lf", &L[i], &B[i], &R[i], &T[i]);
      points.push_back(Point(L[i], B[i]));
      points.push_back(Point(R[i], B[i]));
      points.push_back(Point(L[i], T[i]));
      points.push_back(Point(R[i], T[i]));
    }

    bool impossible = true;

    double A = 0.25 * g * g;
    for (size_t i = 0; i < points.size(); ++i) {
      const Point &p = points[i];

      if (p.x == 0.0) {
        continue;
      }

      double B = p.y * g - v * v;
      double C = p.x * p.x + p.y * p.y;

      double delta = B * B - 4 * A * C;
      if (delta >= 0.0) {
        double t_2s[2] = { (-B - sqrt(delta)) / (2 * A), (-B + sqrt(delta)) / (2 * A) };
        for (int j = 0; j < 2; ++j) {
          double t_2 = t_2s[j];
          if (t_2 > 0) {
            double t = sqrt(t_2);
            double vx = p.x / t;
            double vy = sqrt(v * v - vx * vx);
            double a = -0.5 * g / (vx * vx), b = vy / vx;
            if (dcmp(a * x * x + b * x, y) >= 0 && dcmp(farthest_x(a, b), x) >= 0) {
              // printf("(%lf, %lf), a = %lf, b = %lf, vx = %lf, vy = %lf, t = %lf, x_t = %lf\n", p.x, p.y, a, b, vx, vy, t, farthest_x(a, b));
              impossible = false;
            }
          }
        }
      }
    }

    printf("%s\n", impossible ? "No" : "Yes");
  }

  return 0;
}



Measured memory_bytes: 2764
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

template <class... Args>
struct tuple_input_impl;
template <std::size_t i, std::size_t... tail>
struct tuple_input_impl<std::index_sequence<i, tail...>>
{
    template <class... Args>
    static void f(std::tuple<Args...>& x)
    {
        std::cin >> std::get<i>(x);
        tuple_input_impl<std::index_sequence<tail...>>::f(x);
    }
};
template <>
struct tuple_input_impl<std::index_sequence<>>
{
    static void f(...) {}
};

template <class... Args>
std::istream& operator>>(std::istream& in, std::tuple<Args...>& x)
{
    tuple_input_impl<std::index_sequence_for<Args...>>::f(x);
    return in;
}

template <class T>
T read()
{
    T res;
    std::cin >> res;
    return res;
}
template <class T>
std::vector<T> read(std::size_t n)
{
    std::vector<T> res(n);
    for (std::size_t i = 0; i < n; ++i) std::cin >> res[i];
    return res;
}

template <class T>
void out_impl(T&& v) { std::cout << std::forward<T>(v); }
template <class T, class... Args>
void out_impl(T&& v, Args&&... args)
{
    std::cout << std::forward<T>(v) << ' ';
    out_impl(std::forward<Args>(args)...);
}
template <class... Args>
void out(Args&&... args)
{
    out_impl(std::forward<Args>(args)...);
    std::cout << '\n';
}
template <class... Args>
void out_noreturn(Args&&... args) { out_impl(std::forward<Args>(args)...); }

template <class T>
void print(const T& container)
{
    bool first = true;
    for (auto&& x : container) {
        if (!first) std::cout << ' ';
        std::cout << x;
        first = false;
    }
    std::cout << '\n';
}

void prog()
{
    std::uint64_t a, b;
    std::cin >> a >> b;

    auto f = [](std::uint64_t x) {
        std::uint64_t res = 0;
        for (std::uint64_t i = 1; i < (1ul << 60); i <<= 1) {
            if (i == 1) {
                if (x % 4 == 1 || x % 4 == 2) res |= 1;
                continue;
            }
            auto n = x % (i << 1);
            auto one = (n < i) ? 0 : n - i + 1;
            if (one % 2) res |= i;
        }
        return res;
    };

    out(f(b) ^ f(a - 1));
}

int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    prog();
    return 0;
}


Measured memory_bytes: 256
class Dice:
    def __init__(self, f):
        self.f = f[:]

    def roll(self, s):
        for f in s:
            n = self.f[:]
            if f == 'E':
                t = n[0]
                n[0] = n[3]
                n[3] = n[5]
                n[5] = n[2]
                n[2] = t
            elif f == 'W':
                t = n[0]
                n[0] = n[2]
                n[2] = n[5]
                n[5] = n[3]
                n[3] = t
            elif f == 'N':
                t = n[0]
                n[0] = n[1]
                n[1] = n[5]
                n[5] = n[4]
                n[4] = t
            else:
                t = n[0]
                n[0] = n[4]
                n[4] = n[5]
                n[5] = n[1]
                n[1] = t
            self.f = n

    def to_top(self, index):
        if index == 1:
            self.roll('N')
        elif index == 2:
            self.roll('W')
        elif index == 3:
            self.roll('E')
        elif index == 4:
            self.roll('S')
        elif index == 5:
            self.roll('NN')

    def side_roll(self):
        t  = self.f[1]
        self.f[1] = self.f[2]
        self.f[2] = self.f[4]
        self.f[4] = self.f[3]
        self.f[3] = t

    def top(self):
        return self.f[0]

    def front(self):
        return self.f[1]

    def r(self):
        return self.f[2]

df = list(input().split())
q = int(input())
for _ in range(q):
    d = Dice(df)
    t, f = input().split()
    ti = d.f.index(t)
    fi = d.f.index(f)
    d.to_top(ti)
    while d.front() != f:
        d.side_roll()
    print(d.r())

Measured memory_bytes: 7744
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    x,y=map(int,input().split())
    ans=0
    while(y>=x):
        ans+=1
        x*=2
    print(ans)
resolve()

Measured memory_bytes: 38256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;


int main(){
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int K;
    cin >> K;
    vector<int> A(N+1,0);
    for(int i=1;i<=N;++i)cin>>A[i];
    sort(A.begin(), A.end());
    vector<vector<int>> until(N+2, vector<int>(K+1, 0));
    until[0][0]=1;
    vector<vector<int>> ikou(N+2, vector<int>(K+1, 0));
    ikou[N+1][0]=1;
    for(int i=1;i<=N;++i){
        for(int j=0;j<=K;++j){
            if(until[i-1][j])until[i][j]=1;
            if(until[i-1][j]&&0<=j+A[i]&&j+A[i]<=K)until[i][j+A[i]]=1;
        }
    }
    for(int i=N;i>=1;--i){
        for(int j=0;j<=K;++j){
            if(ikou[i+1][j])ikou[i][j]=1;
            if(ikou[i+1][j]&&0<=j+A[i]&&j+A[i]<=K)ikou[i][j+A[i]]=1;
        }
    }
    int ans=0;
    vector<int> check(5001,-1);
    for(int i=1;i<=N;++i){
        if(A[i]>=K)continue;
        if(check[A[i]]!=-1){
            if(check[A[i]]==0)ans++;continue;
        }
        bitset<5001> buntil;
        for(int j=0;j<=K;++j){
            if(until[i-1][j])buntil.set(j);
        }
        bitset<5001> b;
        for(int j=0;j<=K;++j){
            if(ikou[i+1][j]){
                b|=buntil<<j;
            }
        }
        bool need=0;
        for(int j=max(K-A[i],0);j<K;++j){
            if(b.test(j)){need=1;break;}
        }
        if(!need){ans++;check[A[i]]=0;}
        else check[A[i]]=1;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 199148
#include<iostream>
#include<math.h>
using namespace std;
int n,m;
#define N 100010
int main()
{
    ios::sync_with_stdio(false);
    while(cin>>n>>m)
    {
        if(m%n==0)
            cout<<m/n<<endl;
        else
        {
            for(int i=m/n;i>=1;i--)
            {
                if(m%i==0&&m/i>n)
                {
                    cout<<i<<endl;
                    break;
                }
            }
        }
    }
}


Measured memory_bytes: 256
def main():
    S = input()
    L, R = 2, len(S) - 2
    if S[0] != 'A':
        print('WA')
        exit()

    cnt = 0
    for i in range(1, len(S)):
        if S[i] == 'C' and L <= i <= R:
            cnt += 1
            continue
        if S[i].isupper():
            print('WA')
            exit()

    if cnt != 1:
        print('WA')
    else:
        print('AC')


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <stdio.h>
#include <math.h>


int main(void)
{
long long int sum;
int n,m,min,max;

scanf("%d %d",&n,&m);
min=m;
max=m;
sum=m;
n--;
while(n--){
	scanf("%d",&m);
	if(min>m)min=m;
	if(max<m)max=m;
	sum+=m;
}
printf("%d %d %lld\n",min,max,sum);
}



Measured memory_bytes: 1992
#include <stdio.h>
int main(void){
char a[100],b[100],c[100];
scanf("%s %s %s",a,b,c);
a[0]=a[0]-32;
b[0]=b[0]-32;
c[0]=c[0]-32;
printf("%c%c%c\n",a[0],b[0],c[0]);
}

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M, X; cin >> N >> M >> X;
  vector<int> C(N, 0);
  vector<vector<int> > A(N, vector<int>(M, 0));
  REP(i, N){
    cin >> C[i];
    REP(j, M){
       cin >> A[i][j];
    }
  }
  int value = 1e9;
  REP(i, 1<<N){
    int tmp = 0;
    vector<int> AA(M, 0);
    REP(j, N){
      if(i >> j & 1){
        tmp += C[j];
        REP(k, M){
          AA[k] += A[j][k];
        }
      }
    }
    bool flag = true;
    REP(j, M){
      if(AA[j] < X) flag = false;
    }
    if(flag){
      value = min(tmp, value);
    }
  }
  if(value != 1e9){
    cout << value << endl;
  }else{
    cout << -1 << endl;
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
const int mod=1'000'000'007;

int main(){
    int h,w,K;cin >> h >> w >> K;
    vector<vector<ll>> dp(h+1,vector<ll>(w,0));
    dp[0][0]=1;//0indexed,棒1、０列目からスタート
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            for(int k=0;k<1<<(w-1);k++){
                bool ok=true;
                for(int l=0;l<w-2;l++){
                    if(((k>>l)&1)&&((k>>(l+1))&1)){
                        ok=false;
                    }
                }
                if(ok){
                    if(j>=1&&((k>>(j-1))&1)){
                        dp[i+1][j-1]+=dp[i][j];
                        dp[i+1][j-1]%=mod;
                    }
                    else if(j<=w-2&&((k>>j)&1)){
                        dp[i+1][j+1]+=dp[i][j];
                        dp[i+1][j+1]%=mod;
                    }
                    else{
                        dp[i+1][j]+=dp[i][j];
                        dp[i+1][j]%=mod;
                    }
                }
            }
        }
    }
    cout << dp[h][K-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;

    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;

    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

void solve() {
    int n;
    cin >> n;
    unordered_set<int> us;
    for (int i = 0; i < n; ++i) {
        int val;
        cin >> val;
        if (us.count(val)) {
            cout << "NO\n";
            return;
        }
        us.insert(val);
    }
    cout << "YES\n";
}

int main() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}

Measured memory_bytes: 8520
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(){
		
		var l = new List<long>();
		for(long i=1;i * i <= M;i++){
			if(M % i != 0) continue;
			l.Add(i);
			l.Add(M / i);
		}
		long max = 1;
		foreach(var d in l){
			long n = M / d;
			if(n >= N){
				max = Math.Max(max,d);
			}
		}
		Console.WriteLine(max);
		
		
	}
	int N;
	long M;
	public Sol(){
		var d = rla();
		N = (int) d[0]; M = d[1];
	}

	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: 13268
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;

class Program
{
    private static int[] Solve(int N, int x)
    {
        if (2 <= x && x <= N * 2 - 2)
        {
            if (N > 2)
            {
                int[] nums = new int[N * 2 - 1];
                if (x < N)
                {
                    nums[N - 3] = x + 2;
                    nums[N - 2] = 1;
                    nums[N - 1] = x;
                    nums[N - 0] = x + 1;
                    int i = 0;
                    int n = 2;
                    while (i < nums.Length && n < N * 2)
                    {
                        while (nums[i] != 0) { ++i; }
                        while (x <= n && n <= x + 2) { ++n; }
                        nums[i++] = n++;
                    }
                }
                else if (x > N)
                {
                    nums[N - 3] = x - 2;
                    nums[N - 2] = N * 2 - 1;
                    nums[N - 1] = x;
                    nums[N - 0] = x - 1;
                    int i = nums.Length - 1;
                    int n = N * 2 - 2;
                    while (i >= 0 && n > 0)
                    {
                        while (nums[i] != 0) { --i; }
                        while (x - 2 <= n && n <= x) { --n; }
                        nums[i--] = n--;
                    }
                }
                else
                {
                    for (int i = 0; i < nums.Length; ++i) { nums[i] = i + 1; }
                }
                return nums;
            }
            else
            {
                return new[] { 1, 2, 3 };
            }
        }
        else
        {
            return null;
        }
    }
    static void Main(string[] args)
    {
        int[] values = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int[] result = Solve(values[0], values[1]);
        if (result != null)
        {
            Console.WriteLine("Yes");
            var sb = new StringBuilder();
            foreach (int n in result) { sb.AppendLine(n.ToString()); }
            Console.Write(sb);
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 14040
#define LL long long
#include<iostream>
using namespace std;

inline LL bi(int x, int y){
	LL ans;
	if(x>y){
		ans=x;
	}else{
		ans=y;
	}
	return ans;
}

int main(){
	LL a,b,c;
	cin>>a>>b>>c;
	cout<<a+b+c-bi(a,bi(b,c))<<endl;;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
public class Program
{
    public static void Main()
    {
        int[] n = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
        int W = n[0];
        int a = n[1];
        int b = n[2];
        if (n[1] <= n[2] && n[2] <= (n[1] + n[0])) Console.WriteLine("0");
        else Console.WriteLine(Math.Min(Math.Abs(n[2] + n[0] - n[1]), Math.Abs(n[1] + n[0] - n[2])));
    }
}

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

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,d;
	cin>>n>>d;
	vector<vector<int>> vs(n,vector<int>(d));
	for(int i=0;i<n;++i){
		for(int j=0;j<d;++j){
			cin>>vs[i][j];
		}
	}
	int ans=0;
	for(int i=0;i<n;++i){
		for(int k=i+1;k<n;++k){
			int dx=0;
			for(int j=0;j<d;++j){
				int aux = abs(vs[k][j]-vs[i][j]);aux*=aux;
				dx+=aux;
			}
			int xd = sqrt(dx);
			if(xd*xd==dx)
				++ans;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict
input = sys.stdin.readline
H, W, K = list(map(int, input().split()))

mod = 1000000007

c = defaultdict(lambda: 1)
c.update({0: 1, 1: 2, 2: 3, 3: 5, 4: 8, 5: 13, 6: 21})

dp = [{0: 0, 1: 1, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0}, ]

for i in range(1, H+2):
    dp_i = {0: 0, W+1: 0}
    for j in range(1, W+1):
        dp_i[j] = dp[i-1][j-1]*c[j-3]*c[W-j-1] % mod + \
            dp[i-1][j]*c[j-2]*c[W-j-1] % mod + \
            dp[i-1][j+1]*c[j-2]*c[W-j-2] % mod
    dp.append(dp_i)

# H, Kを計算
print(dp[H][K] % mod)


Measured memory_bytes: 3828
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		 Scanner scan = new Scanner(System.in);
		 int D = scan.nextInt();
		 int N = scan.nextInt();
		 
		 int cnt = 0;
		 int index = 0;
		 
		 while (cnt < N) {
			 index += 1;
			 if (index * Math.pow(100,D) % (Math.pow(100, D + 1)) != 0) {
				 cnt += 1;
			 }
		 }
		 
		 System.out.println((int)(index * Math.pow(100, D)));
		 scan.close();

	}

}


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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<long int> vec(n);
  for(int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  long int ans = 10000000000;
  for(int i = 0; i < n - k + 1; i++) {
    ans = min(ans, vec.at(i + k - 1) - vec.at(i));
  }
  cout << ans << endl;
  
  return 0;
}

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

#define INF (2e9)
#define FOR(i, a, b) for (ll (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

using namespace std;

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

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

using ll = long long;
using ld = long double;

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<ll>;
using vvi = vc<vi>;

template<class T>
using va = valarray<T>;
using vad = va<ld>;
using vai = va<ll>;

vi Read(ll n) {
    auto      v = vi(n);
    for (auto i = std::size_t(0); i < n; ++i) {
        cin >> v[i];
    }
    return v;
}

template<class T>
void Dump(const T& A) {
    for (const auto& value : A)
        cout << value << "\n";
}

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

    ll n;
    cin >> n;
    const auto v = Read(n);

    int n_q;
    cin >> n_q;
    REP(i, n_q) {
        int b, e, k;
        cin >> b >> e >> k;
        ll count = 0;
        FOR(j, b, e) if (v[j] == k) ++count;
        cout << count << endl;
    }

    return 0;
}



Measured memory_bytes: 3228
N = int(input())
edge = [[] for _ in range(N)]
for i in range(N-1):
    a,b = map(int, input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

import sys
sys.setrecursionlimit(10**8)

mod = 10**9+7
def dfs(v):
    white,black = 1,1
    for u in edge[v]:
        if visited[u]==False:
            visited[u]=True
            w,b = dfs(u)
            white *= w+b
            white %= mod
            black *= w
            black %= mod
    return white,black

visited = [False]*N
visited[0]=True
print(sum(dfs(0))%mod)

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

using namespace std;
typedef long long Int;

int main()
{
  int n;
  set<int> p;
  vector< pair<int, int> > v;
  scanf("%d", &n);
  
  p.insert(0);
  p.insert(n + 1);
  
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    v.emplace_back(x, i);
  }
  
  sort(v.rbegin(), v.rend());
  
  Int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i) {
      auto it = p.lower_bound(v[i].second);
      auto it2 = it; --it2;
      auto it3 = it; ++it3;
      
      int prv = *it2;
      int cur = v[i].second;
      int nxt = *it;
      
      if (it2 != p.begin()) {
        --it2;
      	ans += (Int)(n - i) * (nxt - cur) * (prv - *it2);
      }
      if (it3 != p.end()) {
        ans += (Int)(n - i) * (cur - prv) * (*it3 - nxt);
      }
    }
    p.insert(v[i].second);
  }
  
  printf("%lld\n", ans);
  
  return 0;
}

Measured memory_bytes: 5748
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define eps 1e-13
#define PI 3.14159265359
#define sp printf(" ")
#define vi vector<int>
#define vl vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pcc pair<char, char>
#define mp make_pair
#define FF first
#define SS second
#define pb(x) push_back(x)
#define sd(x) scanf("%d", &(x))
#define pd(x) printf("%d", (x))
#define pdn(x) printf("%d\n", (x))
#define sld(x) scanf("%ld", &(x))
#define pld(x) printf("%ld", (x))
#define pldn(x) printf("%ld\n", (x))
#define slf(x) scanf("%lf", &(x))
#define plf(x) printf("%.9lf", (x))
#define plfn(x) printf("%.9lf\n", (x))
#define sch(x) scanf("%c", &(x))
#define pch(x) printf("%c", (x))
#define pchn(x) printf("%c\n", (x))
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios::sync_with_stdio(false); cin.tie(0)
#define endl '\n'
ll dp[10003];
int main()
{
   int tx,ty,sx,sy;
   cin>>sx>>sy>>tx>>ty;
   for(int i=sx;i<tx;i++)cout<<'R';
   for(int i=sy;i<ty;i++)cout<<'U';
   for(int i=sx;i<tx;i++)cout<<'L';
   for(int i=sy;i<ty;i++)cout<<'D';
   cout<<'L';
   for(int i=sy;i<=ty;i++)cout<<'U';
   for(int i=sx;i<=tx;i++)cout<<'R';
   cout<<'D';
   cout<<'R';
   for(int i=sy;i<=ty;i++)cout<<'D';
   for(int i=sx;i<=tx;i++)cout<<'L';
   cout<<'U'<<endl;





}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
ll gcd(ll a, ll b) {
  return b ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}
int main() {
  ll a, b, c, d, ans = 0;
  cin >> a >> b >> c >> d;
  ans = b + 1 - a
      - ((b / c + b / d - b / lcm(c, d)) - (a / c + a / d - a / lcm(c, d)))
      - (a % c == 0 || a % d == 0 ? 1 : 0);
  cout << ans;
}


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

using namespace std;

#define int long long

const int MOD = 1e9 + 7;

int k;

void solve(int n)
{
    cout << n << "\n";
    vector<vector<int> > a(n, vector<int>(n));
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            a[i][j] = (i + j) % n;
            if (i % 2) a[i][j] += n;
            if (a[i][j] >= k) a[i][j] -= n;
            a[i][j]++;
            cout << a[i][j] << " ";
        }
        cout << "\n";
    }
}

signed main()
{
    cin >> k;
    if (k == 1) cout << "1\n1", exit(0);
    for (int n = 2; n <= 500; n += 2)
    {
        if (2 * n >= k)
        {
            solve(n);
            return 0;
        }
    }
}


Measured memory_bytes: 3200
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    
    if m == -1 or f == -1 or m+f < 30:
        print("F")
    elif m+f >= 80:
        print("A")
    elif 65 <= m+f < 80:
        print("B")
    elif 50 <= m+f < 65 or (30 <= m+f < 50 and r >= 50):
        print("C")
    else: 
        print("D")


Measured memory_bytes: 5592
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s; cin >> s;
	if(s[0] == '>') s = '<' + s;
	if(s[s.size() - 1] == '<') s = s + '>';

	vector<long long> sl;
	char prev = s[0];
	int cnt = 0;
	for (int i = 0; i < s.size(); i++)
	{
		if(s[i] == prev) cnt++;
		else {
			sl.push_back(cnt);
			cnt = 1;
			prev = s[i];
		}
	}
	sl.push_back(cnt);

	long long res = 0;
	for (int i = 0; i < sl.size(); i+=2)
	{
		long long a = max(sl[i], sl[i+1]);
		long long b = min(sl[i], sl[i+1]) - 1;
//		cout << sl[i] << endl;
//		cout << sl[i+1] << endl;
		res += a * (a + 1) / 2;
		res += b * (b + 1) / 2;
	}
//	cout << s << endl;
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 6656
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <array>
#include <cmath>
#include <queue>
#include <stack>
#include <numeric>

using namespace std;

int main()
{
	string s;

	cin >> s;

	if (s.at(0) != s.at(1) ||
		s.at(1) != s.at(2) ||
		s.at(0) != s.at(2)) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i= (a); i<(b); i++)
#define REP(i,n) for(int i=0;i < (n);i++)
#define ALL(obj) (obj).begin(),(obj).end()
using namespace std;

const long long INF = 1LL << 60;
const int MOD = (int)1e9 + 7;
typedef long long ll;
//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    //sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
vector<vector<int>> graph;
vector<int> ans;
signed main () {
    int n;scanf("%d",&n);
    graph.assign(n,vector<int>(n));
    ans.assign(n,-1);
    REP(i,n){
        int id,tmp;scanf("%d %d",&id,&tmp);
        REP(j,tmp){
            int t;scanf("%d",&t);
            graph[i].push_back(t-1);
        }
    }
    queue<pair<int,int>> q;
    q.push(make_pair(0,0));ans[0] = 0;
    while(!q.empty()){
        pair<int, int> tmp = q.front();q.pop();
        int ind = tmp.first;int cnt = tmp.second;
        for(int next : graph[ind]){
            if(ans[next]!=-1)continue;
            ans[next] = cnt+1;
            q.push(make_pair(next, cnt+1));
        }
    }
    REP(i,n){
        printf("%d %d\n",i+1,ans[i]);
    }
}


Measured memory_bytes: 3356
s = input()
n = len(s)
if n == 2 and s[0] == s[1]:
    print(1,2)
    exit()
for i in range(n-2):
    if s[i] == s[i+1] or s[i] == s[i+2] or s[i+1] == s[i+2]:
        print(i+1,i+3)
        exit()
print(-1,-1)


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

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

  int cnt = 4;
  while (N > 4 || N == 3) N = ((N % 2 == 0) ? N / 2 : N * 3 + 1), cnt++;

  cout << cnt << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int x[50],y[50];
map<P,int> m;
signed main(){
	int n,ans=0;
	cin>>n;
	f(i,n){
		cin>>x[i]>>y[i];
	}
	f(i,n){
		f(j,n){
			if(i==j)continue;
			m[{x[i]-x[j],y[i]-y[j]}]++;
		}
	}
	for(pair<P,int> p:m){
		ans=max(ans,p.S);
	}
	cout<<n-ans<<endl;
}


Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;

int P[10010];
void init(int n){
    for(int i=0;i<n;++i)P[i]=i;
}
int root(int a) {
    if(P[a]==a)return a;
    return (P[a]=root(P[a]));
}
bool is_same_set(int a,int b){
    return root(a) == root(b);//代表元を求める
}
void unite(int a,int b){
    P[root(a)]=root(b);
}//対set,グラフ？

double dot_product(xy_t a, xy_t b) { return (conj(a)*b).real(); }//内積
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }//外積
xy_t projection(xy_t p, xy_t b) { return b*dot_product(p,b)/norm(b); }//投影
//対図形

#define mod 1000000007
ll f[2001];
//int n,k とかしておく

ll pw(ll x, ll y){//euclidの互除法より
    ll a= 1;
    while(y){
        if(y&1){//奇数なら
            a = a*x%mod;
        }
        x = x*x%mod;
        y /= 2;
    }
    return a;
}

ll modinv(ll x){//逆元を求める
    return pw(x, mod - 2 );
}

ll comb(int n,int r){
    if(n<r){
        return 0;
    }
    return f[n] * modinv(f[r])%mod*modinv(f[n-r])%mod;
}//対combination

int main(){
    int n;
    cin >> n;
    int a[n+1];
    int b[n+1];
    rep2(i,n){
        cin >> a[i];
        b[i]=0;
    }
    for(int j=n;j>=1;j--){
        b[j]=a[j];
        for(int k=2;j*k<=n;k++){
            b[j]^=b[j*k];
        }
    }
    int c=0;
    rep2(i,n){
        if(b[i]==1){
            c++;
            st.push(i);
        }
    }
    cout<<c<<endl;
    if(st.empty()==1){
        return 0;
    }
    while(st.empty()!=1){
        cout<<st.top()<<" ";
        st.pop();
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3072
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7

N = INT()
h = LIST()

dp = [INF]*(N)

dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2, N):
	dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]), dp[i-1]+abs(h[i]-h[i-1]))

print(dp[N-1])

Measured memory_bytes: 16400
N ,A, C =(input()).split(" ")

N=(int)(N)
A=(int)(A)
C=(int)(C)

kumi = A+C
kumi_syou = N//kumi
kumi_num = N%kumi

ans = kumi_syou*A

if kumi_num<A:
    print(ans+kumi_num)
else:
    print(ans+A)



Measured memory_bytes: 3060
def main():
    N, L = map(int, input().split())
    T = list(range(L, L+N))
    m = float("inf")
    x = float("inf")
    for t in T:
        if abs(t) < m:
            m = abs(t)
            x = t
    print(sum(T) - x)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
package main

import "fmt"

func main() {
	// Code for A - Christmas Eve Eve Eve
	var D int
	fmt.Scanf("%d", &D)

	switch D {
	case 22:
		fmt.Println("Christmas Eve Eve Eve")
	case 23:
		fmt.Println("Christmas Eve Eve")
	case 24:
		fmt.Println("Christmas Eve")
	case 25:
		fmt.Println("Christmas")
	}
}


Measured memory_bytes: 1828
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int Y = sc.nextInt();
        if ((4*X-Y)>=0 && (4*X-Y)%2==0 && (Y-2*X)>=0 && (Y-2*X)%2==0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int n; cin >> n;
    int a[n];
    int sum1 = 0;
    int sum2 = 0;
    int min = 1000;

    REP(i, 0, n) cin >> a[i];
    REP(i, 0, n){
        REP(j, 0, i){
            sum1+=a[j];
        }
        REP(j, i, n){
            sum2+=a[j];
        }
        int diff = abs(sum1-sum2);
        if(diff<min) min = diff;
        sum1 = 0;
        sum2 = 0;
    }
    cout << min << endl;
    return 0;
}

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


int main(){
  long long n,m,i;
  cin >> n >> m;
  vector<string> s(m);
  vector<long long> p(m);
  for(i=0;i<m;++i){
    cin >> p[i] >> s[i];
  }
  long long se,pe;
  se=0;
  pe=0;
  vector<long long> ha(n+1,0);
  vector<long long> bo(n+1,0);
  vector<long long> pen(n+1,0);
  for(i=0;i<m;++i){
    if(s[i]=="WA" && ha[p[i]]==0){
      pe=pe+1;
      pen[p[i]]++;
    }else if(s[i]=="AC" && ha[p[i]]==0){
      ha[p[i]]=1;
      se=se+1;
    }
  }
  for(i=0;i<m;++i){
    if(ha[p[i]]==0){
      if(bo[p[i]]==0){
        pe=pe-pen[p[i]];
        bo[p[i]]=1;
      }
    }
  }
  if(pe<0){
    pe=0;
  }
  cout << se << ' ' << pe << endl;
  return 0;
}


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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll inf = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/

const int N = 1e5 + 5;

int h[N];

int main(){
    fIO

    int n;
    cin >> n;

    int mini = numeric_limits<int>::max();
    for(int i = 0; i < n; i++) cin >> h[i];
    for(int i = n - 1; i >= 0; i--){

        if(i != n - 1){
            //cout << h << ' ' << mini << "\n";
            if(h[i] <= mini){}
            else if(h[i] - mini <= 1){}
            else return cout << "No\n", 0;
        }
        mini = min(mini, h[i]);
    }
    cout << "Yes\n";
}











Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  
  string T; string Q; string R;
  T=S.at(0) ;
  Q=S.at(1) ;
  R=S.at(2) ;
  
  cout << T+Q+R << endl;
}


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

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
signed main() {
	int ans = 0, p = 0;
	for (int i = 0; i < 5; i++) {
		int t; cin >> t;
		int t1 = (t + 9) / 10 * 10;
		ans += t1;
		p = max(p, t1 - t);
	}
	cout << ans - p << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		new Main().mainrun();
	}

	private Scanner scan;
	private int N,ren,maxren;
	
	private void mainrun() {

		scan = new Scanner(System.in);

		ren = maxren = 0;
		
		N = scan.nextInt();
		
		for(int i = 0;i < N;i++) {
			int A = scan.nextInt();
			if(A == 1) {
				ren++;
			}else {
				maxren = Math.max(ren, maxren);
				ren = 0;
			}
		}
		
		System.out.println(Math.max(ren, maxren) + 1);
		
		scan.close();
	}
}



Measured memory_bytes: 26404
import java.io.InputStreamReader;
import java.util.Scanner;


public class Main {
	public static void main(String[] args){
		Scanner scan = null;
		try{
			scan = new Scanner(new InputStreamReader(System.in));
			int rectangle = 0 ,lozenges = 0;
			while(scan.hasNext()){
				String[] str = scan.nextLine().split(",");
				int a = Integer.parseInt(str[0]);
				int b = Integer.parseInt(str[1]);
				int diagonal = Integer.parseInt(str[2]);
				if( a == b)lozenges ++;
				if(pow(diagonal) == pow(a) + pow(b))rectangle++;
			}
			System.out.println(rectangle);
			System.out.println(lozenges);
		}finally{
			if(scan !=null) scan.close();
		}
	}
	public static int pow (int d){
		return d * d;
	}
}

Measured memory_bytes: 17340