akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int inf = 999999999;
const double pi = acos(-1);

#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) (i%(ll)(1e9 + 7))


ull dp[55][55][3000] = {};

int main(){
	int n,a,x[55];
	cin >> n >> a;

	rep(i,0,n)cin >> x[i];
	dp[0][0][0] = 1;

	rep(i,0,n){
	    rep(j,0,n){
	        rep(k,0,n*a){
	            dp[i+1][j+1][x[i]+k] += dp[i][j][k];
	            
	            dp[i+1][j][k] += dp[i][j][k];
	        }
	    }
	}

	ull ans = 0;
	rep(i,1,n+1)ans += dp[n][i][i*a];

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

Measured memory_bytes: 66560
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
int main()
{
	int n;
	cin>>n;
	int a[maxn][3],dp[maxn][3];
	for(int i=1;i<=n;i++)
	{
		cin>>a[i][1]>>a[i][2]>>a[i][3];
		
	}
	dp[1][1]=a[1][1];
	dp[1][2]=a[1][2];
	dp[1][3]=a[1][3];
	for(int i=1;i<=n;i++)
	{
		dp[i][1]=a[i][1]+max(dp[i-1][2],dp[i-1][3]);
		dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][3]);
		dp[i][3]=a[i][3]+max(dp[i-1][2],dp[i-1][1]);
	}
	cout<<max(dp[n][1],max(dp[n][2],dp[n][3]))<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
const ll mod=1e9+7;



int main() {

    ll n;
    cin>>n;
    string s;
    cin>>s;
    map<char,ll> m;

    for(auto i:s){
        m[i]++;
    }

    ll ans=1;
    for(auto i: m){
        ans*=(i.second+1)%mod;
        ans%=mod;
    }
    cout<<ans-1<<endl;

}


Measured memory_bytes: 512
#include <iostream>

using namespace std;


int main()
{
	long long int X, Y;
	int count = 0;
	long long int tmp;

	cin >> X >> Y;
	tmp = X;

	while (true)
	{
		if (tmp > Y)
			break;

		count++;
		tmp *= 2;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
int due = 0;
int a=0,b=0,c=0;
scanf("%d",&due);
a = due / 100;
b = (due - a*100) / 10;
c = (due - a*100 -b*10) / 1;

a=10-a;b=10-b;c=10-c;

printf("%d",a*100+b*10+c);
return 0;
}

Measured memory_bytes: 128
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define pause system("pause")
#define PI acos(-1.0)


signed main() {
	int A, B, C, K,ans=0;
	cin >> A >> B >> C >> K;
	while (A != 0&&K!=0) {
		ans++;
		A--;
		K--;

	}
	while (B != 0 && K != 0) {
		
		B--;
		K--;

	}
	while (C != 0 && K != 0) {
		ans--;
		C--;
		K--;

	}

	cout << ans << endl;
	pause;
}

Measured memory_bytes: 3680
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int Sz = 3e5 + 5;
int a[Sz];
int b[Sz];
int c[Sz];
int n;
priority_queue<int,vector<int>, greater<int> > q1;
priority_queue<int,vector<int>, less<int> > q2;
int32_t main(){
    //freopen("inp.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin >> n;
    for(int i = 1; i <= 3 * n; i++) cin >> a[i];
    for(int i = 1; i <= n; i++){
        b[i] = b[i - 1] + a[i];
        q1.push(a[i]);
    }
    int Sum = b[n];
    for(int i = n + 1; i <= 2 * n; i++){
        if(a[i] > q1.top()){
            Sum -= q1.top();
            Sum += a[i];
            q1.pop();
            q1.push(a[i]);
        }
        b[i] = Sum;
    }
    for(int i = 3 * n; i > 2 * n; i--){
        c[i] = c[i + 1] + a[i];
        q2.push(a[i]);
    }
    Sum = c[2 * n + 1];
    for(int i = 2 * n; i > n; i--){
        if(a[i] < q2.top()){
            Sum -= q2.top();
            Sum += a[i];
            q2.pop();
            q2.push(a[i]);
        }
        c[i] = Sum;
    }
    int res = -1e18;
    for(int i = n; i <= 2 * n; i++) res = max(res, b[i] - c[i + 1]);
    cout << res;
    return 0;
}


Measured memory_bytes: 10480
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

int main(void) {
	string s; cin >> s;
	REV(s);
	s += '0';
	int n = s.size();
	vvi dp(n+1,vi(2,INF));
	dp[0][0] = 0;
	rep(i,n)rep(j,2){
		int x = s[i]-'0';
		x += j;
		if(x<10) dp[i+1][0] = min(dp[i+1][0],dp[i][j]+x);//繰り下がりなし
		if(x>0) dp[i+1][1] = min(dp[i+1][1],dp[i][j]+10-x);//繰り下がりあり「
	}
	cout << dp[n][0] << endl;
}




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

int main(){
  int i,j,cnt=0;
  int n;
  cin>>n;
  int d[n+1];
  d[0]=0;
  for(i=1;i<=n;i++)d[i]=INT_MAX;
  int a[12]={1,6,9,36,81,216,729,1296,6561,7776,46656,59049};
  for(i=1;i<=n;i++){
    for(j=0;j<12;j++){
      if(a[j]>i)break;
      d[i]=min(d[i],d[i-a[j]]+1);
    }
  }
  cout<<d[n];
}

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

struct BFS{
    vector<int> color;
    vector<vector<int>> adj;
    int n_,m_;
    BFS(int n,int m):color(n,-1),adj(n){
        n_ = n;
        m_ = m;
    }
    void init(){
        rep(i,m_){
            int a,b;cin>>a>>b;
            adj[a].push_back(b);
            adj[b].push_back(a);
        }
    }
    void visit(int u,int clr){
        queue<int> Q;
        Q.push(u);
        color[u] = clr;
        while(!Q.empty()){
            int v = Q.front();Q.pop();
            color[v] = clr;
            for(int h:adj[v]){
                if(color[h] == -1){
                    Q.push(h);
                }
            }
        }
    }
    void go(){
        int clr_ = 0;
        rep(i,n_){
            if(color[i] == -1){
                visit(i,clr_);
                clr_++;
            }
        }
    }
    void solve(){
        init();
        go();
        int q;cin>>q;
        rep(i,q){
            int a,b;cin>>a>>b;
            if(color[a] == color[b]){
                cout<<"yes"<<endl;
            }else{
                cout<<"no"<<endl;
            }
        }
    }
};

int main(){
    int n,m;cin>>n>>m;
    BFS bfs(n,m);
    bfs.solve();
    return 0;
}


Measured memory_bytes: 8580
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	int H,W;
	cin>>H>>W;
	int d[10][10];
	rep(i,10) rep(j,10){
		cin>>d[i][j];
	}
	rep(i,10) rep(j,10) rep(k,10) chmin(d[j][k],d[j][i]+d[i][k]);
	int cnt[10]={};
	int ans = 0;
	rep(i,H) rep(j,W){
		int x;
		cin>>x;
		if(x==-1) continue;
		ans += d[x][1];
	}
	cout<<ans<<endl;

}


Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,K,S=MI()
    if S==10**9:
        print(*([S]*K + [1]*(N-K)))
    else:
        print(*([S]*K + [S+1]*(N-K)))
