akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cins(int, n, v); Cins(int, n, c);
    int ans = 0;
    For(i, n) ans += max(0, v[i]-c[i]);
    Cout(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int A, B;
    cin >> A >> B;
    if(A+B >=10){
        cout << "error" << endl;
    } else {
        cout << A+B << endl;
    }
}


Measured memory_bytes: 3600
#include<stdio.h>
main(){
  char a[8][8],b[8][8],c[8][8],d[8][8];
  int i,j;
  for(i=0;i<8;i++)
      scanf("%s",&a[i]);
  printf("90\n");
  for(i=0;i<8;i++){
    for(j=7;j>=0;j--){
      printf("%c",a[j][i]);
    }
    puts("");
  }

  printf("180\n");
  for(i=7;i>=0;i--){
    for(j=7;j>=0;j--){
      printf("%c",a[i][j]);
    }
    printf("\n");
  }
  printf("270\n");
  for(i=7;i>=0;i--){
    for(j=0;j<8;j++){
      printf("%c",a[j][i]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
using namespace std;


int main() {
    int x,y;
    cin>>x>>y;
    printf("%.9f\n",1.0*x/y);
    return 0;
}


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

int main()
{
  int a, b;
  cin >> a >> b;
  int num;
  int ch = 0;
  if(b < 10) num = 10*a+b;
  else if(b < 100) num = 100*a+b;
  else num = 1000*a+b;
  for(int i = 0; i < 400; i++)
  {
    if(i*i == num)
    {
      ch = 1;
      break;
    }
  }
  if(ch == 1)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import functools
import  sys

sys.setrecursionlimit(10**6)
@functools.lru_cache()
def ryuca(l):
	if l == 0:
		return 2
	elif l == 1:
		return 1
	else:
		 return ryuca(l-1) + ryuca(l-2)
print(ryuca(int(input())))


Measured memory_bytes: 67288
#include <iostream>

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

    int ans;
    if(b < a + w){
        if(b + w < a){
            ans = a - (b + w);
        }else{
            ans = 0;
        }
    }else{
        if(a <= b && b <= a + w){
            ans = 0;
        }else{
            ans = b - (a + w);
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 105;
int n,m,k,mo,f[N][N][N],g[N][N][N],C[N][N],mi1[N*N],mi2[N*N];
inline void add(int &x, int y){x=x+y<mo?x+y:x+y-mo;}
inline int power(int a, int n) {
	int res=1;
	while (n) {
		if (n&1) res=1LL*res*a%mo;
		a=1LL*a*a%mo; n>>=1;
	}
	return res;
}

int main() {
	read(n);read(m);read(k);read(mo);
	rep(i,0,N-1){
		C[i][0]=C[i][i]=1;
		rep(j,1,i-1)C[i][j]=(C[i-1][j-1]+C[i-1][j])%mo;
	}
	g[0][0][0]=1;
	rep(v,1,k){
		mi1[0]=1;rep(i,1,n*m)mi1[i]=1LL*mi1[i-1]*v%mo;
		mi2[0]=1;rep(i,1,n*m)mi2[i]=1LL*mi2[i-1]*(k-v+1)%mo;
		static int xs[N][N];
		rep(j,0,m){int t=power(v-1,m-j);xs[j][0]=1;rep(x,1,n)xs[j][x]=1LL*xs[j][x-1]*(mi1[m-j]-t+mo)%mo;}
		rep(i,0,n)rep(j,0,m)if(g[v-1][i][j])rep(x,0,n-i)
			f[v][i+x][j]=(f[v][i+x][j]+1LL*g[v-1][i][j]*C[n-i][x]%mo*mi2[x*j]%mo*xs[j][x])%mo;
		rep(i,0,n){int t=power(k-v,i);xs[i][0]=1;rep(y,1,m)xs[i][y]=1LL*xs[i][y-1]*(mi2[i]-t+mo)%mo;}
		rep(i,0,n)rep(j,0,m)if(f[v][i][j])rep(y,0,m-j)
			g[v][i][j+y]=(g[v][i][j+y]+1LL*f[v][i][j]*C[m-j][y]%mo*mi1[(n-i)*y]%mo*xs[i][y])%mo;
	//	rep(i,0,n)rep(j,0,m)cerr<<i<<' '<<j<<' '<<f[v][i][j]<<' '<<g[v][i][j]<<endl;
	}
	cout<<g[k][n][m]<<endl;
	return 0;
}


Measured memory_bytes: 9216
h,*s=open(0)
h,w=map(int,h.split())
r=range
a,b,c,d=[[[0]*w for _ in r(h)]for i in r(4)]
for i in range(h*w):
    i,j=i//w,i%w
    a[i][j]=-~a[i][j-1]*(s[i][j]=='.')
    b[i][~j]=-~b[i][-j]*(s[i][-j-2]=='.')
    c[i][j]=-~c[i-1][j]*(s[i][j]=='.')
    d[~i][j]=-~d[-i][j]*(s[~i][j]=='.')
print(max(a[i][j]+b[i][j]+c[i][j]+d[i][j]-3for i in r(h)for j in r(w)))

Measured memory_bytes: 181980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int MAX = 2000;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long mod_comb(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {
  COMinit();
  
  int n, k;
  cin >> n >> k;
  for(ll i=1; i<=k; i++) {
    cout << (mod_comb(n-k+1, i) * mod_comb(k-1, i-1)) % MOD << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define push_back pb
#define make_pair mp
using ll =  long long;
const int INF = 0x3f3f3f3f;

const int MAX_N = 1e5+10;
int N, K;
double prob[MAX_N];
double dp[MAX_N];
const double EPS=1e-6;

double dfs(int score)
{
	//return prob. of winning if current score is score
	if(score >= K) return 1.0;
	if(score == 0) return 0;
	return 0.5*dfs(2*score);
}

void solve()
{
	for(int i=1;i<=N;++i) prob[i] = 1.0/N;
	double ans = 0.0;
	for(int i=1;i<=N;++i){
		ans += prob[i]*dfs(i);
	}
	cout << setprecision(15);
	cout << ans << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N >> K;
	solve();
	return 0;
}

Measured memory_bytes: 1024
n,y=map(int,input().split())
for i in range (n+1):
    for j in range(n+1-i):
        k=n-i-j
        if 10000*i+5000*j+1000*k==y:
            print("{} {} {}".format(i,j,k))
            exit(0)
print("-1 -1 -1")

Measured memory_bytes: 2940
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

//#include "Union_Find.h"

#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
//#include <unordered_set>
//#include <unordered_map>
#include <iomanip>
#include <sstream>

using namespace std;
#define REP(i,a,n) for(int i = a; i < n; ++i)
#define REPM(i,n,a) for(int i = n - 1; i >= a; --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
typedef long long LL;
typedef unsigned long long ULL;

typedef pair<LL, LL> PP;

int Add(int a, int b) {
	return a + b;
}
int Sub(int a, int b) {
	return a - b;
}
int(*F[])(int, int) = { Add, Sub };

int A, B;
char OP;

int main() {
	cin >> A >> OP >> B;
	cout << (*F[OP == '-'])(A, B) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007

using namespace std;


int main(int argc, char* argv[])
{
    long w, h;
    scanf("%ld%ld", &w, &h);

    vector<ll> ww(w), hh(h);
    vector<pair<ll, pair<long,long> > >  z;    // cost, type(0/1), id   
    long i;
    for(i=0; i<w; i++) {
        scanf("%lld", &ww[i]);
        z.push_back(make_pair( ww[i], make_pair(i, 0) ));
    }
    for(i=0; i<h; i++) {
        scanf("%lld", &hh[i]);
        z.push_back(make_pair( hh[i], make_pair(i, 1) ));
    }
    sort(z.begin(), z.end());

    ll ans=0;

    long numw=w+1;
    long numh=h+1;

    for(i=0; i<w+h; i++) {
        long id = z[i].second.first;
        long type = z[i].second.second;
        if(type==0) {
            ans += (ll)numh*z[i].first;
            numw--;
        }
        else {
            ans += (ll)numw*z[i].first;
            numh--;
        }
    }

    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 10096
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode
import sys
sys.setrecursionlimit(10 ** 6)

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

n,m = MI()
ab = LI(m)

ls_s = []
ls_e = []
for i in range(m):
    a = ab[i][0]
    b = ab[i][1]
    if a==1:
        ls_s.append(b)
    elif b==n:
        ls_e.append(a)

ls = set(ls_s) & set(ls_e)
if len(ls)!=0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 138128
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var sss = ReadSplit();
            Println($"{sss[0][0]}{sss[1][0]}{sss[2][0]}".ToUpper());
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 13268
n =int(input())

if n < 10:
    print(n)
elif 10 <= n < 100:
    print(9)
elif 100 <= n <1000:
    print(n-90)
elif 1000 <= n < 10000:
    print(909)
elif 10000 <= n < 100000:
    print(n-9090)
elif 100000 <= n < 1000000:
    print(90909)

Measured memory_bytes: 3064
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.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
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);
        EWhoSaysAPun solver = new EWhoSaysAPun();
        solver.solve(1, in, out);
        out.close();
    }

    static class EWhoSaysAPun {
        long ans = 0;
        int n = 0;

        public void z(char a[]) {
            int z[] = new int[n];
            int l = 0;
            int r = 0;
            int k = 0;
            for (int i = 1; i < n; i++) {
                if (i > r) {
                    l = r = i;
                    while (r < n && a[r - l] == a[r])
                        r++;
                    z[i] = r - l;
                    r--;
                } else {
                    k = i - l;
                    if (z[k] < r - i + 1)
                        z[i] = z[k];
                    else {
                        l = i;
                        while (r < n && a[r - l] == a[r])
                            r++;
                        z[i] = r - l;
                        r--;
                    }
                }
            }
            for (int j = 0; j < n; j++) {
                ans = Math.max(ans, Math.min(z[j], j));
            }

        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            String x = in.next();
            char a[] = x.toCharArray();
            for (int i = 0; i < x.length(); i++) {
                a = x.substring(i, x.length()).toCharArray();
                z(a);
                n--;
            }
            out.println(ans);

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}



Measured memory_bytes: 60116
import std.stdio;
import std.algorithm;
import std.conv;
import std.array;
import std.string;
import std.math;

void main(string[] args) {
  readln.chomp.solve.writeln;
}

auto solve(string input) {
  return input.count("1");
}

unittest {
  assert(solve("101") == 2);
  assert(solve("000") == 0);
  assert(solve("0001") == 1);
}


Measured memory_bytes: 256
package main

import (
  "fmt"
)

func main() {
  var a, b int
  fmt.Scan(&a, &b)
  if a < b {
    fmt.Println("a < b")
  } else if a > b {
    fmt.Println("a > b")
  } else {
    fmt.Println("a == b")
  }
}



Measured memory_bytes: 1124
package main

import (
	"fmt"
)

func main() {
	n, a, b := 0, 0, 0
	fmt.Scanf("%d %d %d", &n, &a, &b)

	bCount := a * (n / (a + b))
	left := n - (a+b)*(n/(a+b))
	bCount += mn(a, left)

	fmt.Println(bCount)

}
func mn(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 512
use std::io::Read;

fn main() {
    let (x, y) = {
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        let x: usize = iter.next().unwrap().parse().unwrap();
        let y: usize = iter.next().unwrap().parse().unwrap();
        (x, y)
    };
    for i in 0..(x + 1) {
        if (i * 2 + (x - i) * 4) == y {
            println!("Yes");
            return
        }
    }
    println!("No");
}


Measured memory_bytes: 2100
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    int A = sc.nextInt();
    int B = sc.nextInt();
    String U = sc.next();
    
    if (U.equals(S)) {
      A--;
    } else {
      B--;
    }
    
    System.out.print(A + " " + B);
    
  }
}

Measured memory_bytes: 21844
// StandardDeviation.cc
// n 人の学生を含むクラスでプログラミングの試験を行った。
// それぞれの得点をs1, s2 ... snとしたときの、標準偏差を求めるプログラムを作成せよ。
//
// 得点の平均値をｍとすれば、分散α2は以下の式で得られる：
// α^2 = (∑i=1 n (s[i] - m)^2) / n
//
// 分散の正の平方根が標準偏差αとなる。
//
// 【入力】
// 複数のデータセットが入力として与えられる。各データセットは以下の形式で与えられる：
// 学生の数 n
// s1 s2 ... sn
// n が 0 のとき入力の終わりとする。
// 【出力】
// 各データセットに対して、標準偏差を１行に出力せよ。
// ただし、0.0001以下の誤差があってもよい。
// 【制約】
// ・入力で与えられる n が1000を超えることはない。
// ・0 ≤ si ≤ 100
// 【例】
// 入力：
// 5
// 70 80 100 90 20
// 3
// 80 80 80
// 0
// 出力：
// 27.85677655
// 0.00000000
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main( void) {
  int n;	// 学生の数；
  int s[1000];	// 得点。学生は1000人を超えることはない。
  double S;	// 得点の合計
  double m;	// 平均点
  double sigma;
  double alpha;	// 標準偏差

  while ( true) {
    cin >> n;
    if ( n == 0) break;

    S = (double)0;
    for ( int i = 0; i < n; i++) {
      cin >> s[i];
      S += s[i];
    }

    m = S / n;

    sigma = 0;
    for ( int i = 0; i < n; i++) {
      sigma += pow( s[i] - m, 2);
    }
    
    alpha = sqrt( sigma / n);

    printf( "%.8lf\n", alpha);
  }

  return 0;
}



Measured memory_bytes: 3144
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

#define INF 10000000000
int main(){
    ll n, a;
    cin >> n >> a;
    ll dic[55][1000] = {};
    dic[0][500] = 1;
    ll x[n+1];
    rep(i, n)cin >> x[i+1];
    for(int i = 1; i <= n; ++i){
        for(int j = i; j > 0; --j){
            for(int k = 0; k < 1000; ++k){
                if(dic[j-1][k]>0)if(k+x[i]-a < 1000 && k+x[i]-a >= 0){
                    dic[j][k+x[i]-a]+=dic[j-1][k];
                }
            }
        }
    }
    ll ans = 0;
    for(int i = 1; i <= n; ++i)ans += dic[i][500];
    cout << ans << endl;

}

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)

void chmin(int &a, int b) { if(a > b) a = b; }

int N, A, B, C;
vector<int> l;

int rec(int idx, int a, int b, int c) {
    if(idx == N) {
        if(!a || !b || !c) return INF;
        return abs(A-a)+abs(B-b)+abs(C-c); 
    }
    int res = rec(idx+1, a, b, c);
    chmin(res, rec(idx+1, a+l[idx], b, c)+(a ? 10 : 0));
    chmin(res, rec(idx+1, a, b+l[idx], c)+(b ? 10 : 0));
    chmin(res, rec(idx+1, a, b, c+l[idx])+(c ? 10 : 0));
    return res;
}

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

    cin >> N >> A >> B >> C;
    l.resize(N);
    rep(i, N) cin >> l[i];
    
    cout << rec(0, 0, 0, 0) << '\n';
    return 0;
}

Measured memory_bytes: 256
// Shinchan Loves Coding :)))
#include<bits/stdc++.h>
#include<map>
#include<set>
#include<stack>
using namespace std;

#define night_rider ios::sync_with_stdio(false);cin.tie(NULL);
#define int long long int
#define double long double
#define en "\n"
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
typedef vector<int> vi;
typedef pair<int,int> vii;
bool secdes(const pair<int,int>&a , const pair<int,int>&b){if(a.se==b.se){return a.fi>b.fi;}else{return a.se>b.se;}}//second descending !
bool sir(const pair<int,int>&a , const pair<int,int>&b){if(a.fi==b.fi){return a.se>b.se;}else{return a.first>b.first;}}//first descending !
bool bysec(const pair<int,int>&a , const pair<int,int>&b){if(a.se==b.se){return a.fi<b.fi;} else{return a.se<b.se;}}//second ascending !

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/

const int no=3e6+5;
const int modulo=1e9+7;
const int inf=1e18+9;
const int N=1001;
int a[no]={},b[no]={},cc[no]={},suma[no]={},mat[N][N]={{0}};
stack<int> S;
stack<int> ma;

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/

int poww(int x, int y, int modulo) {x %= modulo;int res=1;while (y > 0) {if (y & 1){res = res * x % modulo;}x = x * x % modulo;y >>= 1;}return res;}

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/
int n=0,m=0,q=0,x=0,w=0,y=0,z=0,t=1;
void solve(){
    cin>>n;
    if(n>=30) cout<<"Yes"<<en;
    else cout<<"No"<<en;
}

void runn(){
    #ifndef ONLINE JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}

signed main()
{
    night_rider
    //runn();
    //cin>>t;q=t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 3652
#include<map>
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<ctime>
#include<vector>
#include<bitset>
#include<string>
#include<cstdio>
#include<numeric>
#include<utility>
#include<sstream>
#include<cstdlib>
#include<iomanip>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#define _USE_MATH_DEFINES
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define endl "\n"
typedef long long int lli;
typedef unsigned long long int uli;
const uli mod = 1e9 + 7;
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);


    int64_t n, sum = 0;
    cin >> n;
    vector<string> a(n);
    map<string, int64_t> b;
    for(int64_t i = 0; i < n; ++i) {
        cin >> a[i];
        sort(a[i].begin(), a[i].end());
    }
    for(int64_t i = 0; i < n; ++i) {
        ++b[a[i]];
    }
    for(auto i : b) {
        if(i.second == 1)
            i.second = 0;
        if(i.second == 2)
            i.second = 1;
        if(i.second >2) {
            i.second = i.second * (i.second - 1) / 2;
        }
        sum += i.second;
        //cout << sum << ' ' << i.second << endl;

    }
    cout << sum << endl;
}

Measured memory_bytes: 14288
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
template<class T, class T2> inline void chkmax(T &x, const T2 &y) { if(x < y) x = y; }
template<class T, class T2> inline void chkmin(T &x, const T2 &y) { if(x > y) x = y; }
const int MAXN = (1 << 20);

int n;
int a[MAXN], b[MAXN], c[MAXN];
map<int, int> mp;

void read()
{
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < n; i++) cin >> b[i];
	for(int i = 0; i < n; i++) cin >> c[i];
}

void solve()
{
	int64_t dp[4];
	dp[0] = 1;
	dp[1] = 0;
	dp[2] = 0;
	dp[3] = 0;
	vector<pair<int, int> > li;
	for(int i = 0; i < n; i++) li.push_back({a[i], 1});
	for(int i = 0; i < n; i++) li.push_back({b[i], 2});
	for(int i = 0; i < n; i++) li.push_back({c[i], 3});

	sort(li.begin(), li.end());
	for(int i = 0; i < (int)li.size(); )
	{
		int j = i;
		int64_t cnt[4];
		cnt[1] = 0;
		cnt[2] = 0;
		cnt[3] = 0;
		while(i < (int)li.size() && li[i].first == li[j].first) cnt[li[i].second]++, i++;

		dp[3] += cnt[3] * 1ll * dp[2]; 
		dp[2] += cnt[2] * 1ll * dp[1]; 
		dp[1] += cnt[1] * 1ll * dp[0]; 
	}

	cout << dp[3] << endl;
}

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

	read();
	solve();
	return 0;
}



Measured memory_bytes: 10864
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <random>
#include <fstream>
#include <time.h>
// #define int long long
#define debug(x) cerr << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double EPS = 1e-9;


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

  int h,w,n,sr,sc;
  cin>>h>>w>>n>>sr>>sc;
  string s,t;
  cin>>s>>t;
  sr--;sc--;
  int dx[4] = {0,0,-1,1};
  int dy[4] = {-1,1,0,0};
  char moji[4] = {'L', 'R', 'U', 'D'};
  map<char, char> rev = {{'L','R'}, {'R','L'}, {'U','D'}, {'D','U'}};
  int revnum[4] = {1,0,3,2};
  bool drop = false;
  rep(i,4) {
    int x = sr;
    int y = sc;
    rep(j,n) {
      if(s[j] == moji[i]) {
        x += dx[i];
        y += dy[i];
      }
      if(x < 0 || x >= h || y < 0 || y >= w) {
        drop = true;
        break;
      }
      if(t[j] == rev[moji[i]]) {
        int nx = x + dx[revnum[i]];
        int ny = y + dy[revnum[i]];
        if(nx >= 0 && nx < h && ny >= 0 && ny < w) {
          x = nx;
          y = ny;
        }
      }
    }
  }
  if(drop) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }

  return 0;
}


Measured memory_bytes: 920
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    int[] inf = new int[N+1];
    int now = 0;
    int paint = 1;
    int max = 0;
    int[][] val = new int[N-1][4];
    for(int i = 0; i < N-1; i++){
      String[] S = sc.nextLine().split(" ");
      val[i][0] = Integer.parseInt(S[0]);
      val[i][1] = Integer.parseInt(S[1]);
      val[i][2] = i;
    }
    Arrays.sort(val, (a,b)->Integer.compare(a[0],b[0]));
    
    for(int i = 0; i < N-1; i++){
      int a = val[i][0];
      int b = val[i][1];
      if(a == now){
        paint++;
      }else{
        now = a;
        paint = 1;
      }
      if(inf[a] == paint){
        paint++;
      }
      val[i][3] = inf[b] = paint;
      max = max < paint ? paint : max;
    }
    
    Arrays.sort(val, (a,b)->Integer.compare(a[2],b[2]));
    System.out.println(max);
    for(int[] n : val){
      System.out.println(n[3]);
    }
  }
}

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

int main(){
  char X, Y;
  cin >> X >> Y;
  if(X>Y){
    cout << '>' << endl;
    return 0;
  }else if(X<Y){
    cout << '<' << endl;
    return 0;
  }
  cout << '=' << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア　タイプでふ
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if ((int)b / a >= c)
    {
        cout << c;
    }
    else
    {
        cout << (int)b / a;
    }
}

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

int main() {
  int N,i,cou=0,r=0;
  cin>>N;
  vector<char> c(N);
  for(i=0;i<N;i++){
    cin>>c[i];
    if(c[i]=='R')r++;
  }
  for(i=0;i<r;i++){
    if(c[i]=='W')cou++;
  }
  cout<<cou<<endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ve vector
char ind[26] = {'z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y'};
int main(){
    ll n;
    cin >> n;
    string ans;
    while(n>0){
        int j = n % 26;
        ans += ind[j];
        if(j==0)j=26;
        n -= j;
        n /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}

Measured memory_bytes: 3636
n,m=map(int,input().split())
hs=list(map(int,input().split()))
ab=[list(map(int,input().split())) for _ in range(m)]

ans=[1]*n
for a,b in ab:
    if hs[a-1]>hs[b-1]:
        ans[b-1]=0
    elif hs[a-1]<hs[b-1]:
        ans[a-1]=0
    elif hs[a-1]==hs[b-1]:
        ans[a-1]=0
        ans[b-1]=0
print(sum(ans))


Measured memory_bytes: 32040
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		String str;
		while(sc.hasNext()){
			str=sc.next();
			char[] ch=new char[str.length()];
			for(int i=0;i<str.length();i++){
				ch[i]=str.charAt(i);
			}
			char[] ans=new char[str.length()];
			for(int i=0;i<str.length();i++){
				ans[i]=ch[str.length()-i-1];
			}
			str=String.valueOf(ans);
			System.out.println(str);
		}
		sc.close();
	}
}

Measured memory_bytes: 17124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<int, int>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main() {
	ll n; cin >> n;
	vector<pll> ab(n), ba(n);
	vector<ll> comp;
	for(int i = 0; i < n; ++i){
		cin >> ab[i].first >> ab[i].second;
		ba[i] = ab[i];
		swap(ba[i].first, ba[i].second);
	}
	sort(ab.begin(), ab.end());
	sort(ba.begin(), ba.end(), greater<pll>());
	ll s = 0, e = 0;
	if(n % 2 == 0){
		s = ab[n / 2 - 1].first + ab[n / 2].first;
		e = ba[n / 2 - 1].first + ba[n / 2].first;
	}
	else{
		s = ab[n / 2].first;
		e = ba[n / 2].first;
	}
	ll ans = e - s + 1;
	cout << ans << endl;
}

Measured memory_bytes: 6424
# import numpy as np

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

diceProb = 1/N
tmp = 0
tmpVal = 0
prevCnt = 0

for n in range(1,N+1):
	tmpVal = n
	cnt = 0
	while tmpVal < K:
		tmpVal *= 2
		cnt += 1

	if prevCnt != cnt:
		# print(cnt,n)
		prevCnt = cnt
	tmp += 2**(-cnt)


print("{:.12f}".format(tmp*diceProb))

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n;
ll a[100010],b[100010];
int main(){
	scanf("%lld",&n);
	rep(i,0,n+1)scanf("%lld",a+i);
	rep(i,0,n)scanf("%lld",b+i);
	ll ans=0;
	for(int i=n-1;i>=0;i--){
		ll temp=min(a[i+1],b[i]);
		ans+=temp;
		b[i]-=temp;
		temp=min(a[i],b[i]);
		ans+=temp;
		b[i]-=temp;
		a[i]-=temp;
	}
	printf("%lld",ans);
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/01/27  Problem: nikkei_2019_qual C / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL ans = 0LL;

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

	LL N;
	cin >> N;
	VL a(N), b(N);
	FOR(i, 0, N) {
		cin >> a[i] >> b[i];
	}
	using tp = tuple<LL, LL, LL>;
	vector<tp>c(N);
	FOR(i, 0, N) {
		c[i] = tp(a[i] + b[i], a[i], b[i]);
	}
	RSORT(c);
	FOR(i, 0, N) {
		LL x, y, z;
		tie(x, y, z) = c[i];
		if (i % 2 == 0)ans += y;
		else ans -= z;
	}




	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 4224
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

const ll mod = 998244353LL;

ll power_mod(ll num, ll power) {
    ll prod = 1;
    num %= mod;
    while (power > 0) {
        if (power & 1) {
            prod = prod * num % mod;
        }
        num = num * num % mod;
        power >>= 1;
    }
    return prod;
}

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

    int n, m, A[300][300];
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> A[i][j];
        }
    }

    int rank = 0;
    for (int j = 0; j < m; j++) {
        int pivot = -1;

        for (int i = rank; i < n; i++) {
            if (A[i][j]) {
                pivot = i;
                break;
            }
        }

        if (pivot >= 0) {
            if (pivot != rank) {
                for (int k = 0; k < m; k++) {
                    swap(A[pivot][k], A[rank][k]);
                }
            }

            for (int i = rank + 1; i < n; i++) {
                if (A[i][j]) {
                    for (int k = 0; k < m; k++) {
                        A[i][k] ^= A[rank][k];
                    }
                }
            }

            rank++;
        }
    }

    cout << (power_mod(2LL, (ll)(n+m-1)) - power_mod(2LL, (ll)(n+m-rank-1)) + mod) % mod << "\n";
    return 0;
}

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

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

