akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (long long i = 0; i < (long long)(n); ++i)
using P = pair<long long, long long>;

int main() {
  long long N;
  long long a[200000];
  cin >> N;
  rep(i, N) {
    cin >> a[i];
  }
  long long ans = 0;
  long long temp = a[0];
  rep(i, N-1) {
    if(a[i+1] < temp) {
      ans += temp - a[i+1];
    } else {
      temp = a[i+1];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5196
import math
a, b, C = map(int, input().split(" "))
sin = math.sin(math.radians(C))
cos = math.cos(math.radians(C))
print(a*b*sin/2)
print(a + b + (a**2 + b**2 - 2*a*b*cos)**0.5)
print(b*sin)


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

int main() { 
    int X;
    cin >> X;
    if (X <= 2)
    {
        cout << 2 << endl;
    }
    else
    {    
    int a = X-1, i = 2;
    bool judge = true;
    while (judge)
    {
        a++;
        i = 2;
        while (a%i != 0)
        {
            i++;
            if (i > sqrt(a))
            {
                judge = false;
                break;
            }
        }

        
    }
    cout << a << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 1100;
const ll mod = 1e9 + 7;
char matrix[maxn][maxn];
ll dp[maxn][maxn];
ll n, m;

int main() {
    cin>>n>>m;
    for(int i=1;i<=n;i++) {
        for(int j=1;j<=m;j++) {
            cin>>matrix[i][j];
        }
    }

    dp[1][1] = 1LL;
    for(int i=1;i<=n;i++) {
        for(int j=1;j<=m;j++) {
            if(matrix[i][j] != '#') {
                if(matrix[i-1][j] != '#') dp[i][j] += dp[i-1][j];
                if(matrix[i][j-1] != '#') dp[i][j] += dp[i][j-1];
                dp[i][j] %= mod;
            }
        }
    }

    cout<<dp[n][m]<<"\n";

    return 0;
}


Measured memory_bytes: 10752
using System;
using System.Linq;

class Program
{
    static int n;
    static int q;

    static void Main()
    {
        int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        n = input[0];
        q = input[1];

        RSQ2 rsq = new RSQ2(n);
        for (int i = 0; i < q; i++)
        {
            input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int f = input[0];
            int s = input[1];
            int t = input[2];
            if (f == 0)
            {
                int x = input[3];
                rsq.Add(s - 1, t, x);
                continue;
            }
            Console.WriteLine(rsq.Query(s - 1, t));
        }
    }
}

struct RSQ2
{
    private int n;
    private long[] dat;
    private long[] lazy; // 遅延
    public int Length { get; private set; }

    /* nを要素数として、すべて0で初期化 */
    public RSQ2(int n)
    {
        Length = n;
        this.n = 1;
        while (this.n < n) this.n *= 2;
        dat = new long[2 * this.n - 1];
        lazy = new long[2 * this.n - 1];
    }

    /* k番目のノードについて遅延評価を行う */
    private void Eval(int k, int l, int r)
    {
        if (lazy[k] == 0) return;
        dat[k] += lazy[k];
        if (r - l > 1)
        {
            lazy[2 * k + 1] += lazy[k] / 2;
            lazy[2 * k + 2] += lazy[k] / 2;
        }
        lazy[k] = 0;
    }


    public void Add(int a, int b, long x, int k = 0, int l = 0, int r = -1)
    {
        if (r < 0) r = n;
        Eval(k, l, r);
        if (b <= l || r <= a) return;
        if (a <= l && r <= b)
        {
            lazy[k] += (r - l) * x;
            Eval(k, l, r);
        }
        else
        {
            Add(a, b, x, 2 * k + 1, l, (l + r) / 2);
            Add(a, b, x, 2 * k + 2, (l + r) / 2, r);
            dat[k] = dat[2 * k + 1] + dat[2 * k + 2];
        }
    }

    private long Query_(int a, int b, int k, int l, int r)
    {
        if (r <= a || b <= l) return 0;
        Eval(k, l, r);
        if (a <= l && r <= b) return dat[k];
        long v1 = Query_(a, b, k * 2 + 1, l, (l + r) / 2);
        long v2 = Query_(a, b, k * 2 + 2, (l + r) / 2, r);
        return v1 + v2;
    }

    /* [a,b)の和を求める */
    public long Query(int a, int b)
    {
        return Query_(a, b, 0, 0, n);
    }
}


Measured memory_bytes: 23152
#include <bits/stdc++.h>
typedef long long int ll;
#define vaibhavv06               \
	ios::sync_with_stdio(false); \
	cin.tie(NULL);               \
	cout.tie(0);
#define int long long
#define MM(a,b) memset(a,b,sizeof(a))
const ll MOD = 1000000007;
using namespace std;

int32_t main(){
    vaibhavv06;
    
	int n; cin>>n;
	string s,t; cin>>s>>t;
	for(int i=0;i<2*n;i++){
		if(i%2==0){
			cout<<s[i/2];
		}
		else cout<<t[i/2];
	}
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func chmax(a *int, b int) bool {
	if *a < b {
		(*a) = b
		return true
	}
	return false
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func readNums(num int) (sl []int) {
	var tmp int
	for i := 0; i < num; i++ {
		fmt.Scan(&tmp)
		sl = append(sl, tmp)
	}
	return sl
}

func main() {
	var N int
	fmt.Scan(&N)

	var dp = make([][]int, N+1)
	for i := range dp {
		dp[i] = make([]int, 3)
	}
	var h = make([][]int, N)
	for i := range h {
		h[i] = readNums(3)
	}

	for i := range dp {
		for j := 0; j < 3; j++ {
			for k := 0; k < 3; k++ {
				if j != k && i < N {
					chmax(&dp[i+1][k], dp[i][j]+h[i][k])
				}
			}
		}
	}

	var res int
	for i := 0; i < 3; i++ {
		chmax(&res, dp[N][i])
	}
	fmt.Println(res)
}

Measured memory_bytes: 18688
#include<bits/stdc++.h>
#define int long long
using namespace std;
int a[33]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
signed main()
{
	int x;
	scanf("%lld",&x);
	printf("%lld",a[x]);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rp(i,N) for(int i=0;i<N;i++)
using namespace std;
 
int main() {
  long long N;
  cin >> N;
  vector<int> A(N);
  vector<long long> count(N+1,0);
  rp(i,N){
    cin >> A.at(i);
  }
  rp(i,N){
    count.at(A.at(i))++;
  }
  long long sum;
  rp(i,N+1){
    sum+=count.at(i)*(count.at(i)-1)/2;
  }
  rp(i,N){
    cout << sum-count.at(A.at(i))+1 << endl;
  }
}

Measured memory_bytes: 4992
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
-- 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 = getInts >>= putStrLn . cond "Odd" "Even" . odd . apply2 (*)

Measured memory_bytes: 508
//set many funcs
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1072114514
#define llinf 1145141919810364364
#define mod 1000000007

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int n,d[262144],m,t[262144],i,j=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){scanf("%d",&d[i]);}
    scanf("%d",&m);
    for(i=0;i<m;i++){scanf("%d",&t[i]);}
    qsort(d,n,sizeof(int),sortfncsj);
    qsort(t,m,sizeof(int),sortfncsj);
    for(i=0;i<m;i++){
        while(1){
            if(d[j]==t[i]){j++;break;}
            j++;
            if(n<j){printf("NO\n");return 0;}
        }
    }
    printf("YES\n");
    return 0;
}

Measured memory_bytes: 2556
import java.io._

import scala.io.StdIn._
import scala.math._

object Main extends App{
//	System.setIn(new FileInputStream("in.txt"))
	var sin = readLine().split(" ").map(_.toInt)
	val (n,ts) = (sin(0), sin(1))
	val t = readLine().split(" ").map(_.toInt)
	var cnt = 0
	for (i <- 1 until n){
		cnt += min(t(i)-t(i-1), ts)
	}
	cnt += ts
	println(cnt)
}

Measured memory_bytes: 52720
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	 private static String[][] map;

	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		int x = sc.nextInt();
		int y = sc.nextInt();
		map = new String[x][y];
		for(int i=0; i<x;i++){
			String line = sc.next();
			for(int j=0; j<y; j++){
				map[i][j] = String.valueOf(line.charAt(j));
			}
		}
		boolean result = true;
		for(int i=0;i<x;i++){
			for(int j=0;j<y;j++){
				if(map[i][j].equals("#")){
					result = check(i, j);
					if(!result){
						break;
					}
				}
			}
			if(!result) break;
		}
		if(result)System.out.println("Yes");
		else { System.out.println("No");}
	}

	private static boolean check(int x, int y){
		for(int i = -1;i<2;i= i+2){
			try{
				if (map[x + i][y].equals("#")) {
					return true;
				}
			} catch (IndexOutOfBoundsException e){}
			try{
				if (map[x][y + i].equals("#")) {
					return true;
				}
			} catch (IndexOutOfBoundsException e){
				continue;
			}
		}
		return false;
	}


}



class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

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

#ifdef _MSC_VER
#pragma warning(disable:4996)
#endif

using namespace std;

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

	vector<long long> dosuu(n+1, 0);
	vector<int> data(n);

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

	long long count = 0;
	for (int i = 1; i <= n; i++) {
		count += dosuu[i] * (dosuu[i] - 1) / 2;
	}

	for (int k = 0; k < n; k++) {
		cout << count - (dosuu[data[k]]-1) << "\n";
	}
	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main(){
    int n;
    cin >> n;
    vector<vector<pair<int,int>>> a(n);
    rep(i,n-1){
        int ar,b,c;
        cin >> ar >> b >> c;
        ar--;
        b--;
        c%=2;
        a.at(ar).push_back(make_pair(b,c));
        a.at(b).push_back(make_pair(ar,c));
    }
    queue<int> q;
    vector<int> ans(n,-1);
    q.push(0);
    ans.at(0)=0;
    while(!q.empty()){
        int k=q.front();
        q.pop();
        for(auto i:a.at(k)){
            if(ans.at(i.first)!=-1)continue;
            ans.at(i.first)=i.second^ans.at(k);
            q.push(i.first);
        }
    }
    rep(i,n)
        cout << ans.at(i) << endl;
}

Measured memory_bytes: 6784
a,b=map(int, input().split())
a_ = str(a)
b_ = str(b)

for i in range(a-1):
    b_ += str(b)
for i in range(b-1):
    a_ += str(a)
anc = []
anc.append(b_)
anc.append(a_)

print(sorted(anc)[0])

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

int main() {
  int N;
  int count=0;
  cin >>N;
  vector<int> x(N);
  vector<double> y(N);
  for(int i=0;i<N;i++){
   cin>>x.at(i);
  }
  int m=0;
  sort(x.begin(),x.end());
   for(int i=0;i<N-1;i++){
   m+=x.at(i);
  }
  m+=x.at(N-1)/2;
  cout<< m <<endl;
  
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>



using namespace std;




int main() {
	
	int n;
	cin>>n;
	string a,b;
	cin>>a>>b;
	while(b.size()){
		
		for(int i=0;i<=a.size()-b.size();i++){
			string p=a.substr(i,b.size());
			if(p==b){
				cout<<2*n-b.size()<<endl;return 0;
			}

		}
		b.erase(b.size()-1);
	}
	
	cout<<2*n<<endl;
	return 0;
}


	

Measured memory_bytes: 256
#pragma GCC target("avx2,avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#include <atcoder/all>
//using namespace atcoder;
//using mint = modint998244353;
//using mint = modint1000000007;
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//using i128 = __int128_t;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
constexpr char ln = '\n';
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) {if (a < b) {a = b; return true;} return false;}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) {if (a > b) {a = b; return true;} return false;}
inline int topbit(int x) {return x == 0 ? -1 : 31-__builtin_clz(x);}
inline int topbit(long long x) {return x == 0 ? -1 : 63-__builtin_clzll(x);}
inline int botbit(int x) {return x == 0 ? 32 : __builtin_ctz(x);}
inline int botbit(long long x) {return x == 0 ? 64 : __builtin_ctzll(x);}
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
inline int kthbit(long long x, int k) {return (x>>k)&1;}
inline void print() {cout << "\n";}
template<class T>
inline void print(const vector<T> &v) {
    for (auto itr = v.begin(); itr != v.end(); ++itr) cout << *itr << " ";
    print();
}
template<class T, class... Args>
inline void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
#ifdef MINATO_LOCAL
#define dump(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
inline void debug() {cerr << endl;}
template<class T>
inline void debug(const vector<T> &v) {
    for (auto itr = v.begin(); itr != v.end(); ++itr) cerr << *itr << " ";
    debug();
}
template<class T, class... Args>
inline void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
#else
#define dump(x) void(0)
inline void debug() {}
template<class T> inline void debug(const vector<T> &v) {}
template<class T, class... Args> inline void debug(const T &x, const Args &... args) {}
#endif
struct Fast_ios {Fast_ios() {cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);};} fast_ios;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ll a,b,c,d; cin >> a >> b >> c >> d;
    ll ans = max({a*c,a*d,b*c,b*d});
    cout << ans << ln;
}


Measured memory_bytes: 3668
n = gets.to_i
arr = n.times.map{gets.split}

$root = {}
$none = {}

def find(u, k)
  while u != $none && k != u[:key]
    if k < u[:key]
      u = u[:left]
    else
      u = u[:right]
    end
  end
  u
end

def insert(k)
  y = $none
  x = $root
  z = {}

  z[:key] = k
  z[:left] = $none
  z[:right] = $none

  while x != $none
    y = x
    if z[:key] < x[:key]
      x = x[:left]
    else
      x = x[:right]
    end
  end

  z[:parent] = y
  if y == $none
    $root = z
  else
    if z[:key] < y[:key]
      y[:left] = z
    else
      y[:right] = z
    end
  end
end

def inorder(u)
  return if u[:key].nil?
  inorder(u[:left])
  print " #{u[:key]}"
  inorder(u[:right])
end

def preorder(u)
  return if u[:key].nil?
  print " #{u[:key]}"
  preorder(u[:left])
  preorder(u[:right])
end

arr.each do |a|
  if a[0][0] == 'f'
    t = find($root, a[1].to_i)
    puts (t != $none) ? 'yes' : 'no'
  elsif a[0] == 'insert'
    insert(a[1].to_i)
  elsif a[0] == 'print'
    inorder($root)
    print "\n"
    preorder($root)
    print "\n"
  end
end


Measured memory_bytes: 186712
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner tan =new Scanner(System.in);
        while(tan.hasNext()){
            int i=0,sum=0;
            String s,t;
            s=tan.next();
            t=tan.next();
            char []a=new char[s.length()];
            char []b=new char[t.length()];
            for (char c : s.toCharArray()){
                a[i]=c;
                i++;
            }
            i=0;
            for (char ch : t.toCharArray()){
                b[i]=ch;
                i++;
            }
            for (int j = 0; j <t.length() ; j++) {
                if(a[j]!=b[j]){
                    sum++;
                }
            }
            System.out.println(sum);
        }
    }
}


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