if __name__ == '__main__':
    main()

Measured memory_bytes: 6228
import java.util.*;
public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt(), M = sc.nextInt();
		int x = 1900*M + 100*(N-M);
		System.out.println((int)(x*Math.pow(2, M)));
	}

}


Measured memory_bytes: 21844
import sys

read = sys.stdin.read
readline = sys.stdin.readline


class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1] * (n + 1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0] * (n + 1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if self.root[x] < 0:
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]

    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if x == y:
            return
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif self.rnk[x] > self.rnk[y]:
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if self.rnk[x] == self.rnk[y]:
                self.rnk[y] += 1

    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]


N, M, K, *ABCD = map(int, read().split())
AB = ABCD[:M * 2]
CD = ABCD[M * 2:]
F = UnionFind(N)
friend = [[] for _ in range(N + 1)]
for A, B in zip(*[iter(AB)] * 2):
    F.Unite(A, B)
    friend[A].append(B)
    friend[B].append(A)

block = [[] for _ in range(N + 1)]
for C, D in zip(*[iter(CD)] * 2):
    block[C].append(D)
    block[D].append(C)

answer = []
for i in range(1, N + 1):
    cnt = F.Count(i) - 1
    for j in block[i]:
        if F.isSameGroup(i, j):
            cnt -= 1
    cnt -= len(friend[i])
    answer.append(cnt)

print(' '.join(map(str, answer)))


Measured memory_bytes: 58372
## 幸福度が変わるかどうかは操作Kによって変更されたl, r番目の人間だけなので、
## 左右l,r番目の人間が幸福であるかどうかを見てゆく
## for(n)回のループでまず「既に 1 + x, 任意の r が幸福であるかどうか」を確認して、
## 幸福度2, 1の順でそのl,rをK回覚える
n, k = map(int, input().split())
humans = list(input())
k_count = 0
last_r = n ## 最後に操作したr(番目)
dev_null = 0

## ポイントを計算
happy_point = 0
for x in range(n - 1):
  if humans[x] == humans[x+1]:
    happy_point += 1
