akhauriyash/Code-Regression huggingface dataset:
//Dropping Ink
#include<bits/stdc++.h>
using namespace std;

inline bool a(int y, int x){
  return (0<=x && x<=9 && 0<=y && y<=9);
}

int d1[4][2]={{-1,0},{1,0},{0,1},{0,-1}};
int d2[4][2]={{1,1},{1,-1},{-1,1},{-1,-1}};
int d3[4][2]={{-2,0},{2,0},{0,2},{0,-2}};
int p[10][10];

void drop1(int y, int x){
  p[y][x]++;
  for(int i=0; i<4; i++)
    if(a(y+d1[i][0], x+d1[i][1]))p[y+d1[i][0]][x+d1[i][1]]++;
}

void drop2(int y, int x){
  drop1(y, x);
  for(int i=0; i<4; i++)
    if(a(y+d2[i][0], x+d2[i][1]))p[y+d2[i][0]][x+d2[i][1]]++;
}

void drop3(int y, int x){
  drop2(y, x);
  for(int i=0; i<4; i++)
    if(a(y+d3[i][0], x+d3[i][1]))p[y+d3[i][0]][x+d3[i][1]]++;
}

int main(){
  int x, y, z;
  int max=0, n=0;

  while(scanf("%d,%d,%d", &x, &y, &z)!=EOF){
    if(z==1)drop1(y, x);
    else if(z==2)drop2(y, x);
    else if(z==3)drop3(y, x);
  }
  for(int i=0; i<10; i++){
    for(int j=0; j<10; j++){
      if(p[i][j]==0) n++;
      else if(max<p[i][j])max=p[i][j];
    }
  }
  cout << n << endl;
  cout << max << endl;

  return 0;
}

Measured memory_bytes: 1208
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = Integer.parseInt(sc.next());
        int s = Integer.parseInt(sc.next());
        int ans = 0; 
        for(int x = 0;x <= k;x++){
            for(int y = 0; y <= k; y++){
            	int z = s - x - y;
                if(z >= 0 && z <= k) ans++;
            }
        }
            System.out.println(ans);
        }
}

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

#define ar array
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define all(a) a.begin(), a.end()
#define f0(i, n) for(i = 0; i < n; ++i)
#define fo(i, k, n) for(i = k; i < n; ++i)
#define rf0(n, i) for(i = n-1; ~i; --i)
#define rfo(n, k, i) for(i = n-1; i >= k; --i)
#define Im_speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

//ifstream f("date.in");
//ofstream g("date.out");

const int nax = 1e9 + 7;
const int mod = 1e9 + 7;
const int inf = (1 << 30);

int main() {
//    clock_t _clock = clock();
    Im_speed;

    map<string, int> m;
    int n;
    cin >> n;
    while(n--) {
        string s;
        cin >> s;
        ++m[s];
    }

    cout << "AC x " << m["AC"] << '\n';
    cout << "WA x " << m["WA"] << '\n';
    cout << "TLE x " << m["TLE"] << '\n';
    cout << "RE x " << m["RE"] << '\n';
//    cout << ((((double) clock()) - ((double)_clock)) / ((double) CLK_TCK));
    return 0;
}


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

ll arr[107], weight[107];
ll dp[107][100007];
bool vis[107][100007];
ll W;
int n;

ll rec( int i, ll w )
{
    if(i>=n)
        return 0;
    if(vis[i][w])
        return dp[i][w];

    ll q1= rec( i+1, w );
    ll q2= 0;

    if( weight[i]+w<= W )
        q2= arr[i]+rec( i+1, w+weight[i] );

    vis[i][w]= 1;

    return dp[i][w]= max(q1,q2);
}

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

    for(int i=0;i<n;i++)
        cin>>weight[i]>>arr[i];

    cout<< rec( 0, 0 ) <<endl;
}


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

using namespace std;
typedef long long ll;

typedef struct {
  string s;
  int p;
  int i;
}lest_t;

bool cmp(const lest_t& a, const lest_t& b) 
{
  return (a.s < b.s) || (a.s == b.s && a.p > b.p); 
}

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

  //int a, b, c; cin >> a >> b >> c;
  
  vector<lest_t> l;

  for (int i = 0; i < n; i++) {
     string s; int p; cin >> s >> p;
     lest_t t;
     t.p = p;
     t.s = s;
     t.i = i + 1;
     l.push_back(t);
  }

  sort(l.begin(), l.end(), cmp);

  for (int i = 0; i < n; i++) {
    cout << l[i].i <<  endl;
  }

  return 0;
}

Measured memory_bytes: 256
// AGC19-A.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include<algorithm>
#include <iostream>
using namespace std;