Measured memory_bytes: 3628
n,k=map(int,input().split())
data=list(map(float,input().split()))
new_data=[0]*n
for i in range(n):
    new_data[i]=(data[i]+1)/2
temp=0
for i in range(k):
    temp+=new_data[i]
ans=temp
for i in range(n-k):
    temp=temp-new_data[i]+new_data[i+k]
    ans=max(ans,temp)
print(ans)

Measured memory_bytes: 32220
from collections import defaultdict as dd
d = dd(int)
for _ in range(int(input())):
    s = input()
    d[s]+=1
print (('AC x '), end = '')
print (d['AC'])
print (('WA x '), end = '')
print (d['WA'])
print (('TLE x '), end = '')
print (d['TLE'])
print (('RE x '), end = '')
print (d['RE'])


Measured memory_bytes: 9420
import sys


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


INF = float('inf')


a, b = LI()
if b % a == 0:
    print(a+b)
else:
    print(b-a)


Measured memory_bytes: 9052
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;
ll a[110000],b[110000];
int main(){
    ll n,h,tmp=0,ans=0,cnt=0;
    cin>>n>>h;
    ll st=n;
    rep(i,0,n)cin>>a[i]>>b[i];
    sort(a,a+n,greater<ll>());
    sort(b,b+n,greater<ll>());
    rep(i,0,n)if(a[0]>b[i]){st=i;break;}
    rep(i,0,st){
        if(tmp<h){tmp+=b[i];cnt++;}
        else if(tmp>=h){break;}
    }
    tmp=h-tmp;
    if(tmp<=0)cout<<cnt;
    else if(tmp%a[0]==0)cout<<st+tmp/a[0];
    else if(tmp%a[0]!=0)cout<<st+tmp/a[0]+1;

}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> t(n + 1), x(n + 1), y(n + 1);
    t[0] = 0;
    pair<int ,int> p(0, 0);
    for (int i = 1; i <= n; i++) {
        cin >> t[i] >> x[i] >> y[i];
    }
    for (int i = 1; i <= n; i++) {
        for (int j = t[i - 1]; j < t[i]; j++) {
            if (p.first < x[i]) ++p.first;
            else if (p.first > x[i]) --p.first;
            else if (p.second < y[i]) ++p.second;
            else if (p.second > y[i]) --p.second;
            else if (p.first == x[i] && p.second == y[i]) --p.first;
        }
        if (p.first == x[i] && p.second == y[i]) continue;
        else {
            cout << "No" << '\n';
            return 0;
        }
    }
    cout << "Yes" << '\n';
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#define INF 1 << 30
using namespace std;