print(min(n-1,happy_point+2*k))

Measured memory_bytes: 3956
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String alpha = scan.next();
		
		if(Character.isUpperCase(alpha.charAt(0))) {
			System.out.println("A");
		}else {
			System.out.println("a");
		}

	}

}


Measured memory_bytes: 35528
#include<iostream>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>

using namespace std;
int main(){

  
  int a[26];
  memset(a,0,26*sizeof(int));

  string str;
  while(getline(cin , str)){  
    for(int i=0;i<str.size();i++){
      int x = (int)str[i];
      if(65<=x && x <=90) x += 32;
      if(97 <= x && x <=122) a[x-97]++;
    }
  }

  for(int i=0;i<26;i++) cout << (char)(i+97)<<" : " << a[i] << endl;
  

}


Measured memory_bytes: 3160
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;

static class MainClass
{
    public static void Main(string[] args)
    {
        var NK = Console.ReadLine().SplittedStringToInt32List();
        var N = NK[0];
        var K = NK[1];

        var hn = Console.ReadLine().SplittedStringToInt32List();
        var dp = new int[N + K + 10];
        for (int i = 0; i < N + K + 10; i++)
        {
            dp[i] = INF;
        }
        dp[0] = 0;

        for (int i = 1; i < N; i++)
        {
            var min = INF;
            for (int j = 1; j <= K; j++)
            {
                if (i - j >= 0)
                    min = Math.Min(min, dp[i - j] + Math.Abs(hn[i - j] - hn[i]));
            }
            dp[i] = min;
        }
        Console.WriteLine(dp[N - 1]);
        Console.ReadLine();
    }

    public static void PrintArray(int[,] array,int n1,int n2)
    {
        for (int i = 0; i < n1; i++)
        {
            for (int j = 0; j < n2; j++)
            {
                Console.Write(array[i,j] + " ");
            }
            Console.WriteLine();
        }
    }

    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 2;
    public const long LONGINF = long.MaxValue / 2;
    #endregion
}



Measured memory_bytes: 17632
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        Scanner cin = new Scanner();
        //Random rnd = new Random();
        //Stopwatch sw = new Stopwatch();

        // A B C
        /*
        int A = cin.Nextint;
        int B = cin.Nextint;
        int C = cin.Nextint;
        */

        // N
        // a1 a2 ... aN
        /*
        int N;
        int[] A;

        N = cin.Nextint;
        A = cin.Scanint;
        */

        // N M
        // a1 b1
        // ...
        // aM bM
        /*
        int N;
        int M;
        int[] A = new int[M];
        int[] B = new int[M];

        N = cin.Nextint;
        M = cin.Nextint;

        for(int i=0; i<M; i++)
        {
            A[i] = cin.Nextint;
            B[i] = cin.Nextint;
        }
         */


        //Array.Sort(A);


        string[] a = cin.Scan; 

        /** ここに記述 */

        Console.WriteLine(a[0].Substring(0, a[0].Length -8));
        //Console.WriteLine(result ? "Yes" : "No");
        Console.Out.Flush();
    }
}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return Console.ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length)
            {
                return s[i++];
            }
            string st = Console.ReadLine();
            while (st == "")
            {
                st = Console.ReadLine();
            }

            s 
            = st.
                Split
                (cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 11092
#include <iostream>
#include <string>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    string S, T; cin >> S >> T;
    cout << T+S << endl;
}