int main()
{
	long long q, h, s, d, n;
	cin >> q >> h >> s >> d;
	cin >> n;
	long long sum = 0;
	
	long two = min({ d, 2 * s, 4 * h, q * 8 });
	long one = min({ s, 2 * h, q * 4 });
	
	sum += (n / 2) * two;
	sum += (n % 2) * one;
	cout << sum << endl;
	
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 510000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  Vec(P,lli,5,0);
  cin >> N;
  rep(i,0,N){
    cin >> S;
    if(S[0]=='M')P[0]++;
    if(S[0]=='A')P[1]++;
    if(S[0]=='R')P[2]++;
    if(S[0]=='C')P[3]++;
    if(S[0]=='H')P[4]++;
  }
  sum+=P[0]*P[1]*P[2];
  sum+=P[0]*P[1]*P[3];
  sum+=P[0]*P[1]*P[4];
  sum+=P[0]*P[2]*P[3];
  sum+=P[0]*P[2]*P[4];
  sum+=P[0]*P[3]*P[4];
  sum+=P[1]*P[2]*P[3];
  sum+=P[1]*P[2]*P[4];
  sum+=P[1]*P[3]*P[4];
  sum+=P[4]*P[2]*P[3];
  Out(sum);
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;

namespace ABC179
{
    class Program
    {
        static void Main(string[] args)
        {
            //var NXT = Console.ReadLine().Split().Select(double.Parse).ToArray();
            var N = long.Parse(Console.ReadLine());
            //var A = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var CA = Enumerable.Repeat(0, (int)N).Select(_ => Console.ReadLine().Split().Select(long.Parse).ToArray()).ToArray();
            //var L = Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x).ToArray();
            var ans = false;
            for (int i = 0; i < N - 3 + 1; i++)
            {
                if (CA[i][0] != CA[i][1]) continue;
                if (CA[i + 1][0] != CA[i + 1][1]) continue;
                if (CA[i + 2][0] != CA[i + 2][1]) continue;
                ans = true;
            }

            if (ans) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 28420
#include <iostream>
#include <string>

using namespace std;
int main(void){
    // Your code here!
   string S1,S2;
   cin>>S1>>S2;
   S1=S1+S1;
   int result=S1.find(S2);
   if(result==-1){
       cout<<"No"<<endl;
   }
   else{
       cout<<"Yes"<<endl;
   }
}



Measured memory_bytes: 3220
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int N = sc.nextInt();
        long cnt = Stream.generate(()->sc.nextInt())
                .limit(N)
                .filter(a -> a%2==0)
                .filter(a -> a % 3 != 0 && a % 5 != 0)
                .count();
        if(cnt == 0)
            System.out.println("APPROVED");
        else
            System.out.println("DENIED");
    }
}

Measured memory_bytes: 27220
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    Integer[] nums = new Integer[n + 1];
    for (int i = 0; i < m; i++) {
      int s = sc.nextInt();
      int c = sc.nextInt();
      if (nums[s] != null && nums[s] != c) {
        System.out.println(-1);
        return;
      }
      nums[s] = c;
    }
    if (n == 1) {
      System.out.println(nums[1] == null ? 0 : nums[1]);
      return;
    }
    if (nums[1] != null && nums[1] == 0) {
      System.out.println(-1);
      return;
    }
    StringBuilder sb = new StringBuilder();
    if (nums[1] == null) sb.append(1);
    else sb.append(nums[1]);
    for (int i = 2; i <= n; i++) {
      if (nums[i] == null) sb.append(0);
      else sb.append(nums[i]);
    }
    System.out.println(sb.toString());
  }
}


Measured memory_bytes: 21844
import java.io.{PrintWriter, _}
import java.util._


object Main {
  def main(args: Array[String]): Unit = {
    val inputStream = System.in
    val outputStream = System.out
    val in = new InputReader(inputStream)
    val out = new PrintWriter(outputStream)
    val solver = new Task
    solver.solve(1, in, out)
    out.close()
  }

  class Task {
    def solve(testNumber: Int, in: InputReader, out: PrintWriter): Unit = {
      val a = in.nextLine.split(" ").map(i => i.toInt)
      out.println(Math.min(a(1) / a(0), a(2)))
    }
  }

  class InputReader(val stream: InputStream) extends AutoCloseable {
    //reader = new BufferedReader(new FileReader(stream), 32768);
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer = new StringTokenizer("")


    def next: String = {
      while ( {
        tokenizer == null || !tokenizer.hasMoreTokens
      }) try
        tokenizer = new StringTokenizer(reader.readLine)
      catch {
        case e: IOException =>
          throw new RuntimeException(e)
      }
      tokenizer.nextToken
    }

    def nextLine: String = {
      try
        return reader.readLine
      catch {
        case e: IOException =>
          e.printStackTrace()
      }
      ""
    }

    def nextInt: Int = next.toInt

    def nextLong: Long = next.toLong

    override def close(): Unit = {
    }
  }

}


Measured memory_bytes: 27296
use proconio::input;

