akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005

using namespace std;

int solve(){
    int n;
    cin>>n;
    int mxind=0,maxe=0;
	int a[n];
	rep(i,0,n){
		cin>>a[i];
		if(a[i]>maxe){
			mxind=i;
			maxe=a[i];
		}
	}
	sort(a,a+n);
	reverse(a,a+n);
	rep(i,0,n){
		if(mxind==i)cout<<a[1]<<endl;
		else cout<<a[0]<<endl;
	}
	return 0;
}
int main(){
    waste;
    int t;
    //cin>>t;
    t=1;
    while(t--){
       	solve();
    }
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define D double
#define pb push_back
#define mp make_pair
#define sf scanf
#define pf printf
#define ff first
#define ss second
#define SZ 100005
#define eps 1e-8
#define PI (2*acos(0.0))
#define mem(a, b) memset(a, b, sizeof a)
#define FastIO ios_base::sync_with_stdio(0)
const int inf = 0x7f7f7f7f;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
//int dx[]={2,1,-1,-2,-2,-1,1,2};
//int dy[]={1,2,2,1,-1,-2,-2,-1};
//int mnth[]={-1,31,28,31,30,31,30,31,31,30,31,30,31};

int n, m;
char grid[205][205];
int seen[205][205], dist[205][205];

bool valid(int x, int y)
{
    if(x>=0 && x<n && y>=0 && y<m && seen[x][y]==0 && grid[x][y]!='#') return 1;
    return 0;
}

void bfs(int x, int y)
{
    mem(seen, 0);
    mem(dist, inf);
    seen[x][y] = 1;
    dist[x][y] = 0;

    queue<int>q;
    q.push(x); q.push(y);

    while(!q.empty())
    {
        x = q.front(); q.pop();
        y = q.front(); q.pop();

        for(int i=0; i<4; i++) {
            int xx = x + dx[i];
            int yy = y + dy[i];

            if(valid(xx, yy)) {
                seen[xx][yy] = 1;
                dist[xx][yy] = dist[x][y] + 1;
                q.push(xx); q.push(yy);
            }
        }
    }
}

int main()
{
    while(sf("%d %d", &n, &m)==2)
    {
        for(int i=0; i<n; i++) {
            sf("%s", grid[i]);
        }

        for(int i=0; i<n; i++) {
            for(int j=0; j<m; j++) {
                if(grid[i][j]=='%') {
                    bfs(i, j);
                    break;
                }
            }
        }

        int princes = 0, solder = inf;

        for(int i=0; i<n; i++) {
            for(int j=0; j<m; j++) {
                if(grid[i][j]=='@') {
                    princes = dist[i][j];
                }

                else if(grid[i][j]=='$') {
                    solder = min(solder, dist[i][j]);
                }
            }
        }

        //cout<<princes<<" "<<solder<<endl;
        if(solder<=princes) pf("No\n");
        else pf("Yes\n");
    }
    //main();
    return 0;
}

Measured memory_bytes: 3568
import Control.Applicative
import Control.Monad
import Control.Monad.ST
-- import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
--import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Fixed
import Data.Tuple
--import Data.Array
import Data.Array.Unboxed
--import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import Text.Printf
-- import System.IO.Unsafe
 
-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
whenM :: Monad m => m Bool -> m () -> m ()
whenM c a = c >>= flip when a
unconsU :: [a] -> (a, [a])
unconsU (x:xs) = (x, xs)
-- templete


main = map (map readInt . words) . lines <$> getContents >>= mapM_ (print . apply2 gcd)


Measured memory_bytes: 3944
#include <iostream>

using namespace std;

int main()
{
    int i, j, h, w, x;
    cin >> h >> w;
    
    
    for (x=1;x<=300;x++)
    {
     for(j=1;j<=h;j++)
    {
    for(i=1;i<=w;i++)  //width
    {
        cout << "#";   //width
    }
    cout << endl; 
 
    }
   cin >> h >>w;
    cout << endl; 
   
   if (w==0 && h==0)
   break;
    }
   
   return 0;
}


Measured memory_bytes: 3100
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(std::string s){
    cout << s.substr(0, 3) << endl;
}


signed main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 3632
# -*- coding: utf-8 -*-
N, M = map(int, input().split())

shops = []

for i in range(N):
    n, m = map(int, input().split())
    shops.append((n, m))

sorted_shops = sorted(shops)

remain = M
value = 0
for i in range(N):
    if sorted_shops[i][1] <= remain:
        value += sorted_shops[i][0] * sorted_shops[i][1]
        remain -= sorted_shops[i][1]
    else:
        value += sorted_shops[i][0] * remain
        break
print (value)

Measured memory_bytes: 17788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int N;
int A[100010];
int B[100010];
map<int, int> idx;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    B[i] = A[i];
  }  
  sort(B, B+N);
  for (int i = 0; i < N; i++) {
    idx[B[i]] = i;
  }
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if ((i - idx[A[i]]) % 2 == 0) continue;
    cnt++;
  }
  cout << cnt / 2 << endl;

  return 0;
}