Measured memory_bytes: 256
/**
*    created: 15.06.2020 10:59:12
**/
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int m = 1000003;
    vector<int> lst(m);
    for (int x : a) {
        if (lst[x] != 0) lst[x]++;
        else {
            for (int j = x; j <= m; j+=x) lst[j]++;
        }
    }
    int cnt = 0;
    for (auto itr = a.begin(); itr != a.end(); itr++) {
        if (lst[*itr] == 1) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


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

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

    int s = 0;
    rep (i, n) {
        int x;
        cin >> x;

        if (x > (k / 2))
            x = k - x;

        s += 2 * x;
    }

    cout << s << endl;
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
#include <complex>
using namespace std;
typedef long long LL;

int main() {
    string s;
    cin >> s;
    vector<int> a(26);
    for (int i = 0; i < s.size(); i++) {
        a[s[i] - 'a']++;
    }

    for (int i = 0; i < 26; i++) {
        if (a[i] >= 2) {
            cout << "no" << endl;
            return 0;
        }
    }

    cout << "yes" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main (void){
	int A,B,C;
	std::cin>>A>>B>>C;
	if((C>A && C<B )||( C<A && C>B )){
		std::cout<<"Yes"<<std::endl;
	}else{
		std::cout<<"No"<<std::endl;
	}
	return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

const double EPS = 1e-8;
typedef complex<double> P;
typedef vector<P> VP;
double cross(P a, P b){
    return (conj(a)*b).imag();
}
P crosspointLL(P a1, P a2, P b1, P b2){
    double A = cross(a2-a1, b2-b1);
    double B = cross(a2-a1, a2-b1);
    return b1 + B/A * (b2-b1);
}
bool isParallel(P a, P b){
    return abs(cross(a,b)) < EPS;
}
int ope(P& from, P& to, P& move, P& fix){
    if(isParallel(to -from, fix -move)){
        from = to;
        return 1;
    }else if(isParallel(to -from, fix -from)){
        return 1e9;
    }else{
        move = crosspointLL(fix, fix+to-from, move, move+from-fix);
        from = to;
        return 2;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x,y;
    while(cin >> x){
        vector<VP> tri(2, VP(3));
        for(int i=0; i<2; i++){
            for(int j=0; j<3; j++){
                if(i!=0 || j!=0) cin >> x;
                cin >> y;
                tri[i][j] = P(x,y);
            }
        }
        for(int i=0; i<2; i++){
            if(cross(tri[i][1] -tri[i][0], tri[i][2] -tri[i][0]) < EPS){
                swap(tri[i][1], tri[i][2]);
            }
        }
        
        int ans = 5;
        for(int i=0; i<3; i++){
            for(int j=0; j<3; j++){
                for(int v=1; v<=2; v++){
                    for(int q=1; q<=2; q++){
                        vector<VP> t = tri;
                        int ret1 = ope(t[0][i], t[1][j], t[0][(i+v)%3], t[0][(i+2*v)%3]);
                        int ret2 = ope(t[0][(i+q)%3], t[1][(j+q)%3], t[0][(i+2*q)%3], t[0][i]);
                        ans = min(ans, ret1 +ret2 +1);
                    }
                }
            }
        }
        if(ans == 5) cout << "Many\n";
        else cout << ans << "\n";
    }
    return 0;
}



Measured memory_bytes: 3124
N, W = list(map(int, input().split()))
dp = [[0 for i in range(W+1)] for j in range(N+1)]

for i in range(1, N+1):
    w, v = list(map(int, input().split()))
    for j in range(0, W+1):
        if j >= w:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-w] + v)
        dp[i][j] = max(dp[i][j], dp[i-1][j])

print(dp[N][W])

Measured memory_bytes: 171528
import java.util.Scanner;

public class Main{
	 
    public static void main(String[] args) {
        Scanner stdin  = new Scanner(System.in);
        
        int num = Integer.parseInt(stdin.nextLine());
        
        boolean boo = true;
        int[] seq = new int[num];
        if(num <= 100) {
         
        	for(int i = 0;i < num;i++) {
        		seq[i] = stdin.nextInt();
        		if(seq[i] >= 0 && seq[i] <= 1000) {
        			continue;
        		}else {
        			boo = false;
                break;
        		}
        	}
        }
         
        if(boo == true) {
            for(int j = num ;j > 0;j--) {
                if(j != 1) {
                    System.out.print(seq[j - 1]+" ");
                }else {
                    System.out.println(seq[j - 1]);
                }
            }
        }
       stdin.close();  
   }
	 
}

Measured memory_bytes: 26252
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <functional>
using namespace std;

int n, k;
vector<int> v[10];
int dp[10][2000];
int ans;

int main(){
	scanf("%d %d", &n, &k);

	for(int i=0; i<n; i++){
		int s, t;
		scanf("%d %d", &s, &t);
		v[t-1].push_back(s);
	}
	for(int i=0; i<10; i++) sort(v[i].begin(), v[i].end(), greater<int>());
/*
	for(int i=0; i<10; i++){
		for(int j=0; j<v[i].size(); j++){
			printf("%d\t", v[i][j]);
		}
		printf("\n");
	}
*/
	for(int i=0; i<10; i++) for(int j=1; j<v[i].size(); j++)
		v[i][j] += v[i][j-1];

	for(int i=0; i<10; i++) for(int j=1; j<v[i].size(); j++)
		v[i][j] += j * (j + 1);
/*
	for(int i=0; i<10; i++){
		for(int j=0; j<v[i].size(); j++){
			printf("%d\t", v[i][j]);
		}
		printf("\n");
	}
*/
	dp[0][0] = v[0][0];
	for(int i=1; i<v[0].size(); i++) dp[0][i] = v[0][i];

	for(int i=1; i<10; i++)
		if(0 < v[i].size()) dp[i][0] = max(dp[i-1][0], v[i][0]);

	for(int i=1; i<10; i++){
		for(int j=0; j<k; j++){
			dp[i][j] = dp[i-1][j];
			for(int l=0; l<v[i].size(); l++){
				if(j-l >= 0) dp[i][j] = max(dp[i][j], dp[i-1][j-l-1]+v[i][l]);
			}
		}
	}
/*
	for(int i=0; i<10; i++){
		for(int j=0; j<k; j++){
			printf("%d\t", dp[i][j]);
		}
		printf("\n");
	}
*/
	for(int i=0; i<10; i++) ans = max(ans, dp[i][k-1]);
	printf("%d\n", ans);
}

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

ll fastpow(ll base, ll exp){
	if(!exp){
		return 1;
	}
	if(exp==1){
		return base%mod;
	}
	if(exp&1){
		ll a = fastpow(base,exp/2);
		return (((a*a)%mod)*base)%mod;
	}
	else {
		ll a = fastpow(base,exp/2);
		return (a*a)%mod;
	}
}

ll modinv[1000005];
ll fact[1000005];
int main(){
	ll x,y;
	cin>>x>>y;
	if((x+y)%3){
		cout<<"0";
		return 0;
	}
	ll f = 1;
	modinv[0]=1;
	fact[0]=1;
	for(int i=1;i<1000005;i++){
		f *= i;
		f%=mod;
		fact[i] = f;
		fact[i]%=mod;
		modinv[i]=fastpow(f,mod-2);
	}
	ll amoves = (2*x-y)/3;
	if(amoves<0 || amoves>(x+y)/3){
		cout<<"0";
		return 0;
	}
	//cout<<amoves<<"\n";
	cout<<(((fact[(x+y)/3]*modinv[amoves])%mod)*modinv[((x+y)/3)-amoves])%mod;
}


Measured memory_bytes: 15872
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

double add_double(double a,double b){
	if(abs(a+b)<eps*(abs(a)+abs(b))) return 0;
	return a+b;
}

struct point{
	double x,y;
	point operator+(point p){
		return point{add_double(x,p.x),add_double(y,p.y)};
	}
	point operator-(point p){
		return point{add_double(x,-p.x),add_double(y,-p.y)};
	}
	point operator*(double p){
		return point{x*p,y*p};
	}
	point operator/(double p){
		if(!p) return point{0,0}; 
		return point{x/p,y/p};
	}
	bool operator==(point p){
		return fabs(add_double(x,-p.x))<eps&&fabs(add_double(y,-p.y))<eps;
	}
	bool operator<(point p){
		if(fabs(x-p.x)>eps) return x<p.x;
		return y<p.y;
	}
};
 
typedef pair<point,point> pp;
typedef vector<point> VP;
const point O{0,0};
 
class Geom{
	public:
	double Length(point x,point y){
		point z=y-x;
		return z.x*z.x+z.y*z.y;
	}
	double IP(point p,point q){
		return p.x*q.x+p.y*q.y;
	}
	double CP(point p,point q){
		return p.x*q.y-q.x*p.y;
	}
	string Containment_polyon_point(VP p,point x){
		bool flag=0;
		p.push_back(p[0]);
		for(VP::iterator i=p.begin();i!=p.end()-1;i++){
			point a=*i-x,b=*(i+1)-x;
			if(a.y>b.y) swap(a,b);
			double ip=IP(a,b),cp=CP(a,b);
			if(a.y<=0&&b.y>0&&cp<0) flag=!flag;
			if(cp<eps&&cp>-eps&&ip<=0) return "On_side";
		}
		return flag?"Containment":"not_Containment";
	}
	void Point_in(point& p){
		cin>>p.x>>p.y;
	}
	void Point_out(point p){
		cout<<p.x<<' '<<p.y<<endl;
	}
};

VP Tri(3);
point p;

int main(){
	Geom geo;
	while(cin>>Tri[0].x){
		cin>>Tri[0].y;
		geo.Point_in(Tri[1]);
		geo.Point_in(Tri[2]);
		geo.Point_in(p);
		string s=geo.Containment_polyon_point(Tri,p);
		if(s=="Containment") cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

const ll mo=998244353;
int A,B,C,D;

ll dp[3030][3030];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B>>C>>D;
	
	dp[A][B]=1;
	for(x=A;x<=C;x++) {
		for(y=B;y<=D;y++) {
			// else
			dp[x][y]+=(dp[x-1][y]*y+dp[x][y-1]*x)%mo;
			if(x>A&&y>B) dp[x][y]-=dp[x-1][y-1]*(x-1)*(y-1);
			dp[x][y]=(dp[x][y]%mo+mo)%mo;
			//cout<<x<<" "<<y<<" "<<dp[x][y]<<endl;
		}
	}
	
	cout<<dp[C][D]<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 74584
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;

int main() {

	string s;
	cin >> s;
	Int len = s.size();
	s.push_back('R');//右端の処理用

	vector<Int> ans(len, 0);

	Int flag = 0;
	Int count = 0;

	for (Int i = 0; i < len; i++) {
		if (flag == 0 && s[i + 1] == 'R') {
			count++;
			continue;
		}
		if (flag == 0 && s[i + 1] == 'L') {
			count++;
			flag = 1;
			ans[i] += (count + 1) / 2;
			ans[i + 1] += count / 2;
			count = 0;
			continue;
		}
		if (flag == 1 && s[i + 1] == 'L') {
			count++;
			continue;
		}
		if (flag == 1 && s[i + 1] == 'R') {
			count++;
			flag = 0;
			ans[i - count] += count / 2;
			ans[i - count + 1] += (count + 1) / 2;
			count = 0;
			continue;
		}
	}

	for (Int i = 0; i < len; i++) {
		cout << ans[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
 
bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod_) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod_;
		}
		x = x * x % mod_;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
/*--------Library Zone!--------*/

int x,y,z,k;
int a[1005],b[1005],c[1005];
signed main(){
	cin>>x>>y>>z>>k;
	rep(i,x)cin>>a[i];
	rep(i,y)cin>>b[i];
	vector<int>vec,ans;
	rep(i,x){
		rep(j,y){
			vec.push_back(a[i]+b[j]);
		}
	}
	sort(all(vec),greater<>());
	rep(i,z){
		cin>>c[i];
		rep(j,min(k,(int)vec.size())){
			ans.push_back(c[i]+vec[j]);
		}
	}
	sort(all(ans),greater<>());
	rep(i,k){
		cout<<ans[i]<<endl;
	}
}


Measured memory_bytes: 43108
let i_inp_list : unit -> int list = fun () ->
  let inp_split = Str.split (Str.regexp " ") (input_line stdin) in
  List.map (fun x -> int_of_string x) (inp_split)
  
let () =
  let (n, y) = Scanf.sscanf (input_line stdin) "%d %d" (fun a b -> (a, b)) in
  let solve =
    let rec loop_10000 i =
      if i > n || 10000 * i > y then None
      else
        match loop_5000 i 0 with
          None -> loop_10000 (i + 1)
        | Some x -> Some x
    and loop_5000 i j =
      if i + j > n || 10000 * i + 5000 * j > y then None
      else
        let k = (y - 10000 * i - 5000 * j) / 1000 in
        if i + j + k = n then Some (i, j, k)
        else loop_5000 i (j + 1)
    in
    match loop_10000 0 with
      None -> (-1,-1,-1)
    | Some (i,j,k) -> (i,j,k)
  in
  let (i, j, k) = solve
  in
  print_int i;
  print_char ' ';
  print_int j;
  print_char ' ';
  print_int k;
  print_newline ()


Measured memory_bytes: 384
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




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

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;
  cin>>n;
  vector<ll> a(n),b(n),c(n);
  rep(i,n) cin>>a[i]>>b[i]>>c[i];
  vector<ll> y(1000);
  y[0]=0;
  rep(i,999){
    if((i+1)%3==0 && (i!=0)) y[i+1]=y[i]+200;
    else y[i+1]=y[i]+195;
  }
  vector<ll> m(10);
  m[0]=0;
  rep(i,9){
    if(i%2==0) m[i+1]=m[i]+20;
    else m[i+1]=m[i]+19;
  }
  ll cur=196471;
  rep(i,n){
    if(a[i]%3==0) cout<<cur-(y[a[i]-1]+(b[i]-1)*20+c[i])<<endl;
    else cout<<cur-(y[a[i]-1]+m[b[i]-1]+c[i])<<endl;
  }
  
}


Measured memory_bytes: 3148
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
using u8t = std::uint64_t;
using i8t = std::int64_t;
#define F(I,N) for(i8t I=0,_N=N;I<_N;I++)
#define FR(I,N) for(i8t I=N;I--;)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(_i,N){R(_x)V.push_back(_x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL1(line)
#define RM(V,L,C) std::vector<char> V;F(_i,L){RL(_l)F(_j,C)V.push_back(_l[_j]);}
#define P(X) std::cout<<(X)<<std::endl;
int main() {
  R(Q)R(H)R(S)R(D)R(N);
  if(H>2*Q)H=2*Q;
  if(S>2*H)S=2*H;
  if(D>2*S)D=2*S;
  P(N/2*D+N%2*S);
  return 0;
}

Measured memory_bytes: 256
/* 	* In the name of GOD 
	* Thanks God */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second

int32_t main(){
	int n, d;
	cin >> n >> d;
	ld a[n][d];
	for (int i = 0; i < n; i++){
		for (int j = 0; j < d; j++){
			cin >> a[i][j];
		}
	}
	int ans = 0;
	for (int j = 0; j < n; j++){
		for (int i = j + 1; i < n; i++){
			ld x = 0; 
			for (int k = 0; k < d; k++){
				x += pow(a[i][k] - a[j][k], 2);
			}
			x = sqrt (x);
			if (floor(x) == ceil(x)){
				ans ++;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
const double EPS = 1e-9;
typedef complex<double> P;
typedef array<P, 2> L;
P vec(L l){return l[1] - l[0];}
int sign(double x){ return x > EPS ? 1 : x < -EPS ? -1 : 0; }
double dot(P a, P b) {
    return real(conj(a) * b);
}
double cross(P a, P b) {
    return imag(conj(a) * b);
}
namespace std{
    bool operator < (const L& l, const L& m) {
        double a1 = arg(vec(l));
        double a2 = arg(vec(m));

        if(sign(a1) < 0) a1 += M_PI;
        if(sign(a2) < 0) a2 += M_PI;
        if(a1 > M_PI - EPS) a1 -= M_PI;
        if(a2 > M_PI - EPS) a2 -= M_PI;

        if(sign(a1 - a2) != 0) return sign(a1 - a2) < 0;

        double th = (a1 + a2) / 2.0;

        P p1 = l[0] * polar(1.0, -th);
        P p2 = m[0] * polar(1.0, -th);
        double b1 = p1.imag();
        double b2 = p2.imag();

        return sign(b1 - b2) < 0;
    }
    bool operator == (const L& l, const L& m) {
        return !(l < m) && !(m < l);
    }
    bool operator < (const P& a, const P& b) {
        if(sign(a.real() - b.real()) != 0) return sign(a.real() - b.real()) < 0;
        return sign(a.imag() - b.imag()) < 0;
    }
    bool operator ==  (const P& a, const P& b) {
        return sign(a.real() - b.real()) == 0 && sign(a.imag() - b.imag()) == 0;
    }
}

P proj(L l, P p){
    double t = dot(p - l[0], vec(l)) / norm(vec(l));
    return l[0] + t * vec(l);
}

// 点pの直線lに関する反射
P refl(L l, P p){return 2.0 * proj(l, p) - p;}

bool check(L l, const vector<P>& ps) {
    int N = ps.size();
    bool ok = true;
    int online = 0;
    for(int i = 0; i < N; i++) {
        P rp = refl(l, ps[i]);
        if(ps[i] == rp) online ++;
        if(!binary_search(ps.begin(), ps.end(), rp)) {
            ok = false;
            break;
        }
        if(online > 2) {
            ok = false;
            break;
        }
    }
    return ok;
}

int main(){
    int N;
    while(cin >> N && N > 0){
        vector<P> ps(N);
        REP(i, N) {
            double x, y;
            cin >> x >> y;
            ps[i] = {x, y};
        }

        sort(ps.begin(), ps.end());

        set<L> ls;
        for(int i = 0; i + 1 < N; i++) {
            L l = {ps[i], ps[i+1]};
            ls.insert(l);
        }

        if(ls.size() == 1) {
            cout << "No" << endl;
            continue;
        }

        bool ans = false;
        for(int i = 0; i < 3; i++) {
            for(int j = 0; j < N; j++) if(i != j) {
                P mp = (ps[j] + ps[i]) / 2.0;
                P vp = (ps[j] - ps[i]) * polar(1.0, M_PI / 2.0);
                L l = {mp, mp + vp};
                if(check(l, ps)) ans = true;
            }
        }

        cout << (ans ? "Yes" : "No") << endl;
    }
    return 0;
}

Measured memory_bytes: 1392
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10, INF = 1e9 + 10;
int tims[MAXN];
void solve1(vector<int> a) {
	int N = a.size() - 1;
    sort(a.begin(), a.end());
    int mn = 0, mx = 0, num = 0;
    for(int i = 1; i <= N; i++) {
         if(a[i] != a[i - 1]) {
            if(!mn) mn = a[i];
            else if(!mx) mx = a[i], num = i - 1;
            else {puts("No"); return ;}
        }   	
	} 
    if(!mx) {
        if((mn == N - 1) || (mn * 2 <= N)) puts("Yes");
        else puts("No");
    } else {
        if((mx == mn + 1) && (2 * (mx - num) <= N - num) && (mx - num > 0)) puts("Yes");
        else puts("No");
    }
}
main() {

    int N; vector<int> v; v.push_back(-1);
    scanf("%d", &N);
    for(int i = 1; i <= N; i++) {
    	int p = i, val; scanf("%d", &val);
    	if(!tims[p]) tims[p] = val, v.push_back(val);
    	else if(tims[p] && (tims[p] != val)) {puts("No"); return 0;}
	}
	if(v.size() == N + 1) solve1(v);
    return 0;
}

Measured memory_bytes: 1528
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	int a,b;cin >> a >> b;
	int tmp = (a+b)%24;
	tmp = (tmp + 24)%24;
	cout << tmp << endl;
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    ll n; cin >> n;
    ll max = -100100100, min = 100100100;
    ll save1, save2;
    rep(i,n){
        int x; cin >> x;
        if(x > max){ max = x; save1 = i; }
        if(x < min){ min = x; save2 = i; }
    }

    if(max <= 0){
        cout << n-1 << endl;
        rep(i,n-1) cout << n-i << " " << n-i-1 << endl;
    }
    else if(min >= 0){
        cout << n-1 << endl;
        rep(i,n-1) cout << i+1 << " " << i+2 << endl;
    }
    else if(max + min >= 0){
        cout << 2*n-2 << endl;
        rep(i,n) if(i != save1) cout << save1+1 << " " << i+1 << endl;
        rep(i,n-1) cout << i+1 << " " << i+2 << endl;
    }
    else{
        cout << 2*n-2 << endl;
        rep(i,n) if(i != save2) cout << save2+1 << " " << i+1 << endl;
        rep(i,n-1) cout << n-i << " " << n-i-1 << endl;
    }
}

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

int main() {
    int N, x;
    std::cin >> N >> x;
    std::vector<int> ch(N);
    for (size_t i = 0; i != N; ++i) {
        std::cin >> ch[i];
    }
    std::sort(ch.begin(), ch.end());
    int j = 0, happy = 0;
    while (x > 0 && j < N - 1) {
        if (x >= ch[j]) {
            ++happy;
            x -= ch[j];
        } else {
            j = N - 1;
        }
        ++j;
    }
    if (x > 0 && N > 0 && x == ch[j])
        ++happy;
    std::cout << happy << '\n';
}

Measured memory_bytes: 256
#include <iostream> //cout
#include <vector> //vector
#include <map> //map
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    map<string, int> list;
    rep(i, N){
        string input;
        cin >> input;
        if ( list.count(input) > 0) {
            list[input] += 1;
        } else {
            list[input] = 1;
        }
    }
    cout << list.size();
    
}


Measured memory_bytes: 19200
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template< typename T > istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; }

struct UnionFind {
  private:
  vector<int> child,tree;
  vector<vector<int>> list;

public:
  UnionFind(int v) {
    tree.resize(v);
    list.resize(v);
    REP(i,v) tree[i] = i, list[i].push_back(i);
  }

  int root(int i){
    if(i == tree[i]){
      REP(j,child.size()) tree[child[j]] = i;
      child.clear(); 
      return i;
    }
    else{
      child.push_back(i);
      return i = root(tree[i]);
    }
  }

  int size(int i){
    return list[root(i)].size();
  }

  vector<int> nodes(int no){
    return list[root(no)];
  }

  bool unit(int x, int y){
    x = root(x);
    y = root(y);
    if(x==y) return false;
    if(list[x].size() < list[y].size()) swap(x,y);
    for(int no:list[y]) list[x].emplace_back(no);
    tree[y] = x;
    return true;
  }

  bool isUnit(int x, int y){
    return root(x) == root(y);
  }
};

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n,m,k;
    cin>>n>>m>>k;
    vec a(n);
    UnionFind uf(n);
    rep(i,m){
        int x,y;cin>>x>>y;
        x--;y--;
        a[x]++;a[y]++;
        uf.unit(x,y);
    }
    rep(i,k){
        int x,y;
        cin>>x>>y;
        x--;y--;
        if(uf.isUnit(x,y)){
            a[x]++;
            a[y]++;
        }
    }
    rep(i,n){
        cout<<uf.size(i)-a[i]-1<<endl;
    }
    
}

Measured memory_bytes: 9972
#include <stdio.h>
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF){
		n=n%39;
		if(n==0)
			printf("3C39\n");
		else if(n<10)
			printf("3C0%d\n",n);
		else
			printf("3C%d\n",n);
	}
}

Measured memory_bytes: 1036
n = int(input())
a = list(map(int, input().split()))
res = n
tmp = 1
for i in range(n):
  if a[i] == tmp:
    res -= 1
    tmp += 1
if tmp == 1:
  print(-1)
elif res == n:
  print(0)
else:
  print(res)


Measured memory_bytes: 24744