fn solve(g : &Vec<Vec<usize>>, a : &Vec<u32>,
         pos : usize, prev : usize, best : usize,
         res : &mut Vec<usize>, inc : &mut Vec<u32>)
{
    let n = g.len();
    let idx = if a[pos] <= inc[0] {
        0
    } else {
        let mut low = 0;
        let mut high = n-1;
        while high - low > 1 {
            let mid = (low+high)/2;
            if a[pos] <= inc[mid] {
                high = mid;
            } else {
                low = mid;
            }
        }
        high
    };
    let cur_value = inc[idx];
    inc[idx] = a[pos];
    res[pos] = best.max(idx + 1);
    for &next in &g[pos] {
        if next == prev { continue; }
        solve(g, a, next, pos, best.max(idx+1), res, inc);
    }
    inc[idx] = cur_value;
}

fn main() {
    input! {
        n : usize,
        a : [u32; n]
    };
    let mut g = vec![Vec::new(); n];
    for _ in 0..n-1 {
        input! {
            (u, v) : (usize, usize)
        };
        g[u-1].push(v-1);
        g[v-1].push(u-1);
    }
    let mut res = vec![1; n];
    let mut inc = vec![1_000_000_007; n];
    solve(&g, &a, 0, n, 1, &mut res, &mut inc);
    for r in res { println!("{}", r); }
}


Measured memory_bytes: 39428
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;




int main(){
    ll n,c,k;
    cin>>n>>c>>k;
    vector<ll> a(n);
    for(int i=0;i<n;i++){cin>>a[i];}
    sort(a.begin(),a.end());
    ll l=0;
    ll ans=0;
    ll sum=0;
    for(int i=0;i<n;i++){
        if(a[i]-a[l]>k){ans++; sum=0; l=i;}
        sum++;
        if(sum==c){ans++; sum=0; l=i+1;}
    }
    if(sum!=0){ans++;}
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<queue>

using namespace std;

int N, M;

int main() {
	cin >> N >> M;
	vector<vector<int> > E(N);
	vector<int> mark(N, -1);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		E[a].push_back(b);
		E[b].push_back(a);
	}
	mark[0] = 0;
	queue<int> que;
	que.push(0);
	while (!que.empty()) {
		int now = que.front();
		que.pop();
		for (unsigned int i = 0; i < E[now].size(); i++) {
			if (mark[E[now][i]] == -1) {
				mark[E[now][i]] = now;
				que.push(E[now][i]);
			}
		}
	}
	cout << "Yes" << endl;
	for (int i = 1; i < N; i++) {
		cout << mark[i] + 1 << endl;
	}
}

Measured memory_bytes: 10100
def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    h.sort(reverse=True)
    result = 0

    for i in range(n):
        if k > 0:
            k -= 1
        else:
            result += h[i]
    print(result)


if __name__ == "__main__":
    main()


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

using namespace std;
using ll = long long;
#define M ll(1e9+7)

unordered_map<ll,ll> dp;

ll solve(ll x) {
	if (x == 0 || x == 1) return x + 1;
	if (dp[x]) return dp[x];
	return dp[x] = (solve((x-1)/2) + solve((x-2)/2) + solve(x/2)) % M;
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	ll n; cin >> n;
	cout << solve(n) << "\n";
}

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