Measured memory_bytes: 5760
import math
A,B,C = map(int,input().split())
k = [A,B,C]
k.sort()
k.reverse()
ans = 0
ans += k[0]-k[1]
now = k[2]
now += ans
if (k[0]-now)%2 == 0:
    ans += math.ceil((k[0]-now)/2)
    print(ans)
else:
    ans += math.ceil((k[0]-now)/2)
    ans += 1
    print(ans)


Measured memory_bytes: 3064
use std::io;
use std::cmp;
use std::collections::HashSet;

#[derive(Eq, Hash, PartialEq)]
enum Color {
    Gray,
    Brown,
    Green,
    Sky,
    Blue,
    Yellow,
    Orange,
    Red
}

fn main() {
    let mut n = String::new();
    io::stdin().read_line(&mut n).expect("Failed to read line");

    let mut vec = String::new(); 
    io::stdin().read_line(&mut vec).expect("Failed to read line");
    let vec: Vec<i32> = vec.trim().split(' ').map(|x| x.trim().parse().unwrap()).collect();

    let mut set = HashSet::new();
    let mut target_count = 0;
    
    for v in vec {
        if v < 400 {
            set.insert(Color::Gray);
        } else if v < 800 {
            set.insert(Color::Brown);
        } else if v < 1200 {
            set.insert(Color::Green);
        } else if v < 1600 {
            set.insert(Color::Sky);
        } else if v < 2000 {
            set.insert(Color::Blue);
        } else if v < 2400 {
            set.insert(Color::Yellow);
        } else if v < 2800 {
            set.insert(Color::Orange);
        } else if v < 3200 {
            set.insert(Color::Red);
        } else {
            target_count += 1;
        }
    }
    println!("{} {}", cmp::max(1, set.len()), set.len() + target_count)
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int k = sc.nextInt();
        
        char ch = s.toCharArray()[k-1];
        
        char[] a = s.toCharArray();
        for (int i=0; i < s.length(); i++) {
            if (a[i] != ch) a[i] = '*';
        }
        
        System.out.println(String.valueOf(a));
    }
}


Measured memory_bytes: 23636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        var NM = ConsoleUtil.IntArrayReadLine();
        var N = NM[0];
        var M = NM[1];

        var A = new string(Enumerable.Repeat(0, N).Select(n => Console.ReadLine()).SelectMany(n => n).ToArray());
        
        var BDatas = Enumerable.Repeat(0, M).Select(n => Console.ReadLine()).ToArray();

        string regexstr = string.Join(new string(Enumerable.Repeat('.', N - M).ToArray()), BDatas.Select(s => s.Replace(".", @"\.")));
        if(Regex.IsMatch(A, regexstr))
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

static class MathUtil
{
    static IEnumerable<int> EnumeratePrimeNumbers()
    {
        List<int> primes = new List<int>() { 2 };
        yield return 2;

        for (int i = 3; i < int.MaxValue; i++)
        {
            bool isPrime = true;
            int Sqrt = (int)Math.Sqrt(i) + 1;

            foreach (var prime in primes)
            {
                if (prime > Sqrt)
                {
                    break;
                }
                if (i % prime == 0)
                {
                    isPrime = false;
                    break;
                }
            }

            if (isPrime)
            {
                primes.Add(i);
                yield return i;
            }
        }
    }
}

static class ConsoleUtil
{
    public static string[] StrArrayReadLine(char sepalator)
    {
        string str = Console.ReadLine();
        return str.Split(sepalator).ToArray();
    }
    public static string[] StrArrayReadLine()
    {
        string str = Console.ReadLine();
        if (str.Contains(','))
        {
            return str.Split(',').ToArray();
        }
        {
            return str.Split(' ').ToArray();
        }
    }
    public static int[] IntArrayReadLine()
    {
        return StrArrayReadLine().Select(s => int.Parse(s)).ToArray();
    }
    public static int[] IntArrayReadLine(char sepalator)
    {
        return StrArrayReadLine(sepalator).Select(s => int.Parse(s)).ToArray();
    }
    public static int IntReadLine() => int.Parse(Console.ReadLine());
    public static long LongReadLine() => long.Parse(Console.ReadLine());
}

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

#define POS(i,j,k) (((i)*(1+cnt[1]+cnt[2])+(j))*(1+cnt[2])+(k))

int n;
double p;
int cnt[3]={0,0,0};

double calc(const int a,const int b,const int c,double *dp){
  if(dp[POS(a,b,c)]>=0) return dp[POS(a,b,c)];
  double local=1;
  if(a>0) local+=a*p*calc(a-1,b,c,dp);
  if(b>0) local+=b*p*calc(a+1,b-1,c,dp);
  if(c>0) local+=c*p*calc(a,b+1,c-1,dp);
  dp[POS(a,b,c)]=local/((a+b+c)*p);
  return dp[POS(a,b,c)];
}