int num, g;

int Search(vector<int> &p, vector<int> &c, int cmp, int sum, int score, int id) {
	if (id == num) {
		if (score >= g)
			return sum;
		for (int i = num - 1; i >= 0; i--) {
			if ((cmp & (1 << i)) == 0) {
				if ((p[i] - 1) * (i + 1) * 100 + score >= g) {
					sum += (g - score) / ((i + 1) * 100);
					if ((g - score) % ((i + 1) * 100) > 0)
						sum++;
					return sum;
				}
				break;
			}
		}
		return INF;
	}
	int ans = Search(p, c, cmp, sum, score, id + 1);
	cmp = cmp | (1 << id);
	score += p[id] * (id + 1) * 100 + c[id];
	ans = min(ans, Search(p, c, cmp, sum + p[id], score, id + 1));
	return ans;
}

int main(void) {
	int i = 0, cmp = 0;
	cin >> num >> g;
	vector<int> p(num), c(num);
	for (; i < num; i++)
		scanf("%d%d", &p[i], &c[i]);
	int ans = Search(p, c, cmp, 0, 0, 0);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#define N 100005
using namespace __gnu_pbds;
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
LL z = 1;
int read(){
	int x, f = 1;
	char ch;
	while(ch = getchar(), ch < '0' || ch > '9') if(ch == '-') f = -1;
	x = ch - '0';
	while(ch = getchar(), ch >= '0' && ch <= '9') x = x * 10 + ch - 48;
	return x * f;
}
int ksm(int a, int b, int p){
	int s = 1;
	while(b){
		if(b & 1) s = z * s * a % p;
		a = z * a * a % p;
		b >>= 1;
	}
	return s;
}
char s[N];
int a[N];
struct node{
	int a, b;
}d[N * 3];
int cnt;
void cr(int a, int b){
	d[++cnt].a = a; d[cnt].b = b;
}
int main(){
	int i, j, n, m, tot = 0, x;
	scanf("%s", s + 1);
	n = strlen(s + 1);
	for(i = 1; i <= n; i++) a[i] = s[i] - '0';
	if(!a[1] || !a[n - 1] || a[n]){
		printf("-1");
		return 0;
	}
	for(i = 2; i <= n - 2; i++){
		if(a[i] != a[n - i]){
			printf("-1");
			return 0;
		}
	}
	x = 1;
	for(i = 2; i <= n; i++){
		cr(i, x);
		if(a[i - 1] == 1) x = i;
	}
	for(i = cnt; i >= 1; i--) printf("%d %d\n", d[i].a, d[i].b);
	return 0;
}

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

typedef struct {
	double x;
	double y;
}point;

void koch(int n, point p1, point p2){
	if(n == 0){
		return;
	}
	else{
		point s, t, u;
		double rad = M_PI * 60 / 180;
		s.x = (2 * p1.x + p2.x) / 3;
		s.y = (2 * p1.y + p2.y) / 3;
		t.x = (p1.x + 2 * p2.x) / 3;
		t.y = (p1.y + 2 * p2.y) / 3;
		u.x = (t.x - s.x) * cos(rad) - (t.y - s.y) * sin(rad) + s.x;
		u.y = (t.x - s.x) * sin(rad) + (t.y - s.y) * cos(rad) + s.y;
		koch(n-1,p1,s);
		printf("%f %f\n" ,s.x ,s.y);
		koch(n-1,s,u);
		printf("%f %f\n" ,u.x ,u.y);
		koch(n-1,u,t);
		printf("%f %f\n" ,t.x ,t.y);
		koch(n-1,t,p2);
	}
}

int main(void){
	int n;
	point p1, p2;
	scanf("%d" ,&n);
	p1.x = 0, p2.x = 100, p1.y = 0, p2.y = 0;
	printf("%f %f\n" ,p1.x ,p1.y);
	koch(n,p1,p2);
	printf("%f %f\n" ,p2.x ,p2.y);
	
	return 0;
}


Measured memory_bytes: 2048
#include <stdio.h>

int main(void)
{
  int a, b;
  int t = 1;

  scanf("%d %d", &a, &b);

  while(t==1) {
    if(a == 0 && b == 0)
      t = 0;
    else { 
    if(a < b)
      printf("%d %d\n", a, b);
    else
      printf("%d %d\n", b, a);
    scanf("%d %d", &a, &b);
    }
  }

  return 0;
}
  

Measured memory_bytes: 1728
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1

//{
#pragma GCC optimize ("O3","unroll-loops")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int n,a,b,m,k;
string s;

main(){
	cin>>a>>b;
	dump(a*b/2);
}


Measured memory_bytes: 256