int main()
{
    string S;
    cin >> S;
    int sum = 700;
    for (int i = 0; i < 3; i++) {
        if (S.at(i) == 'o') sum += 100;
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
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; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

const int MOD = 1000000007;

bool isOK = false;

void dfs(vector<int> a, int k){
    if (isOK) return;
    //cout << a[0] << " " << a[1] << " " << a[2] << " " << k <<endl;
    if(a[1] > a[0] && a[2] > a[1]){
        isOK = true;
        return;
    }
    if (k == 0) return;


    vector<int> a1 = a;
    a1[0] *= 2;
    dfs(a1, k-1);
    vector<int> a2 = a;
    a2[1] *= 2;
    dfs(a2, k-1);
    vector<int> a3 = a;
    a3[2] *= 2;
    dfs(a3, k-1);

}


int main(){
    vector<int> ABC(3);
    rep(i,3) cin >> ABC[i];

    int K; cin >> K;
    dfs(ABC, K);

    if(isOK) cout << "Yes" << endl;
    else cout << "No" << endl;

}



Measured memory_bytes: 3628
#include<stdio.h>
 
int main(void)
{
  int N,i,j,min = 300000,count=0;
  char S[300000];
  
  scanf("%d",&N);
  scanf("%s",S);

  for(i = 1;i<N;i++){
    if(S[i] == 'E')
        count++;
  }
  min = count;
  for(j = 1;j<N;j++){
    if(S[j-1] == 'W')
      count++;
    if(S[j] == 'E')
      count--;
    if(count<min)
      min=count;
  }
 
  printf("%d\n",min);
  
  return 0;
}

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

int main() {
  int N, K, ans=1;
  cin >> N >> K;
  
  rep (i, 30) {    
    if (N >= K) {
      N /= K;
      ans++;
    } 
    else break;
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s

main :: IO ()
main = do
    -- スペース区切り整数の入力
    [a, b] <- map strToInt . words <$> getLine
    -- 出力
    putStrLn $ if even $ a*b then "Even" else "Odd"


Measured memory_bytes: 508
#include <stdio.h>
int n,a[10][10],now;
void go(int x,int y){
    a[x][y]=now;
    now++;
    if(x==n-1){
        if(y==n-1)return;
        if((x+y)%2==1){
            go(x,y+1);
            return;
        }
    }
    if(y==n-1){
        if((x+y)%2==0){
            go(x+1,y);
            return;
        }
    }
    if(y==0){
        if(x%2==1){
            go(x+1,y);
            return;
        }
    }
    if(x==0){
        if(y%2==0){
            go(x,y+1);
            return;
        }
    }
    if((x+y)%2==1){
        go(x+1,y-1);
        return;
    }
    go(x-1,y+1);
    return;
    
}
int main(){
    int i=1;
    while(1){
    scanf("%d",&n);
        if(n==0)return 0;
    now=1;
    go(0,0);
        printf("Case %d:\n",i);
        i++;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            printf("%3d",a[i][j]);
        }
        printf("\n");
    }
    }
}

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

int main(){
    int n;
    cin >> n;
    int p[n] = {};
    for (int i = 0;i < n;i++){
        cin >> p[i];
    }
    int ans = 0;
    int maxp,minp;
    for (int i = 1;i < n - 1;i++){
        maxp = max(max(p[i - 1],p[i]),p[i + 1]);
        minp = min(min(p[i - 1],p[i]),p[i + 1]);
        if (p[i] != maxp && p[i] != minp) ans += 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    num = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    nines = {(i, j): 0 for i in num for j in num}

    for i in range(1, n+1):
        if i % 10 == 0:
            continue
        s = str(i)
        ht = (int(s[0]), int(s[-1]))
        nines[ht] += 1

    print(sum(nines[i, j] * nines[j, i] for i in num for j in num))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
n, m = map(int, input().split())
a = list()
for i in range(n):
	a.append(list(map(int, input().split())))
b = list()
for i in range(m):
	b.append(int(input()))
for i in range(n):
	ans = 0
	for j in range(m):
		ans += a[i][j] * b[j]
	print(ans)


Measured memory_bytes: 6008
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <bitset>
#include <iomanip>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

    cout << a*a - b << endl;
}


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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		String A = scan.next();
		String B = scan.next();
		char a = A.charAt(0);
		char b = B.charAt(0);
		int a_num = a-48;
		int b_num = b-48;
		
		if(a_num > b_num) {
			for(int i=0;i<a_num;i++) {
				if(i == a_num-1) {
					System.out.println(B);
				}else {
					System.out.print(B);
				}
			}
		}else {
			for(int i=0;i<b_num;i++) {
				if(i == b_num-1) {
					System.out.println(A);
				}else {
					System.out.print(A);
				}
			}
		}
		
		
		
	}

}


Measured memory_bytes: 23636
import string
def num():
    return int(input())
def nums():
    return list(map(int,input().split()))

K,N = nums()
A = nums()

ans = K*2

for i in range(N):
    start = A[i]
    goal = A[i-1]
    if goal < start:
        goal = K + goal
    dis = goal - start
    if dis < ans:
        ans = dis


print(ans)

Measured memory_bytes: 27064
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
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 chmin(ll a, ll b){if (a>b){a = b; return true;}return false;}
void chmax(ll a, ll b){if (a<b){a = b; return true;}return false;}
*/

const ll MOD = 1000000007;
const ll INF = 9999999999;

int main() {
  int n, t; cin >>n >>t;
  vector<int> a(n);
  for (int i=0; i<n; i++){
    cin >>a.at(i);
  }
  int mini = a.at(0); // 現時点でのAの最小値
  int submax = 0;     // 差の最大値
  int subcnt = 0;     // 現時点のsubmaxが何回現れたか

  for (int i=0; i<n; i++){
    if (a.at(i) < mini){
      mini = a.at(i);
      continue;
    }
    if (a.at(i) - mini > submax){
      submax = a.at(i) - mini;
      subcnt = 1;
      continue;
    }
    if (a.at(i) - mini == submax){
      subcnt++;
    }
  }
  cout <<subcnt <<endl;
}

Measured memory_bytes: 640
import Data.List
main = do
  x <- getLine
  putStrLn $ show $ maximum' $ map length $ filter (\w -> length w /= 1 || any (w ==) ["A", "T", "C", "G"]) $ groupBy (\y z -> elem y "ATCG" && elem z "ATCG") x

maximum' [] = 0
maximum' x = maximum x


Measured memory_bytes: 380
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n;
	string s,s1,s2;
	cin>>n;
	cin>>s;
	s1=s.substr(0,(n+1)/2);
	s2=s.substr((n+1)/2,n);
	if (s1==s2)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
}

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