void run(void){
  scanf("%d",&n);
  p=(double)1/n;
  int i;
  for(i=0;i<n;i++){
    int a;
    scanf("%d",&a);
    cnt[a-1]++;
  }
  double *dp=(double *)calloc((1+cnt[0]+cnt[1]+cnt[2])*(1+cnt[1]+cnt[2])*(1+cnt[2]),sizeof(double));
  for(i=1;i<(1+cnt[0]+cnt[1]+cnt[2])*(1+cnt[1]+cnt[2])*(1+cnt[2]);i++) dp[i]=-1;
  double ans=calc(cnt[0],cnt[1],cnt[2],dp);
  printf("%.9f\n",ans);
}

int main(void){
  run();
  return 0;
}


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

const ll MOD = 1e9 + 7;

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

    string s;
    int D;
    cin >> s >> D;

    int n = s.size();
    ll dp[n+1][2][D]; //桁、フラグ、Dで割ったあまり　:= 総数

    memset(dp,0,sizeof(dp));
    dp[0][0][0] = 1;

    for(int i = 0; i < n; i++){
        int p = s[i] - '0';
        for(int j = 0; j < 2; j++){
            for(int k = 0; k < D; k++){
                for(int l = 0; l <= (j ? 9 : p); l++){
                    dp[i+1][j || (l < p)][(k + l) % D] += dp[i][j][k];
                    dp[i+1][j || (l < p)][(k + l) % D] %= MOD;
                }
            }
        }
    }
    cout << (dp[n][0][0] + dp[n][1][0] - 1 + MOD ) % MOD << endl;
}



Measured memory_bytes: 15872
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll n;
int main(){
    cin>>n;
    set<string> ss;
    rep(i,n){
        string s;
        cin>>s;
        if(ss.find(s)==ss.end()) ss.insert(s);
    }
    if(ss.size()==4) cout<<"Four"<<endl;
    else cout<<"Three"<<endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979323846;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define CIN(v) cin >> v;
#define COUT(v) cout << v << "\n";

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

  string S;
  int N;

  CIN(N);
  CIN(S);

  string A = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";

  for (int i = 0; i < S.length(); i++) {
    int pos = A.find(S[i]);
    cout << A[pos + N];
  }
  cout << endl;

  return 0;
}


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

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[] a = new int[13];

            a[4] = a[6] = a[9] = a[11] = 1;
            a[2] = 2;

            int x = in.nextInt();
            int y = in.nextInt();

            out.println(a[x] == a[y] ? "Yes" : "No");
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



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