int main() {
    // エラトステネスのふるい
    int MAX = 101010;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
//     std::vector<bool> IsPrime;

// void sieve(size_t max){
//     if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
//         IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
//     }
//     for(size_t i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
//         if(IsPrime[i]) // iが素数ならば
//             for(size_t j=2; i*j<=max; ++j) // (max以下の)iの倍数は
//                 IsPrime[i*j] = false;      // 素数ではない
// }
    for (int i = 2; i*i < MAX; ++i) {
        if (!is_prime[i]) continue;
        for (int j = 2; i*j < MAX; j++) is_prime[i*j] = 0;
    }

    // 2017-like 数かどうか
    vector<int> a(MAX, 0);
    for (int i = 0; i < MAX; ++i) {
        if (i % 2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
    }

    // 累積和
    vector<int> s(MAX+1, 0);
    for (int i = 0; i < MAX; ++i) s[i+1] = s[i] + a[i];

    // クエリ処理
    int Q; cin >> Q;
    for (int q = 0; q < Q; ++q) {
        int l, r;
        cin >> l >> r;
        ++r;

        cout << s[r] - s[l] << endl;
    }
}


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

struct Unionfind {
	vector<int> parent;

	Unionfind(int N) {
		parent = vector<int>(N, -1);
	}

	int root(int x) { //親の番号を検索する
		if (parent[x] < 0) return x;
		return parent[x] = root(parent[x]);
	}

	int size(int x) { //自分のグループの大きさを返す
		return -parent[root(x)];
	}

	bool unite(int x, int y) { //XとYを同じグループにする
		x = root(x);
		y = root(y);
		if (x == y) return false;
		if (size(x) < size(y)) swap(x, y);
		parent[x] += parent[y];
		parent[y] = x;
		return true;
	}
	bool same(int x, int y) {
		if (root(x) == root(y)) return true;
		return false;
	}
};

int main() {
	int n, m;
	cin >> n >> m;
	Unionfind uni(n);
	vector<vector<int>> map(n);
	vector<int> ans(n);
	rep(i, m) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		uni.unite(x, y);
		map[x].push_back(y);
		map[y].push_back(x);
		
	}
	bool ok = true;
	int c = 0,s = uni.root(0);
	rep(i, n) {
		if (s != uni.root(i)) ok = false;
	}
	if (ok) cout << "Yes" << endl;
	else {
		cout << "No" << endl;
		return 0;
	}
	//ここまで判定

	queue<int> q;
	q.push(0); ans[0] = 1;
	while (!q.empty()) {
		int k = q.front(); q.pop();
		rep(i, map[k].size()) {
			int a = map[k][i];
			if (ans[a] != 0) continue;
			ans[a] = k + 1;
			q.push(a);
		}
	}
	for (int i = 1; i < n; i++) cout << ans[i] << endl;
}