fn calc_segment_index(l: usize, r: usize, k: usize) -> Vec<usize> {
    let mut x = l + k;
    let mut y = r + k;
    let mut a = vec![];
    let mut b = vec![];
    while x < y {
        if x & 1 == 1 {
            a.push(x);
            x += 1;
        }
        if y & 1 == 1 {
            y -= 1;
            b.push(y);
        }
        x >>= 1;
        y >>= 1;
    }
    b.reverse();
    a.append(&mut b);
    a
}

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let m: usize = it.next().unwrap().parse().unwrap();
    let size = n.next_power_of_two();
    let mut graph = vec![vec![]; 3 * size + 2 * m];
    let mut up = vec![0; 2 * size];
    let mut down = vec![0; 2 * size];
    for i in 0..size {
        up[size + i] = i;
        down[size + i] = i;
    }
    for i in 1..size {
        up[i] = size + i;
        down[i] = 2 * size + i;
    }
    for i in 1..size {
        graph[down[i]].push((down[2 * i    ], 0));
        graph[down[i]].push((down[2 * i + 1], 0));
        graph[up[2 * i    ]].push((up[i], 0));
        graph[up[2 * i + 1]].push((up[i], 0));
    }
    for k in 0..m {
        let l = it.next().unwrap().parse::<usize>().unwrap() - 1;
        let r = it.next().unwrap().parse::<usize>().unwrap();
        let c: i64 = it.next().unwrap().parse().unwrap();
        let s = 3 * size + k;
        let t = 3 * size + m + k;
        let a = calc_segment_index(l, r, size);
        for a in a {
            graph[up[a]].push((s, 0));
            graph[t].push((down[a], 0));
        }
        graph[s].push((t, c));
    }
    let len = graph.len();
    let mut dp = vec![std::i64::MAX; len];
    dp[0] = 0;
    let mut h = std::collections::BinaryHeap::new();
    h.push((0, 0));
    while let Some((d, v)) = h.pop() {
        let d = -d;
        if d > dp[v] {
            continue;
        }
        for &(u, c) in &graph[v] {
            let d = d + c;
            if d < dp[u] {
                dp[u] = d;
                h.push((-d, u));
            }
        }
    }
    if dp[n - 1] == std::i64::MAX {
        println!("-1");
    } else {
        println!("{}", dp[n - 1]);
    }

}

fn main() {
    run();
}


Measured memory_bytes: 121084
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }


  int main()
  {
ios::sync_with_stdio(false);
    cin.tie(nullptr);
i64 n,m;
cin>>n>>m;
vi64 v(m+1,0LL);
forn(i,n)
{
  i64 c,d;
  cin>>c;
  forn(j,c)
  {cin>>d;
  v[d]++;
}
}
i64 ans=0LL;
for1(i,m)
{
  if(v[i]==n)
  ans++;
}
cout<<ans;


    return 0;
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int h1,m1,h2,m2,k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  cout << max(0, (h2 * 60 + m2) - (h1 * 60 + m1) - k) << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    ll n,m;
    ll ans;
    cin >> n >> m;
    if(n == 1 && m == 1) ans=1;
    else if(n==1 || m==1){
        if(m!= 1){
            ans = m-2;
        }
        else if(n!=1){
            ans = n-2;
        }
    }
    else{
        ans = (n-2)*(m-2);
    }
    cout << ans <<endl;
}

Measured memory_bytes: 256
using System;

class P
{
public static void Main()
{
 bool z = true;

            while (z)
            {
                //????????????????????????
                var WH = Console.ReadLine().Split(' ');
                int H = Int32.Parse(WH[0]);
                int W = Int32.Parse(WH[1]);

                if (!(W == 0 & H == 0))
                {
                    for (int h = 1; h <= H; h++)
                    {
                        for (int w = 1; w <= W; w++)
                        {
                            if (w != W)
                            {
                                Console.Write("#");
                            }
                            else if (w == W & h == H)
                            {
                                Console.Write("#\n\n");
                            }
                            else
                            {
                                Console.Write("#\n");
                            }
                        }
                    }
                }
                else
                {
                    z = false;
                    break;
                }
 
            }
}
}

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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
	int r; cin >> r;
	cout << r*r << endl;



    return 0;
}


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

using P = pair<long long, int>;
const long long INF = 1e18 + 10;

struct Edge {
  int to, w;
  Edge(int t, int w) : to(t), w(w) {}
};

struct Graph {
  int N, M;
  vector<vector<Edge>> edges;

  Graph(int N, int M) : N(N), M(M), edges(N) {}

  void addEdge(int a, int b) { addEdge(a, b, 1); }
  void addEdge(int a, int b, int w) { edges[a].emplace_back(b, w); }

  vector<long long> dist;
  void dijkstra(int s) {
    dist = vector<long long>(N, INF);
    dist[s] = 0;
    vector<bool> vis(N, false);
    priority_queue<P, vector<P>, greater<P>> pq;
    pq.emplace(dist[s], s);
    while (!pq.empty()) {
      long long d, now;
      tie(d, now) = pq.top(); pq.pop();
      if (vis[now]) continue;
      vis[now] = true;
      for (Edge e : edges[now]) {
        long long nw = d + e.w;
        if (nw < dist[e.to]) {
          dist[e.to] = nw;
          pq.emplace(nw, e.to);
        }
      }
    }
  }
};