#define fs first
#define sc second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define pb emplace_back

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ") 
{ rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

int main() {
	int a, b;

	while (cin >> a >> b, b) {
		int d = b - a;

		vi a;
		a.pb(d / 1000);
		d %= 1000;

		a.pb(d / 500);
		d %= 500;
		
		a.pb(d / 100);

		reverse(all(a));

		print(a);
	}
}

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

int main(){
    int n;
    cin >> n;
 
    int taro = 0, hanako = 0;
    rep(i,n){
        string t,h;
        cin >> t >> h;
        
        if(t>h) taro+=3;
        else if(t<h) hanako+=3;
        else {
            taro++;
            hanako++;
        }
    }
    cout << taro << " " << hanako << endl;
}





Measured memory_bytes: 3164
import sys
input = sys.stdin.readline
import numpy as np

def main():
    N, K = [int(item) for item in input().split()]
    h =np.array([int(item) for item in input().split()])
    # print(h.shape)
    dp = np.full(N+K, 10**10+1, dtype='int64')
    dp[0] = 0

    for i in range(1, N):
        max1 = min(N, i+K)
        cost = abs(h[i:max1] - h[i-1])
        # print(cost.shape, dp[i:max1].shape)
        dp[i:max1] = np.minimum(dp[i:max1], dp[i-1] + cost)

        # print(dp)
    print(dp[N-1])

main()

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

int main(){
 int a, b, c;
 cin>>a>>b>>c;
 
 int cnt = 0;
 for(int x = a; x <= b; x++){
 if(c % x == 0) cnt++;
}

cout<<cnt<<endl;

return 0;
}


Measured memory_bytes: 3084
#include <cstdio>
#include <string>
#include <iostream>

using namespace std;

int main()
{
	string str;
	
	while (getline(std::cin, str)){
		int i;
		char ci[3];
		
		int joi, ioi;
		joi = ioi = 0;
		for (i = 0; str[i + 2] != '\0'; i++){
			str.copy(ci, 3, i);
			string c = ci;
			if(c == "JOI"){
				joi++;
			}
			if(c == "IOI"){
				ioi++;
			}
		}
		
		printf("%d\n%d\n", joi, ioi);
	}
	
	return (0);
}

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

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

    int a, b;
    cin >> a >> b;
    if (a < b){
        cout << "a < b" << endl;
    }
    else if (a > b){
        cout << "a > b" << endl;
    }
    else{
        cout << "a == b" << endl;
    }

    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef array<ll, 2> XY;

int main()
{
    ll N;
    cin >> N;
    ll xi, yi;
    vector<XY> xy(N);
    for(int i=0;i<N;i++){
        cin >> xy[i][0] >> xy[i][1];
    }
    vector<double> thetaList(N);
    vector<double> thetaListCand(N);
    for(int i=0;i<N;i++){
        thetaList[i] = atan2(xy[i][1], xy[i][0]);
        thetaListCand[i] = thetaList[i];
    }
    sort(thetaListCand.begin(), thetaListCand.end());
    for(int i=0;i<N-1;i++){
        thetaListCand.push_back((thetaListCand[i] + thetaListCand[i+1])/2);
    }
    double tmp = (2*M_PI + thetaListCand[0] + thetaListCand[N-1])/2;
    if(tmp>2*M_PI) tmp -= 2*M_PI;
    if(tmp<-2*M_PI) tmp+= 2*M_PI;
    thetaListCand.push_back(tmp);
    sort(thetaListCand.begin(), thetaListCand.end());

    double res = 0;
    for(double theta : thetaListCand){
        XY cand1 = {0, 0};
        for(int j=0;j<N;j++){
            auto diffTheta = theta - thetaList[j];
            diffTheta = acos(cos(diffTheta));
            if(fabs(diffTheta) < M_PI/2){
                cand1[0] += xy[j][0];
                cand1[1] += xy[j][1];
            }
        }
        double d1 = cand1[0] * cand1[0] + cand1[1] * cand1[1];
        d1 = sqrt(d1);
        res = max(res, d1);
    }
    cout<<setprecision(12)<<res<<endl;

    return 0;
}


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

int main() {
    int A, B;
    cin >> A >> B;
    int ans = 0;
    if (A >= 13)
    {
        ans = B;
    } else if (A >= 6)
    {
        ans = B / 2;
    }
    
    cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
def warshall_floyd(c):
    d = {}

    for i in range(10):
        for j in range(10):
            d[i, j] = c[i][j]
    
    for k in range(10):
        for i in range(10):
            for j in range(10):
                d[i, j] = min(d[i, j], d[i, k] + d[k, j])
    
    return d

def answer(h, w, c, a):
    ans = 0
    d = warshall_floyd(c)
    count = []

    for i in range(10):
        count.append(0)
    
    for i in range(h):
        for j in range(w):
            if a[i][j] != -1:
                count[a[i][j]] += 1

    for i in range(10):
        ans += d[i, 1] * count[i]

    return ans


[h, w] = list(map(int, input().split()))
c = []
a = []

for i in range(10):
    c.append(list(map(int, input().split())))

for i in range(h):
    a.append(list(map(int, input().split())))

print(str(answer(h, w, c, a)))

Measured memory_bytes: 3444
#include <iostream>
#include <string>
#include <algorithm>

const int N = 2e5; 

std::string s[N + 5]; 
int n;

int que[N + 5], l, r; 

int main() {

    std::cin >> n; 
    for (int i = 1; i <= n; i ++) 
        std::cin >> s[i]; 
    std::sort(s + 1, s + n + 1); 
    //int m = std::unique(s + 1, s + n + 1) - (s + 1); 

    l = 0, r = 0; 
    int mx = 1; 
    int cnt = 1;
    for (int i = 2; i <= n; i ++) {
        if (s[i] == s[i - 1]) cnt ++; 
        else {
            if (cnt < mx) ;
            else if (cnt == mx) que[r ++] = i - 1; 
            else {mx = cnt; l = r; que[r ++] = i - 1;} 
            cnt = 1; 
        }
    }

    if (cnt < mx) ;
    else if (cnt == mx) que[r ++] = n; 
    else {
        mx = cnt; l = r; que[r ++] = n; 
    }

    while (l < r) std::cout << s[que[l ++]] << std::endl;

    return 0; 
}

Measured memory_bytes: 15104
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int m,n,a,ans =0;
    cin >> n >> m;
    int A[n][m];
    int b[m];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> a;
            A[i][j] = a;
        }
    }
    for(int i = 0; i < m; i++){
        cin >> a;
        b[i] = a;
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            ans += A[i][j] * b[j];
        }
        cout << ans << endl;
        ans = 0;
    }
    return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

#include <deque>