Measured memory_bytes: 10692
package main

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

func main() {
	fsc := NewFastScanner()
	var S string
	S = fsc.NextLine()
	var ok bool
	ok = false
	for i := 0; i < len(S); i++ {
		for j := i + 1; j < len(S); j++ {
			if S[i] == 'C' && S[j] == 'F' {
				ok = true
				break
			}
		}
	}
	if ok {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

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

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


Measured memory_bytes: 640
#include <iostream>

using namespace std;

int digits(int n) {
  int ret = 0;

  while (n) {
    ret++;
    n /= 10;
  }

  return ret;
}

int main() {
  int a, b;
  cin >> a;
  cin >> b;

  int d = digits(b);
  for (int i = 0; i < d; i++)
    a *= 10;

  int n = a + b;

  for (int m = 1; m * m <= n; m++)
    if (m * m == n) {
      cout << "Yes" << endl;
      return 0;
    }

  cout << "No" << endl;
}


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

int main() {
  int h, a; cin >> h >> a;
  if(h<a){
    cout << "1" << endl;
  }
  else if (h%a == 0){
    cout << h/a << endl;
  }
  else{
  int r = h%a;
  cout << (h+a-r)/a << endl;
  }
}

Measured memory_bytes: 256
r,g,b,n=gets.chomp.split(" ").map(&:to_i)

count = 0

(0..3000).each do |r_i|
  (0..3000).each do |g_i|
    tmp = n - r * r_i - g * g_i
    if tmp >= 0 && tmp % b == 0 then
      count += 1
    end
  end
end

puts count



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

using namespace std;

const int maxn = 200010;

int n, V;
int x[maxn], v[maxn];
int dp_pre[1<<19], dp_suf[1<<19], ok[maxn];
int rig[maxn][20];

void cal_dp(int *dp) {
	for (int i = n; i >= 1; i--) {
		for (int j = 0; j < 20; j++) {
			if (j && !v[j-1]) {
				rig[i][j] = i-1;
				continue;
			}
			rig[i][j] = i;
			if (i + 1 <= n && x[i + 1] - x[i] <= v[j]) {
				rig[i][j] = rig[i+1][j];
			}
		}
	}
	for (int j = 0; j < 20; j++) rig[n + 1][j] = n;
	for (int i = 1; i < (1 << 18); i++) {
		for (int j = 0; j < 18; j++) {
			if (i & (1 << j)) {
				dp[i] = max(dp[i], rig[dp[i ^ (1 << j)] + 1][j]);
			}
		}	
	}
}

int main() {
	scanf("%d%d", &n, &V);
	for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
	v[0] = V / 2;
	for (int i = 1; i <= 20; i++) v[i] = v[i-1] / 2;
	cal_dp(dp_pre);
	reverse(x + 1, x + n + 1);
	for (int i = 1; i <= n; i++) x[i] = - x[i];
	cal_dp(dp_suf);
	reverse(x + 1, x + n + 1);
	for (int i = 1; i <= n; i++) x[i] = - x[i];
	for (int i = 1; i <= n; i++) {
		int l = i, r = i;
		while (r + 1 <= n && x[r + 1] - x[r] <= V) ++ r;
		int _ok = 0;
		for (int j = 0; j < (1 << 18); j++) {
			if (dp_pre[j] >= l-1 && dp_suf[(~j)&((1<<18)-1)] >= n-r) {
				_ok = 1;
			}
		}
		if (_ok) for (int j = l; j <= r; j++) ok[j] = 1;
		i = r;
	}
	for (int i = 1; i <= n; i++) {
		if (ok[i]) puts("Possible");
		else puts("Impossible");
	}
	return 0;
}

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

int main() {
	int n, q, com, x, y;
	cin >> n >> q;
	vector<int> seg(n + 1, 0);
	while (q--) {
		cin >> com >> x >> y;
		if (com) {
			int sum = 0;
			for (int i = y;i > 0; i = i & (i - 1))
				sum += seg[i];
			for (int i = x - 1; i > 0; i = i & (i - 1))
				sum -= seg[i];
			cout << sum << endl;
		}
		else
			for (int i = x;i <= n; i += (i & -i))
				seg[i] += y;
	}
	return 0;
}

Measured memory_bytes: 3124
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t { as swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;
using XY = pair<int, int>;

int main() {
    int n, d, x;
    cin >> n >> d >> x;
    vector<int> a(n);
    for (auto &v: a)
        cin >> v;
    int chocos = x;
    for (auto v : a) {
        chocos += d / v + (d % v > 0 ? 1 : 0);
        cerr << chocos << endl;
    }
    cout << chocos;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld double
#define P pair<ll,ll>
using namespace std;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
    return x*f;
}
int n,a[200005];
ll s[200005],ans=1e18;
P search(int L,int R){
	int mid,l=L,r=R;
	while(l<r){
		mid=l+r>>1;
		if(s[R]-s[mid]*2+s[L-1]>0)l=mid+1;
		else r=mid-1;
	}
	ll res=1e18,a,b;
	for(int i=l-1;i<=l+1;++i){
		if(i==0||i==n)continue;
		if(abs(s[R]-s[i]*2+s[L-1])<res)res=abs(s[R]-s[i]*2+s[L-1]),a=s[R]-s[i],b=s[i]-s[L-1];
	}
	return make_pair(a,b);
}
int main(){
	n=read();
	for(int i=1;i<=n;++i)a[i]=read();
	for(int i=1;i<=n;++i)s[i]=s[i-1]+a[i];
	for(int i=2;i<n;++i){
		P l=search(1,i),r=search(i+1,n);
		ll Min=min(min(l.first,l.second),min(r.first,r.second)),
		   Max=max(max(l.first,l.second),max(r.first,r.second));
		ans=min(Max-Min,ans);
	}
	printf("%lld",ans);
}


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

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

	std::vector<int> v( N );
	std::vector<int> c( N );
	std::vector<int> Cost( N );

	for ( int i = 0; i < N; i++ )
	{
		std::cin >> v[i];
	}

	for ( int i = 0; i < N; i++ )
	{
		std::cin >> c[i];
	}

	for ( int i = 0; i < N; i++ )
	{
		Cost[i] = v[i] - c[i];
	}

	std::sort( Cost.begin(), Cost.end(), []( int x, int y ) {
			return ( y > x );
		} );

	int result = 0;

	for ( int i = 0; i < N; i++ )
	{
		if ( Cost[i] > 0 )
		{
			result += Cost[i];
		}
	}

	std::cout << result << std::endl;

	return ( 0 );
}


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

int main(){
    int a,b,c,X;
    cin >> a >> b >> c;
    if (a==b && b==c) X=1;
    else if (a==b && b!=c) X=2;
    else if (b==c && c!=a) X=2;
    else if (c==a && a!=b) X=2;
    else X=3;
    cout << X << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



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

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  map<int,int>ma;
  rep(i,n){
    int a;cin>>a;
    ma[a]++;
  }
  int cnt=0;
  for(auto tp:ma){
    if(tp.second%2==0)cnt++;
    //cout<<tp.first<<" "<<tp.second<<endl;
  }
  cout<<ma.size()-cnt%2<<endl;
  return 0;

}


Measured memory_bytes: 4992
let n, m, k;
var sumA = [];
var sumB = [];

function getMaxA() {
	for (var i = 0; i < sumA.length; i++) {
		if (sumA[i] <= k) {
			return i;
		}
	}
	return -1;
}

function getB(time, startB) {
	// console.log({
	// 	time: time,
	// 	startB: startB
	// });

	for (var i = startB; 0 <= i; i--) {
		if (time < sumB[i]) {
			return i + 1;
		}
	}
	return 0;
}

function getMaxB() {
	for (var i = 0; i <= sumB.length; i++) {
		if (sumB[i] <= k) {
			return i;
		}
	}
}

function getA(time) {
	for (var i = 0; i <= sumA.length; i++) {
		if (sumA[i] <= time) {
			return i;
		}
	}
}

function getResult(a, startB) {
	var time = k;
	time -= sumA[a];
	var b = getB(time, startB);
	const r = sumA.length - 1 - a + sumB.length - 1 - b;

	// console.log({
	// 	getResult: "getResult",
	// 	a: a,
	// 	time: time,
	// 	b: b,
	// 	r: r
	// });

	return {
		r: r,
		b: b
	};
};

// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	const inputLines = input.split("\n");
	const line0 = inputLines[0];
	const line0vars = line0.split(" ");
	const line1 = inputLines[1];
	const line1vars = line1.split(" ");
	const line2 = inputLines[2];
	const line2vars = line2.split(" ");

	n = parseInt(line0vars[0], 10);
	m = parseInt(line0vars[1], 10);
	k = parseInt(line0vars[2], 10);

	sumA.push(0);
	sumB.push(0);
	for (var i = 0; i < n; i++) {
		const a = parseInt(line1vars[i], 10);
		const newSum = a + sumA[i];
		if (k < newSum) {
			break;
		}
		sumA.push(newSum);
	}
	for (var i = 0; i < m; i++) {
		const b = parseInt(line2vars[i], 10);
		const newSum = b + sumB[i];
		if (k < newSum) {
			break;
		}
		sumB.push(newSum);
	}

	sumA = sumA.reverse();
	sumB = sumB.reverse();

	var result = 200000 + 200000;

	// console.log({
	// 	n: n,
	// 	m: m,
	// 	k: k,
	// 	sumA: sumA,
	// 	sumB: sumB
	// });

	var maxA = getMaxA();
	var time = k;
	time -= sumA[maxA];
	var startB = sumB.length - 1;
	var b = getB(time, startB);

	var maxB = getMaxB();
	var time2 = k;
	time2 -= sumB[maxB];
	var a = getA(time2);

	// console.log({
	// 	maxA: maxA,
	// 	time: time,
	// 	b: b,
	// 	maxB: maxB,
	// 	time2: time2,
	// 	a: a
	// });

	var result = 0;
	for (var tmpA = maxA; tmpA <= a; tmpA++) {
		const ret = getResult(tmpA, b);
		b = ret.b;
		if (result < ret.r) {
			result = ret.r;
		}
	}
	console.log(result);




	// tmp = input[1].split(" ");
	// //文字列から10進数に変換するときはparseIntを使います
	// var a = parseInt(input[0], 10);
	// var b = parseInt(tmp[0], 10);
	// var c = parseInt(tmp[1], 10);
	// var s = input[2];

	//出力
	// console.log('%d %s',a+b+c,s);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

// node index.js
// 1
// 2 3
// test
// (Ctrl + D)


Measured memory_bytes: 60572
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<cmath>
#include<iomanip>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;

//1つの区間取り除く
//ある点から2方向にdfs
//全ての点にreachしたらnot bridge
const int mm = 1250;
const int nn = 50;
int reached[nn];
int n, m;
int a[mm], b[mm];
int connect[nn][nn];
void dfs(int ten) {
    
    if (reached[ten]) return;
    reached[ten] = 1;
    rep(i, n) if (connect[ten][i]) dfs(i);
    
}
int main() {
    cin >> n >> m;
    
    rep(i, n) rep(j, n) connect[i][j] = 0;
    rep(i, m) {
        cin >> a[i] >> b[i];
        connect[a[i] - 1][b[i] - 1] = 1; connect[b[i] - 1][a[i] - 1] = 1;
    }
    int ans = 0;
    rep(i, m) { //どの辺を外すか
        connect[a[i] - 1][b[i] - 1] = 0; connect[b[i] - 1][a[i] - 1] = 0;
        dfs(0); //どの点からでもいいやろ
        connect[a[i] - 1][b[i] - 1] = 1; connect[b[i] - 1][a[i] - 1] = 1;
        rep(i, n) if (reached[i] == 0) {ans++; break;}
        rep(i, n) reached[i] = 0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=998244353 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

ll mod_pow(ll x, ll n, ll m) {
    if(n == 0) return 1;
    ll res = mod_pow(x * x % m, n / 2, m);
    if(n & 1) res = res * x % m;
    return res;
}

void solve() {
	ll n; cin >> n;
    vector<ll> d(n);
    vector<ll> cnt(n, 0);
    rep(i, n) {
        cin >> d[i];
        cnt[d[i]] ++;
    }
    if(d[0] != 0 || cnt[0] != 1) {
        cout << 0 << endl;
        return;
    }
    ll ans = 1;
    for(int i = 1; i < n; i++) {
        if(cnt[i - 1] == 0 && cnt[i] != 0) ans = 0;
        else if(cnt[i] == 0) continue;
        else {
            ans *= mod_pow(cnt[i - 1], cnt[i], mod);
            ans %= mod;
        }
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;++i)
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;
typedef vector<P> vip;

int main(){
    int a,b,c,d;cin>>a>>b>>c>>d;
    if(abs(c-a)<=d||(abs(b-a)<=d&&abs(b-c)<=d)){
        cout << "Yes"<<endl;
    }else{
        cout << "No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

int main(void){
        char s[10];
        int l = 0, i, cnt = 0;
        bool ok = true;
        while((s[l]=getchar())!='\n') l++;
        for(i=0; i<l; i++){
                if('a'<=s[i] && s[i]<='z') cnt++;
                else if(s[i]=='C') ok &= (1<i && i<l-1);
                else if(s[i]=='A') ok &= (i==0);
                else ok = false;
        }
        if(ok && cnt==l-2) puts("AC");
        else puts("WA");
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	long long int n,z=0,k;
	cin>>n;
	for(long long int i=1;i<=n;i++)
    {
        k=n/i;
        z+=i*k*(k+1)/2;
    }
    cout<<z<<endl;
	return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int m = scanner.nextInt(), f = scanner.nextInt(), r = scanner.nextInt();
			if (m == -1 && f == -1 && r == -1) break;
			System.out.println(m == -1 || f == -1 ? "F"
					: m + f >= 80 ? "A"
							: m + f >= 65 ? "B"
									: m + f >= 50 ? "C"
											: m + f >= 30 ? (r >= 50 ? "C"
													: "D")
													: "F");
		}
	}
}



Measured memory_bytes: 26352
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  int R, G, B, N;
  cin >> R >> G >> B >> N;
  
  int ans = 0;
  for( int i = 0; i*R <= N; i++ ){
    for( int j = 0; i*R+j*G <= N; j++ ){
      if( ( N - (i*R) - (j*G) ) % B == 0 ) ans++;
    }
  }
  cout << ans << endl;
      
}


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

typedef long long int ll;

int main () {
    int n; cin>> n;
    string ps = "", qs = "";
    string s = "";
    for (int i = 0; i < n; i++) {
        s = s + (char)('1' + i);
    }
    for (int i = 0; i < n; i++) {
        int t; cin >> t;
        ps = ps + (char)('1' + (t-1));
    }
    for (int i = 0; i < n; i++) {
        int t; cin >> t;
        qs = qs + (char)('1' + (t-1));
    }
    int ppos = 0, qpos = 0;
    int cnt = 0;
    do {
        if (s == ps) {
            ppos = cnt;
        }
        if (s == qs) {
            qpos = cnt;
        }
        cnt++;
    } while(next_permutation(s.begin(), s.end()));
    cout << abs(ppos - qpos) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<cmath>

using namespace std;

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

int main(){
    long int n;
    cin >> n;
    long int a[34];
    n += pow(2, 35);
    long int now = 0;
    long int t = 1;
    for (long int i = 0; i < 34; i++){
        if (n % (t * 2) != ((t * 2) - now) % (t * 2)){
            a[i] = 1;
        }else{
            a[i] = 0;
        }
        if (i % 2 == 1){
            now += a[i] * t;
        }else{
            now += a[i] * (-t);
        }
        t *= 2;
    }
    bool flag = false;
    for (int i = 33; i >= 0; i--){
        if (a[i] == 1 && !flag){
            cout << a[i];
            flag = true;
            continue;
        }
        if (flag){
            cout << a[i];
        }
    }
    if (flag){
        cout << endl;        
    }else{
        cout << 0 << endl;
    }
    
    

}


Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <iostream>
#include <algorithm>
#define LL long long

LL n,x=1,base=1;  

inline bool S(LL x)
{
	LL tmp=x,sum=0;
	while (tmp>0)
	{
		sum+=tmp%10;
		tmp/=10;
	}	
//	printf("%d\n",sum);
	if (x%sum==0) return true;
	return false;
}  
int main(){
	scanf("%lld",&n);
	if (S(n)) printf("Yes\n"); else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
li = []
#mの約数を求める
for i in range(int(m**0.5) + 1, 0, -1):
    if i == int(m**0.5)+1 and (i-1)**2 == m:
        continue
    if m%i==0:
        li.append(i)
        li.append(m//i)
li.sort(reverse=True)
#大きい順に公約数を見ていって条件を満たせばOK
for i in li:
    if n <= m//i:
        print(i)
        break

Measured memory_bytes: 9384
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] shuzu = new int[2];

        while(true) {
            int H = sc.nextInt(), W = sc.nextInt();
            if(H == 0 && W == 0) break;
            for(int i = 0; i < H; i++) {
                for(int j = 0; j < W; j++) {
                    System.out.print("#");
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 35012
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////



int main(){fastio
    ll n;cin>>n;
    vector<l_l>v[n];
    rep(i,1,n-1){
        ll a,b,c;cin>>a>>b>>c;a--;b--;
        v[a].pb(l_l(b,c));
        v[b].pb(l_l(a,c));
    }
    ll c[n];memset(c,-1,sizeof(c));
    c[0]=0;
    queue<ll>q;q.push(0);
    while(!q.empty()){
        ll t=q.front();q.pop();
        for(auto x:v[t]){
            ll ver=x.first;
            ll wei=x.second;
            if(c[ver]==-1){
                c[ver]=(c[t]+wei)%2;
                q.push(ver);
            }
        }
    }
    
    rep(i,0,n-1){
        cout<<c[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 8704
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n,m;
	cin>>n>>m;
	vint v(n);
	vint cnt(n,1);
	v[0] = 1;
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--,b--;
		if(cnt[a]>=2){
			v[b] |= v[a];
		}
		else{
			v[b] |= v[a];
			v[a] = 0;
		}
		// if(v[a]) v[b]=1;
		// if(cnt[a]==1) v[a]=0;
		cnt[b]++;
		cnt[a]--;
	}
	int ans = 0;
	rep(i,n) ans += v[i];
	cout<<ans<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 1024
#include <iostream>
#include <utility>

using namespace std;

bool check(bool[52][52],pair<int,int>);
void rmv(bool[52][52],int,int);

int main(void){
	for(int w,h;cin>> w >> h,w||h;){
		bool fld[52][52]={0};
		int n;

		for(int i=1;i<=h;i++)
			for(int j=1;j<=w;j++)
				cin >> fld[i][j];

		for(n=0;check(fld,make_pair(w,h));n++);
		cout << n << endl;
	}
	return 0;
}

bool check(bool fld[52][52],pair<int,int> wide){
	for(int i=1;i<=wide.second;i++)
		for(int j=1;j<=wide.first;j++)
			if(fld[i][j]){
				rmv(fld,i,j);
				return true;
			}

	return false;
}

void rmv(bool fld[52][52],int y,int x){
	if(fld[y][x]){
		fld[y][x]=false;
		for(int i=-1;i<=1;i++)
			for(int j=-1;j<=1;j++)
				rmv(fld,y+i,x+j);
	}
}

Measured memory_bytes: 1308