int main() {
  cout << setprecision(15);
  int n, m, s, t; cin >> n >> m >> s >> t;
  s--; t--;
  Graph Ga(n, m), Gb(n, m);
  rep(i, m) {
    int u, v, a, b; cin >> u >> v >> a >> b;
    u--; v--;
    Ga.addEdge(u, v, a);
    Ga.addEdge(v, u, a);
    Gb.addEdge(u, v, b);
    Gb.addEdge(v, u, b);
  }
  Ga.dijkstra(s);
  Gb.dijkstra(t);

  vector<P> ans(n);
  rep(i, n) ans[i] = P(Ga.dist[i] + Gb.dist[i], i);
  sort(ans.begin(), ans.end());
  int now = 0;
  rep(i, n) {
    while (ans[now].second < i) now++;
    cout << 1e15 - ans[now].first << endl;
  }
}

Measured memory_bytes: 17016
import sys
input = sys.stdin.readline

n = int(input())
cnt = [2]*(n+1)

cnt[1] = 1

for i in range(2,n+1):
    for j in range(i*2,n+1,i):
        cnt[j] += 1

res = 0

for i in range(n+1):
    res += cnt[i]*i
print(res)

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

#define ll long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

const int N = 1e7+1;
ll arr[N];

void build(){
	for(int i = 0;i < N;i++){
		arr[i] = 1;
	}
	for(int i = 2;i < N;i++){
		for(int j = i;j < N;j+=i){
			arr[j]++;
		}
	}
}

int main(){
	fastio
	build();
	int n;
	cin >> n;
	ll ans = 0;
	for(int i = 1;i <= n;i++){
		ans += i * arr[i];
	}
	cout << ans << "\n";
}

Measured memory_bytes: 81772
//Even better better solutions q{^.^}p

#define ONLINE_JUDGE //in case i forget to uncomment this, sometimes the grader defines the macro ^.^
#ifdef ONLINE_JUDGE
#include <bits/stdc++.h>
#else
#include "stdc++.h"
#endif

#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))

using namespace std;
#define int long long

signed main() {
#ifndef ONLINE_JUDGE
    freopen("/Users/kdkdk/Desktop/input.txt", "r", stdin);
    //freopen("/Users/kdkdk/Desktop/output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;
    
    
    vector<int> divisors;
    int l = 1;
    for(int i = 1; i <= ceil(sqrt(m)) && n*i<=m; ++i) {
        
        if(l < i && m%i == 0) l=i;
        if(l < (m/i) && m%i == 0 && (m/i)*n <= m) l=(m/i);
    }
    cout << l << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    int a[205];
    cin >> n;
        for(int i = 0; i < 2 * n; i ++)
            cin >> a[i];
        sort(a , a + 2 * n);
        int ans = 0;
        for(int i = 2 * n - 1; i >= 0 ; i -= 2)
            ans += a[i - 1];
        cout << ans << endl;

}

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

int main(void) {
	int n, m;
	int ab[50][2];
	int cd[50][2];

	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; ++i) {
		scanf("%d %d", &ab[i][0], &ab[i][1]);
	}
	for (int i = 0; i < m; ++i) {
		scanf("%d %d", &cd[i][0], &cd[i][1]);
	}

	int ans = 0;
	int min = 999999999;
	for (int i = 0; i < n; ++i) {
		ans = 0;
		min = 999999999;
		for (int k = 0; k < m; ++k) {
			if (min > (int)abs(ab[i][0] - cd[k][0]) + (int)abs(ab[i][1] - cd[k][1])) {
				ans = k + 1;
				min = (int)abs(ab[i][0] - cd[k][0]) + (int)abs(ab[i][1] - cd[k][1]);
			}
		}
		printf("%d\n", ans);
	}

	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

#define N 8
#define NOT_FREE 1
#define FREE -1

int row[N],col[N],dpos[2*N-1],dneg[2*N-1],X[N][N];

void printBoard(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(X[i][j]){
        if(row[i]!=j) return;
      }
    }
  }
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
        if(row[i]==j) printf("Q");
        else printf(".");
      }
      printf("\n");
    }
}
  
void putQueen(int i){
  if(i==N){
    printBoard();
    return ;
  }
  int j;
  for(j=0;j<N;j++){
    if(col[j]==NOT_FREE ||
       dpos[i+j]==NOT_FREE || dneg[i-j+N-1]==NOT_FREE) continue;
    row[i]=j;
    col[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;
    putQueen(i+1);
    col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
  }
}
int main(){
  int k,r,c,i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      X[i][j]=0;
    }
  }
  for(i=0;i<N;i++){
    row[i]=FREE;
    col[i]=FREE;
  }
  for(i=0;i<2*N-1;i++){
    dpos[i]=FREE;
    dneg[i]=FREE;
  }
  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d%d",&r,&c);
    X[r][c]=1;
  }
  putQueen(0);
}



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