using T = tuple<ll, int, int>;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h, w;
    cin, h, w;
    int sx, sy, gx, gy;
    cin, sy, sx, gy, gx;
    sx--;
    sy--;
    gx--;
    gy--;
    auto mp = make_v(h, w, '#');
    REP(i, 0, h) {
        REP(j, 0, w) {
            cin, mp[i][j];
        }
    }

    deque<T> q;
    q.emplace_front(0LL, sx, sy);
    const int inf = 1 << 29;
    auto cost = make_v(h, w, inf);
    int ans = -1;
    while (q.size()) {
        auto [c, x, y] = q.front();
        q.pop_front();
        if (x == gx && y == gy) {
            ans = c;
            break;
        }
        if (cost[y][x] < c) continue;
        cost[y][x] = c;
        REP(dx, -2, 3) {
            REP(dy, -2, 3) {
                if (dx == 0 && dy == 0) continue;
                int nc = 1;
                if (dx * dy == 0 && abs(dx + dy) == 1) {
                    nc = 0;
                }
                int nx = x + dx;
                int ny = y + dy;
                if (0 <= nx && nx < w && 0 <= ny && ny < h && mp[ny][nx] == '.' && cost[ny][nx] > c + nc) {
                    cost[ny][nx] = c + nc;
                    if (nc == 0) {
                        q.emplace_front(c, nx, ny);
                    } else {
                        q.emplace_back(c + nc, nx, ny);
                    }
                }
            }
        }
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 8732
<?php
fscanf(STDIN, "%d %d %d", $n, $m, $c);
$b = trim(fgets(STDIN));

$b_arr = explode(" ", $b);

$count = 0;
for($i = 0; $i < $n; $i++){
  	$a = trim(fgets(STDIN));
  	$a_arr = explode(" ", $a);
  	$sum = 0;
  	for($j = 0; $j < $m; $j++){
    	$sum = $sum + $b_arr[$j]*$a_arr[$j];
    }
  	$sum = $sum + $c;
    if($sum > 0){
    	$count++;
    }
}

echo $count;
?>

Measured memory_bytes: 3576
T_hp, T_atk, A_hp, A_atk = tuple(map(int, input().split()))
while(True):
    A_hp -= T_atk
    if A_hp <= 0:
        print("Yes")
        break
    T_hp -= A_atk
    if T_hp <= 0:
        print("No")
        break

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

int n;
int v[110], w[110];

int memo[110][11000];

int solve(int i, int ww){
  if(i == n){
    return 0;
  }

  if(memo[i][ww] != -1){
    return memo[i][ww];
  }

  int ans = solve(i+1, ww);
  if(ww-w[i] >= 0){
    ans = max(ans, solve(i+1,ww-w[i])+v[i]);
  }

  return memo[i][ww] = ans;
}

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

  for(int i = 0;i < n;i++){
    cin >> v[i] >> w[i];
  }

  memset(memo, -1, sizeof(memo));

  cout << solve(0, ww) << endl;

  return 0;
}



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

using namespace std;

map< long long, int > prime_factor(long long n) {
	map< long long, int > ret;
	for (long long i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			ret[i]++;
			//n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

int main() {
	
	//for (long aaa = 2; aaa <= 118; aaa++) {
	//	for (long bbb = 1; bbb < aaa; bbb++) {
//	for (long aaa = 5; aaa <= 118; aaa++) {
	//	for (long bbb = 1; bbb < aaa; bbb++) {
//			cout << aaa <<  " " << bbb << endl;
			long long x;
//			x = pow(aaa, 5) - pow(bbb, 5);
			map<long long, int > a;
			cin >> x;
			a = prime_factor(x);
			a.insert(make_pair(1, 1));
			a.insert(make_pair(x, 1));
			auto iter = a.begin();

			while (1) {
//				bool chkflg = false;
				long long aa = 0;
				long long bb = 0;
				for (long long i = -200; i <= 200; i++) {
					aa = i;
					bb = aa - iter->first;
					if ((long long)pow(aa, 5) - (long long)pow(bb, 5) == x) {
						cout << aa << " " << bb << endl;
//						chkflg = true;
//						break;
						return 0;
					}
					bb = aa + iter->first;
					if ((long long)pow(aa, 5) - (long long)pow(bb, 5) == x) {
						cout << aa << " " << bb << endl;
//						chkflg = true;
//						break;
						return 0;
					}
					//			if (pow(aa, 5) > x) { break; }
				}
//				if (chkflg == true) { break; }
				if (iter == a.end()) { break; }
				iter = next(iter, 1);
			}
		}
//	}
//}

Measured memory_bytes: 4056
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#define ll  long long
#define out(a) printf("%d",a)
#define writeln printf("\n")
using namespace std;
int a,b;
int read()
{
	int s=0,t=1; char c;
	while (c<'0'||c>'9') {if (c=='-') t=-1; c=getchar();}
	while (c>='0'&&c<='9') {s=s*10+c-'0'; c=getchar();}
	return s*t;
}
ll readl()
{
	ll s=0,t=1; char c;
	while (c<'0'||c>'9') {if (c=='-') t=-1; c=getchar();}
	while (c>='0'&&c<='9') {s=s*10+c-'0'; c=getchar();}
	return s*t;
}
int main()
{
	a=read(); b=read();
	if (a>b) out(a-1);
	else out(a);
	return 0;
}

Measured memory_bytes: 256
using System;

namespace _1_csharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(" ");
            string S = Console.ReadLine();

            int passed = 0;
            int oPassed = 0;
            int limit = int.Parse(input[1]) + int.Parse(input[2]);
            for (int i = 0; i < int.Parse(input[0]); i++)
            {
                if (passed < limit)
                {
                    if (S[i] == 'a')
                    {
                        System.Console.WriteLine("Yes");
                        passed++;
                    }else if (S[i] == 'b')
                    {
                        if (oPassed < int.Parse(input[2]))
                        {
                            System.Console.WriteLine("Yes");
                            passed++;
                            oPassed++;
                        }else
                        {
                            System.Console.WriteLine("No");
                        }
                    }else
                    {
                        System.Console.WriteLine("No");
                    }
                }else
                {
                    System.Console.WriteLine("No");
                }
            }
        }
    }
}