class Program {
  static void Main() {
    var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int a = arr[0];
    int b = arr[1];
    int c = arr[2];
    Console.WriteLine(a + b >= c ? "Yes" : "No");
  }
}

Measured memory_bytes: 13268
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int k=sc.nextInt();
        if(b-a+1<=k*2){
            for(int i=a;i<=b;i++)System.out.println(i);
        }else{
            for(int i=0;i<k;i++)System.out.println(a+i);
            for(int i=0;i<k;i++)System.out.println(b-k+1+i);
        }
    }

}

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

a = [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
]

print(a[n-1])

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
#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++)
#define _GLIBCXX_DEBUG 
int main(){
    int X,Y;
    cin>>X>>Y;
    string board[60];
    rep(i,X) cin>>board[i];
    int dx[4]={1,0,0,-1};
    int dy[4]={0,1,-1,0};
    bool judge=true;
    rep(i,X){
        rep(j,Y){
            int count=0;
            if(board[i][j]=='#'){
            rep(k,4){
                    int x,y;
                    x=i+dx[k];
                    y=j+dy[k];
                    if(x>=0&&x<X&&y>=0&&y<Y&&board[x][y]=='#') count++;
            }
            if(count==0) judge=false;

        }
    }
    }

    if(judge) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}

Measured memory_bytes: 3580
N = int(input())
A = list(map(int, input().split()))

#累積和
for i in range(1, N):
    A[i] += A[i - 1]

dic = dict()
for i in A:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
# print (A)
ans = 0
for i in dic:
    ans += dic[i] * (dic[i] - 1)
ans //= 2

if 0 in dic:
    ans += dic[0]

print (ans)

Measured memory_bytes: 37260
# -*- coding: utf-8 -*-
N = int(input())
count = 0
flag = 0
for i in range(N):
  x = list(map(int,input().split()))
  if x[0] == x[1]:
    count += 1
    if count >= 3:
      flag = 1
  else:
    count = 0

if flag:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 9168
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std;
using ll=long long int;

int gcd(int a, int b) {
    if (a < b) swap(a, b);
    int r;
    while ((r = a%b) > 0) {
        a = b;
        b = r;
    }
    return b;
}

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

    int ans;
    cin >> ans;

    for (int i = 1; i < n; ++i) {
        int a;
        cin >> a;
        ans = gcd(ans, a);
    }

    cout << ans << endl;

    return 0;
}


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

int main()
{
	int n;

	scanf("%d", &n);
	int x = min(9, n) - min(99, n) + min(999, n) - min(9999, n) + min(99999, n);
	printf("%d\n", x);

	return 0;
}


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

int main(){
  int b1, b2, b3;
  cin >> b1 >> b2 >> b3;
  if (b1 == 1 && b2 == 1 || b3 == 1) {
    cout << "Open" << endl;
  } else {
    cout << "Close" << endl;
  }
  return 0;
}


Measured memory_bytes: 3056
//ABC095A
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
using namespace std;

int main(){
	string s;
	cin >> s;
	int sigma = 700;
	for(int i=0;i<s.size();i++){
		if(s.at(i) == 'o'){
			sigma += 100;
		}
	}
	cout << sigma << endl;
	return 0;
}

Measured memory_bytes: 256
/* B */

#include <iostream>
#include <string>
using namespace std;

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

    int a = num / 100;
    int b = num % 100;

    if((a > 0 && a < 13) && (b > 0 && b < 13)) cout << "AMBIGUOUS" << endl;
    else if (a > 0 && a < 13) cout << "MMYY" << endl;
    else if (b > 0 && b < 13) cout << "YYMM" << endl;
    else cout << "NA" << endl;

}

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

int main() {
  int n;
  cin>>n;
  int vec[n][n][2];
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      for(int k=0;k<2;k++){
        vec[i][j][k]=0;
      }
    }
  }
  int ai;
  for(int i=0;i<n;i++){
    cin>>ai;
    for(int j=0;j<ai;j++){
      cin>>vec[i][j][0];
      cin>>vec[i][j][1];
    }
  }
  //vec[i][j][0] i+1人目のj+1番目の証言が指す人
  //vec[i][j][1] i+1人目のj+1番目の証言が指す人は嘘つきか否か
  int vecb[n];
  int ans=0;
  int p=0,q=0;
  for(int bit=0;bit<(1<<n);bit++){
    for(int i=0;i<n;i++){
      if(bit&(1<<i)){
        vecb[i]=1;
        q++;
      }
      else{
        vecb[i]=0;
      }
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        if(vec[i][j][0]>0){
          if(vecb[i]==1){
            if(vec[i][j][1]!=vecb[vec[i][j][0]-1]){
              p++;
            }
          }
          /*if(vecb[i]==0){
            if(vec[i][j][1]==vecb[vec[i][j][0]-1]){
              p++;
            }
          }*/
        }
      }
    }
    if(p==0){
      ans=max(ans,q);
    }
    p=0;
    q=0;
  }
  cout<<ans<<endl;    
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            int iM = int.Parse(sS[1]);
            List<ClsAtoB> lstD = new List<ClsAtoB>();
            for (int i = 0; i < iM; i++)
            {
                sS = Console.ReadLine().Trim().Split(' ');
                int ia = int.Parse(sS[0]) - 1;                          // 0始まりに変更
                int ib = int.Parse(sS[1]) - 1;                          // 0始まりに変更
                lstD.Add(new ClsAtoB() { iA = ia, iB = ib, });          // 道路の関係
                lstD.Add(new ClsAtoB() { iA = ib, iB = ia, });          // 道路の関係
            }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            List<ClsAtoB> lstN = new List<ClsAtoB>();
            for (int i = 0; i < iN; i++) { lstN.Add(new ClsAtoB() { iA = i, iB = 0, }); }
            for (int i = 0; i < lstD.Count; i++)
            {
                lstN[lstD[i].iA].iB += 1;
            }

            //出力
            for (int i = 0; i < lstN.Count; i++)
            {
                Console.WriteLine("{0}", lstN[i].iB.ToString().Trim());
            }

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
        private class ClsAtoB                   // 経路用
        {
            public int iA { get; set; } = 0;
            public int iB { get; set; } = 0;
        }

}


Measured memory_bytes: 13268
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>().into_iter().collect::<HashSet<_>>();
    println!("{}", v.len());
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
 
int main(void){
 
  int a,b,t;
  int i,x;
  int st;
  
  cin >> a>> b>> t;
  
  x=0;
  st=(t+0.5)/a;
    
  for ( i=0; i< st; i++){
  	x=x+b;
  }
  
  cout<<x;
}


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

#define INF 1e+9

int dp[100000];
int n;
vector<int> a;

void solve(){
    fill(dp, dp+n, INF);
    for (int i=0; i<n; i++) {
        *lower_bound(dp, dp+n, a[i])=a[i];
    }
    cout<<lower_bound(dp, dp+n, INF)-dp<<endl;
}

int main(){
    cin>>n;
    a.resize(n);
    for (int i=0; i<n; i++) cin>>a[i];
    solve();
    return 0;
}

Measured memory_bytes: 3628
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(18);
}
#define MOD 1000000007
signed main(){
  init_io();
  string s;
  cin >> s;
  ll n,val;
  n = s.size();
  ll dp[n+1][13]; //i番目まで見た時、13で割った余りがjになる数
  fill(dp[0],dp[n+1],0);
  dp[0][0] = 1;
  for(int i=0;i<n;i++){
    if(s[i]!='?'){
      val = s[i]-'0';
      for(int j=0;j<13;j++){
        ll nxt = ((j*10) + val)%13;
        dp[i+1][nxt] += dp[i][j];
        dp[i+1][nxt] %= MOD;
      }
    }else{
      for(int val=0;val<10;val++){
        for(int j=0;j<13;j++){
          ll nxt = ((j*10) + val)%13;
          dp[i+1][nxt] += dp[i][j];
          dp[i+1][nxt] %= MOD;
        }
      }
    }
  }
  cout << dp[n][5]<<endl;
}


Measured memory_bytes: 10704
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int a,b;cin>>a>>b;
    if(a*2>=b&&b*2>=a)
        cout<<"Yay!"<<endl;
    else
        cout<<":("<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
//#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(){
    long int N;
    cin>>N;
    long int A[N];
    for (long int i=0;i<N;i++) cin>>A[i];
    vector<long int> v,w(1005,1);
    for (long int i=2;i<1005;i++){
        if (w[i]==1){
            v.push_back(i);
            int n=i;
            while(n<1005){
                w[n]=0;
                n+=i;
            }
        }
    }
    long int sz=v.size();
    bool a=true,b=true;
    for (long int i=0;i<sz;i++){
        int m=0;
        for (long int j=0;j<N;j++){
            if (A[j]%v[i]==0){
              m++;
              while(A[j]%v[i]==0){
                A[j]=A[j]/v[i];
              }
            }
        }
        if (m>=2) a=false;
        if (m==N) b=false;
    }
    sort(A,A+N);
    if (a){
        for (long int i=0;i<N-1;i++){
            if (A[i]==A[i+1] && A[i]!=1) a=false;
        }
      if (A[0]==A[N-1] && A[0]!=1) b=false;
    }

    if (a) cout<<"pairwise coprime"<<endl;
    else if (b) cout<<"setwise coprime"<<endl;
    else cout<<"not coprime"<<endl;

    return 0;
}

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

int main() {
  string s;
  cin >> s;
  int num = 0;
  rep(i, 3) {
    if (s.at(i) == 'o') num++;
  }
  cout << 700 + num * 100 << endl;
}

Measured memory_bytes: 256