Measured memory_bytes: 27940
#include <stdio.h>
#define maxn 200010
int cnt[maxn];
int main(){
	int n,i,a;
	scanf("%d",&n);
	for(i=2;i<=n;i++)scanf("%d",&a),cnt[a]++;
	for(i=1;i<=n;i++)printf("%d\n",cnt[i]);
	return 0;
}

Measured memory_bytes: 2476
//・二部探索で、Ax+Ay>=Pとなる(x,y)の組み合わせがM個以上になるPの最大値を求めたい
//・そうすると、あとでAx+Ay>=Pとなる(x,y)の組み合わせを探せば、丁度M個になる
//・求めた後、そうなる(x,y)の組み合わせを全探索（累積和を用いて高速化）して、和を求める
//・Axを決めて、Ax+Ay>=Pとなるyを二部探索で求め、累積和でAx*sum(Ai)を計算する
//・最後、M個以上足し算したため、はみ出た部分を引く
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

const int MAX_N = 100100;
ll A[MAX_N];
ll acum[MAX_N];
int N; ll M;

int b_search(ll Ax, ll P) { // Ax+Ay>=Pとなるyの最小値を求める (出力は最小で1)
    int ng = 0;
    int ok = N+1;
    while(abs(ok-ng) > 1) {
        int mid = (ok + ng)/2;
        if(Ax+A[mid] >= P) ok = mid;
        else ng = mid;
    }
    return ok;
}

ll order_ascend(ll P) { // Ax+Ay>=Pとなる(x,y)の組み合わせが何個あるか
    ll res = 0;
    for(int i = 1; i <= N; ++i) {
        int j = b_search(A[i], P);
        res += N-j+1;
    }
    return res;
}

ll more_than_M() {
    ll ok = 0LL;
    ll ng = 200010LL;
    while(abs(ok-ng) > 1) {
        int mid = (ok + ng)/2;
        if(order_ascend(mid) >= M) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main()
{
    scanf("%d %lld", &N, &M);
    for(int i = 1; i <= N; ++i){ scanf("%lld", &A[i]); }
    sort(A+1, A + N + 1);
    for(int i = 1; i <= N; ++i){ acum[i] = A[i];}
    for(int i = 1; i <= N; ++i) acum[i+1] += acum[i];
    ll P = more_than_M();
    ll res = 0LL;
    for(int i = 1; i <= N; ++i) {
        int j = b_search(A[i], P);
        // この計算だと、M個以上カウントしてしまう恐れがある。（二分探索で得られたPは「Ax+Ay>=Pとなる(x,y)がM個以上ある」ことしか補償しないので）
        res += A[i]*(N-j+1) + acum[N] - acum[j-1];
    }
    // はみでた部分を引く
    res -= (order_ascend(P) - M)*P;
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int A = sc.nextInt();
		int B = sc.nextInt();
		int T = sc.nextInt();
		
		System.out.println((T/A) * B);
	
	}
	
}



Measured memory_bytes: 21844
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846264338327950L
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int select(int a) {
  int b;
  if (a == 2)
    b = 0;

  else if (a == 4 || a == 6 || a == 9 || a == 11)
    b = 1;
  else
    b = 2;
  return b;
}

int main() {
  int x, y;

  cin >> x >> y;

  x = select(x);
  y = select(y);

  if (x == y)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX;
const ll MOD = 1e9+7;

int main() {
  ll N,A,B;cin >> N >> A >> B;
  if(A+B>N+1){
    cout << -1 << endl;
    return 0;
  }
  if(B==1){
    if(A!=N){
      cout << -1 << endl;
    }else{
      repeat(i,N){
        cout << i+1;
        cout << (i==N-1? "\n":" ");
      }
    }
    return 0;
  }
  if(B==N){
    if(A!=1){
      cout << -1 << endl;
    }else{
      repeat(i,N){
        cout << N-i;
        cout << (i==N-1? "\n":" ");
      }
    }
    return 0;
  }
  ll rest = N-B+1-A;
  ll hoge = (N-B)/B*(B-1);
  hoge += max(0ll,(N)%B-1);
  if(rest > hoge){
    cout << -1 << endl;
    return 0;
  }

  vll a;
  ll Q = rest/(B-1);
  ll idx = 0;
  repeat(q,Q){
    idx += B;
    repeat(b,B){
      a.push_back(idx-b);
    }
  }
  ll R = rest%(B-1)? rest%(B-1)+1:0;
  idx += R;
  repeat(b,R){
    a.push_back(idx-b);
  }
  repeat(b,N-B-idx){
    a.push_back(idx+b+1);
  }
  repeat(b,B){
    a.push_back(N-b);
  }
  repeat(i,N){
    cout << a[i];
    cout << (i==N-1? "\n":" ");
  }
  return 0;
}


Measured memory_bytes: 6512
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,t;
  cin>>n>>t;
  set<int> st;
  while(t--){
    int g;cin>>g;
  st.insert(g);
  }
  for(int i=n;i>=n;i++){
     string k =to_string(i);
    int f=0;
     for(int i=0;i<k.length();i++){
      if(st.find(k[i]-'0')!=st.end()){
        f=1;
        break;
      }
     }
    if(f==0){
    cout<<k;
      break;
    }
  }
}


Measured memory_bytes: 256
object Main{
 
def main(args: Array[String]): Unit = {
  val arr1 = io.StdIn.readLine().split(' ')
      val n = arr1(0).toInt

      val baseN = math.log10(n).toInt // x^n
      val ten = math.pow(10, baseN) // 一番左の桁
      val under = n - ten // 一番左の桁以外

      var count = (0 until baseN by 2).map{
        i =>
         val v = math.pow(10, i+1) - math.pow(10, i) 
        v
      }.sum
  
  	  if(baseN % 2 == 0){
      	count += (under + 1)
      }

      println(count.toInt)
}
}

Measured memory_bytes: 25408
void main()
{
    long n, m;
    rdVals(n, m);
    long[][] edge = new long[][](n);
    foreach (i; 0 .. m)
    {
        long a, b;
        rdVals(a, b);
        --a, --b;
        edge[a] ~= b, edge[b] ~= a;
    }

    long[] dist = new long[n];
    long[] que;
    que ~= 0;
    while (!que.empty)
    {
        long now = que.front;
        que.popFront;
        foreach (e; edge[now])
        {
            if (dist[e]) continue;
            dist[e] = now + 1;
            que ~= e;
        }
    }

    "Yes".writeln;
    foreach (i; 1 .. n)
    {
        dist[i].writeln;
    }
}

enum long mod = 10L^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 26268
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)

    val h = sc.nextInt()
    val a = sc.nextInt()
    val hits = h / a + if (h % a == 0) 0 else 1
    println(hits)
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}





Measured memory_bytes: 29348
import sys
N, M = map(int, input().split())
X = sorted(list(map(int,input().split())))
A = []
sum = 0
if N >= M:
    print(0)
    sys.exit()
else:
    for i in range(M - 1):
        A.append(X[i + 1] - X[i])
    A = sorted(A, reverse = True)
    for k in A[N - 1:]:
        sum += k
print(sum)

Measured memory_bytes: 58536
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define it   iterator

int main() {

ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll int a,b;
cin>>a>>b;
if((a+b)%2==0)
{
  cout<<(a+b)/2<<endl;
}
else{
  cout<<"IMPOSSIBLE"<<endl;
}

 
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double

int n,c[20],v[20];

int main(void)
{
    cin >> n;
    rep(i,n)
    {
        cin >> v[i];
    }
    rep(i,n)
    {
        cin >> c[i];
    }
    int res = 0;
    rep(i,n)
    {
        if(c[i] < v[i])
            res += v[i] - c[i];
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.text.*;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}
	
	private void run() {
		Scanner scan = new Scanner(System.in);
		while (scan.hasNext()) {
			double a = scan.nextInt();
			double b = scan.nextInt();
			double e = scan.nextInt();
			double c = scan.nextInt();
			double d = scan.nextInt();
			double f = scan.nextInt();
			
			double x = (d * e - b * f) / (a * d - b * c);
			double y = (a * f - c * e) / (a * d - b * c);
			
			NumberFormat nf = NumberFormat.getInstance();
			nf.setMaximumFractionDigits(3);
			nf.setMinimumFractionDigits(3);
			
			if (x == 0) x = 0;
			if (y == 0) y = 0;
			
			System.out.println(nf.format(x) +" "+ nf.format(y));
		}
	}
}

Measured memory_bytes: 18176
#include<iostream>
#include<cstddef>

using ui = std::uint32_t;


int main(){
	ui a, b;
	std::cin >> a >> b;

	const auto t = a + b;

	if( t % 2 == 0 )
		std::cout << t / 2;
	else
		std::cout << "IMPOSSIBLE";
	std::cout << "\n";

	return 0;
}

Measured memory_bytes: 888
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()

signed main() {
	std::string s;
	std::cin >> s;
	char last = s[0];
	rep(i,3)
	{
		if(last==s[i+1]) {print("Bad");return 0;}
		last = s[i+1];
	}
	print("Good");
  return 0;
}


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

int main(){
    string s;   cin>>s;
    int a=0,b=0,c=0;

    for(int i=0;i<3;i++){
        if(s[i]=='a')a++;
        if(s[i]=='b')b++;
        if(s[i]=='c')c++;
    }

    if(a==1&&b==1&&c==1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1LL<<60)


#define MAX_V 1000

struct edge{int to,cost;};
vector<edge> G[MAX_V];

int shortest_path(int s,vector<int> &d){
    int ans1, ans2;
    int v = d.size();
    rep(i,d.size())d[i]=-INF;
    d[s]=0;
    rep(loop,2*v+1){
        bool update = false;
        rep(i,MAX_V){
            for(auto e:G[i]){
                if(d[i]!=INF && d[e.to] < d[i]+e.cost){
                    d[e.to] = d[i]+e.cost;
                    update = true;
                }
            }
        }
        if(!update)break;
        if(loop==v-1){
            ans1 = d[v-1];
        }
        if(loop==2*v){
            ans2 = d[v-1];
            if(ans1!=ans2){
                return true;
            }
            else return false;
        }
    }
    return false;
}

signed main(){
    int v,e;
    cin>>v>>e;
    rep(i,e){
        int a,b,c;
        cin>>a>>b>>c;
        G[a-1].pb(edge{b-1,c});
    }
    
    vector<int> d(v);
    bool res = shortest_path(0,d);
    if(res)cout<<"inf"<<endl;
    else cout<<d[v-1]<<endl;
}

Measured memory_bytes: 384
#include <stdio.h>
#define NIL -1

typedef struct node {
    int p, l, r;
}Node;

Node T[100];
int pre[100];
int in[100];
int post[99];
int pos = 0;
int pos2 = 0;
int findPos(){
    for (int i = 1; i < 100; i++)
        if (in[i] == pre[pos])
            return i;
    return NIL;
}

void rebuild(int l, int r){
    if (l >= r) return ;

    int c = pre[++pos];

    int mid = findPos(); 
    rebuild (l, mid);
    rebuild (mid+1, r);
    post[pos2++] = c;
}

int main(){
    int n, num, p;
    int root;
    
    scanf("%d", &n);
    for (int i = 1 ; i <= n; i++){
        T[i].p = NIL;
    }
    for(int i = 1; i <= n; i++){
        scanf ("%d", &pre[i]);
    }
    for(int i = 1; i <= n; i++){
        scanf ("%d", &in[i]);
        // if (in[i] == pre[1]) root = in[i];
    }

    rebuild(1, n+1);
    // printPostorder();
    for (int i= 0; i < n; i++){
        if (i) printf(" ");
        printf("%d", post[i]);
    }
    printf("\n");

    return 0;
}


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

using namespace std;
#define max 1e18
int main(){
    long k,a,b;
    cin >> k;
    cin >> a >> b;
    for(int i=a; i<=b; i++){
        if(i%k==0){
          cout << "OK" << endl;
          return 0;}
    }
    cout << "NG" << endl;
    return 0;
}

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

int main() {
    long n, c, k, t, cnt = 0, ans = 0;
    cin >> n >> c >> k;
    vector<long> time(n);
    rep(i, n) cin >> time.at(i);
    sort(time.begin(), time.end());
    t = time.at(0) + k;
    rep(i, n) {
        if(cnt == c) {
            t = time.at(i) + k;
            ans++;
            cnt = 1;
            continue;
        } else if(time.at(i) <= t) {
            cnt++;
            continue;
        } else {
            t = time.at(i) + k;
            ans += (cnt + c - 1) / c;
            cnt = 1;
        }
    }
    if(cnt) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cmath>
#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
const int inf = 1000000000; //10^9

ll N,M,Q;
ll ans=0;
vector<int>a,b,c,d;

void search(int x,vector<int>A){
    if (x==N)
    {
        ll cost=0;
        for (int i = 0; i < Q; i++)
        {
            if (A[b[i]]-A[a[i]]==c[i])
            {
                cost+=d[i];
            }
        }
        ans = max(ans,cost); //max,minは型を揃える
        return; //関数が終了する
    }
    for (int i = A[x-1]; i <= M; i++)
    {
        A.push_back(i);
        search(x+1,A);
        A.pop_back(); //一番最後の数字を削除する,次のループに備える
    }
}



int main(){
    cin >> N >> M >> Q;
    a.resize(Q);
    b.resize(Q);
    c.resize(Q);
    d.resize(Q);

    for (int i = 0; i < Q; i++)
    {
         cin >> a[i] >> b[i] >> c[i] >> d[i];
         a[i]--;
         b[i]--;
    }
    for (int i = 1; i <= M; i++)
    {
        vector<int>A;
        A.push_back(i);
        search(1,A);
    }

    cout << ans << endl;
    
    


}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
const int N=2010,mod=1e9+7;
typedef long long ll;
ll f[N];
int n;
void init(){
	f[0]=1;
    for(int i=3;i<=2000;i++){
    	for(int j=3;j<=i;j++)
    	{
    	    
    	    	f[i]=f[i]+f[i-j];
    	    	f[i]%=mod;
				
		}
    	
	}
}
int main(){
	init();
	scanf("%d",&n);
	printf("%lld\n",f[n]);
	return 0;
}

Measured memory_bytes: 3836