akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
    public static void main(String args[]) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] tokens = br.readLine().split(" ");
        long a = Long.parseLong(tokens[0]);
        long b = convertToLong(tokens[1]);
        long ans = (a*b)/100;
        System.out.println(ans);
    }

    private static long convertToLong(String s){
        long num = 0;
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)>='0' && s.charAt(i)<='9'){
                num=num*10 + (s.charAt(i)-'0');
            }
        }
        return num;
    }

}

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

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

    int ans = -1;
    if (a <= 9 && b <= 9) ans = a * b;

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


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,i;
  while(scanf("%d %d",&a,&b)!=EOF){
    int n[101]={0,1,1,0};
    while(1){
      n[a]++;
      n[b]++;
      scanf("%d %d",&a,&b);
      if(a==0&&b==0)break;
    }
    for(i=1;i<101;i++){
      if(n[i]%2==1)break;
    }
    if(i==101)printf("OK\n");
    else      printf("NG\n");
  }
  return 0;
}
    

Measured memory_bytes: 584
main(f,n,x){
  for(;~scanf("%d",&n);puts("")){
    for(f=0,x=1;n;x+=x){
      if(n&x){
        if(f)putchar(' ');
        printf("%d",x),n-=x,f=1;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 612
#include<stdio.h>
#include<string.h>

int main() {
  int n;
  char s[4];
  double x, total = 0;
  scanf("%d", &n);
  for(int i; i < n; i++) {
    scanf("%lf %s", &x, s);
    if(strcmp(s, "JPY") == 0) {
      total += x;
    } else {
      total += 380000 * x;
    }
  }
  printf("%lf\n", total);
}

  

Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

int main()
{
    string a;
    cin >> a;
    ll n = a.size();
    ll count[26] {0};
    for(int i = 0; i < n; i++) count[a[i] - 'a']++;
    ll ans = n * (n - 1) / 2 + 1;
    for(int i = 0; i < 26; i++) ans -= count[i] * (count[i] - 1) / 2;
    cout << ans << endl;
}

Measured memory_bytes: 640
//#include <iostream>
#include <stdio.h>
#include <algorithm>
//#include <tuple>
#include <cmath>
#include <string>
#include <vector>

#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
using namespace std;

int n, m;
int a[30][30];

int main() {

	scanf("%d %d", &n, &m);

	rep(i, n) {
      	int tmp;
		scanf("%d", &tmp);
		
		rep(j, tmp) {
			int x;
			scanf("%d", &x);
			a[i][x-1]++;
		}
	}
	
	int ans = 0;
	

	rep(i, m) {
		bool flag = 1;

		rep(j, n) {
			if (a[j][i] == 0) {
				flag = 0;
				break;
			}
		}
		if (flag) ans++;
	}

	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
const int MAXX=2010;
struct node
{
    int x,y;
}e[MAXX];
int head[MAXX],ver[MAXX<<1],nxt[MAXX<<1],deep[MAXX];
int n,k,tot;
inline void add(int x,int y){
    ver[++tot]=y;
    nxt[tot]=head[x];
    head[x]=tot;
}
inline void dfs(int x,int f,int dp){
    deep[x]=dp;
    for(int i=head[x];i;i=nxt[i]){
        int y=ver[i];
        if(y==f)continue;
        dfs(y,x,dp+1);
    }
} 
int main(){
   scanf("%d%d",&n,&k);
   for(int i=1;i<n;++i){
    scanf("%d%d",&e[i].x,&e[i].y);
    add(e[i].x,e[i].y);
    add(e[i].y,e[i].x);
   }
   int ans=0x3f3f3f3f;
   if(k&1){
      for(int i=1;i<n;++i){
        int cnt=0;
        dfs(e[i].x,e[i].y,0);
        dfs(e[i].y,e[i].x,0);
        for(int j=1;j<=n;++j)if(deep[j]>(k-1)/2)cnt++;
        ans=min(ans,cnt);
      } 
   }
   else {
      for(int i=1;i<=n;++i){
      int cnt=0;
      dfs(i,0,0);
      for(int j=1;j<=n;++j)if(deep[j]>k/2)cnt++;
      ans=min(ans,cnt);
      }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		TreeMap<Integer, Obj> map = new TreeMap<>();
		map.put(0, new Obj());
		for (int i = 0; i < n; i++) {
			Integer h = map.ceilingKey(a[i]);
			if (h == null) {
				Obj o = new Obj();
				o.i = i;
				o.size = 1;
				map.put(a[i], o);
			} else {
				Integer l = map.floorKey(a[i]);
				map.get(h).cnt += a[i] - l;
				map.get(l).size++;
			}
		}

		long[] ans = new long[n];
		long sum = 0;
		Integer[] arr = map.keySet().toArray(new Integer[0]);
		for (int i = arr.length - 1; i > 0; i--) {
			Obj o = map.get(arr[i]);
			sum += o.size;
			ans[o.i] += (arr[i] - arr[i - 1]) * sum + o.cnt;
		}

		PrintWriter pw = new PrintWriter(System.out);
		for (int i = 0; i < n; i++) {
			pw.println(ans[i]);
		}
		pw.flush();
	}

	static class Obj {
		int i, size;
		long cnt;

		public String toString() {
			return i + "-" + size + "-" + cnt;
		}
	}
}


Measured memory_bytes: 46932
main = do
  getLine
  as <- map read . words <$> getLine :: IO [Int]
  let pns = cycle [1,-1] :: [Int]
  print $ min (solve (zip as pns) 0) (solve (zip as (tail pns)) 0)

solve :: [(Int,Int)] -> Int -> Int
solve [] acc = 0
solve ((a1,b1):xs) acc
  | signum (acc+a1) == b1 = 0 + solve xs (acc+a1)
  | b1 == 1 = (1 - (acc+a1)) + solve xs 1
  | otherwise = abs (-1-(acc+a1)) + solve xs (-1)

Measured memory_bytes: 54652
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;

  int maxw = f / 100;
  vector<bool> w(maxw + 1, false);
  w[0] = true;
  rep(i, maxw + 1) {
    if (w[i]) {
      if (i + a <= maxw) w[i + a] = true;
      if (i + b <= maxw) w[i + b] = true;
    }
  }

  vector<bool> s(maxw * e + 1, false);
  s[0] = true;
  rep(i, maxw * e + 1) {
    if (s[i]) {
      if (i + c <= maxw * e) s[i + c] = true;
      if (i + d <= maxw * e) s[i + d] = true;
    }
  }

  long double ansp = 0;
  int answ = 0, anss = 0;
  FOR(i, 1, maxw + 1) {
    if (!w[i]) continue;
    repr(j, i * e) {
      if (s[j] && i * 100 + j <= f) {
        long double resp = (long double)j / (long double)(i * 100 + j);
        if (ansp <= resp) {
          ansp = resp;
          answ = i * 100 + j;
          anss = j;
        }
        break;
      }
    }
  }

  cout << answ << " " << anss << endl;

  


  
  return 0;
}

Measured memory_bytes: 256
d = input().split()
N = int(d[0])
M = int(d[1])

def main():
    dic = {}
    for i in range(1, N+1):
        dic[i] = 0
    Ls = []
    Rs = []
    for i in range(M):
        d = input().split()
        l = int(d[0])
        r = int(d[1])
        Ls.append(l)
        Rs.append(r)
    lm = max(Ls)
    rm = min(Rs)
    if rm - lm >= 0:
        print(rm - lm + 1)
    else:
        print(0)



if __name__ == '__main__':
    main()





Measured memory_bytes: 22120
// #Sazaの1日1AC
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000000+7;
const long long INF=9e18;
const double PI=3.14159265358979323846;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
using vvl=vector<vector<long long>>;
using vP=vector<pair<long long, long long>>;
//ショートカット
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,k,n) for(int i=k;i<n;i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
//入力
#define vin(v,N) for(long long i=0;i<N;i++) cin>>v.at(i)
#define lin(n) long long n;cin>>n
#define chin(x) char x;cin>>x;
#define sin(s) string s;cin>>s;
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

#define max(a,b) max((ll)a,(ll)b)
#define min(a,b) min((ll)a,(ll)b)

//関数
//最大公約数
long long gcd(long long m, long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m, long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x, long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//繰り返し二乗法
long long repeat_squaring(long long x, long long n){
  if(n==0) return 1;
  else if(n%2==0){
    long long t=repeat_squaring(x,n/2);
    return t*t%mod;
  }
  else
    return x*repeat_squaring(x,n-1);
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//構造体
//Union-Find木
struct UnionFind{
  //メンバ変数 
  vector<long long>par; //par[i]:=頂点iの親
  vector<long long>s; //s[i]:=頂点iが属する集合の個数(iが根のとき)
  
  //コンストラクタ
  UnionFind(long long N):par(N),s(N){
    for(long long i=0;i<N;i++){
      par[i]=i; //最初はすべてが根として初期化
      s[i]=1;
    }
  }
  //メンバ関数
  //root(i):=頂点iの根
  long long root(long long i){
    if(par[i]==i) return i;
    par[i]=root(par[i]); //経路圧縮
    return root(par[i]); //再帰
  }
  //size[i]:=iが属する集合の個数
  long long size(long long i){
    return s[root(i)];
  }
  //same(x,y) xとyが同じ根を持つか(同じ集合に含まれるか)
  bool same(long long x, long long y){
    return root(x)==root(y);
  }
  //unite(x,y) xの根をyの根に繋げる(集合を合併)
  void unite(long long x, long long y){
    if(!same(x,y)){
      long long rx=root(x);
      long long ry=root(y);
      par[rx]=par[ry];
      s[ry]=s[rx]+s[ry];
    }
  }
};
//////////////////ここまでライブラリ///////////////////////

//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(10);
  
  
  lin(N);lin(M);
  vlin(a,N);
  
  sort(rall(a));
  ll s = 0;
  rep(i,N) s += a[i];
  bool OK = true;
  rep(i,M){
    if(a[i] < (s + 4*M -1)/4/M) OK = false;
  }
  
  if(OK) cout <<"Yes" << endl;
  else cout<<"No"<< endl;
  
}

Measured memory_bytes: 256
program prob2
    implicit none
    integer :: N, i, tmp, ans
    integer, allocatable :: a(:)
    read(*,*) N
    allocate(a(N))
    read(*,*) a

    tmp = 1
    ans = 1
    do i = 2, N
        if(a(i-1) >= a(i))then
            tmp = tmp + 1
        else
            ans = max(ans, tmp)
            tmp = 1
        end if
    end do
    ans = max(ans, tmp)

    write(*,*) ans-1


    deallocate(a)

    stop
contains
end program prob2

Measured memory_bytes: 3364
#pragma GCC optimize("O3")
#include <atcoder/all>
using namespace atcoder;
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  int n;
  cin >> n;
  R(i,n){
    cout << "ACL";
  }
  cout << "\n";
}


Measured memory_bytes: 3644
#include <cstdio>
#include <algorithm>
#include <functional>

int n;
int S[1<<18];
int Q[19];


int main(){
  scanf("%d",&n);
  for(int i=0;i<(1<<n);i++) scanf("%d",S+i);
  std::sort(S, S+(1<<n), std::greater<int>());
  int k = 0;
  for(int i=0;i<(1<<n);){
    int j = i;
    for(i++; S[i] == S[j]; i++) ;
    S[k++] = i-j;
  }
  Q[n] = 1;
  for(int i=0;i<k;i++){
    int l;
    int a=0;
    for(l=n;l>=0 && a < S[i];l--) a += Q[l];
    if(a<S[i]){
      puts("No");
      return 0;
    }
    l++;
    for(int t=0;t<l;t++) Q[t] += S[i];
    int b = a-Q[l];
    Q[l] = a-S[i]+b;
    for(n=l+1;b;n++){
      b -= Q[n];
      Q[n] = b;
    }
    n--;
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 1152
import heapq

N, M = map(int, input().split())
ABs = [tuple(map(int, input().split())) for _ in range(N)]
ABs.sort(reverse = True)

works = []
reward = 0
for i in range(1, M+1):
	while ABs and ABs[-1][0] <= i:
		heapq.heappush(works, -ABs.pop()[1])
	if works:
		reward -= heapq.heappop(works)
        
print(reward)

Measured memory_bytes: 17160
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;

void solve(void)
{
	ll x;
	scanf("%lld",&x);
	ll ans = x/500 * 1000;
	x%=500;
	ans += x/5 * 5;
	printf("%lld\n",ans);
}

int main(void)
{
	int T=1;
//	scanf("%d",&T);
	while(T--) solve();
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,X=0;cin>>A>>B>>C;
  if((A%2+B%2+C%2)%3!=0){
    X++;
    if((A-B)%2==0){A++;B++;}
    else if((B-C)%2==0){B++;C++;}
    else{C++;A++;}
  }
  X+=(max({A,B,C})-A)/2;
  X+=(max({A,B,C})-B)/2;
  X+=(max({A,B,C})-C)/2;
  cout<<X<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>
#define MAX 100002
int max(int a,int b){
    if(a>b) return a;
    return b;
}
int main(){
   int N;
   scanf("%d",&N);
   int a[MAX],b[MAX],c[MAX];
   for(int i=1;i<=N;i++)
       scanf("%d %d %d",a+i,b+i,c+i);
   int DP[MAX][3];
   DP[1][0] = a[1];
   DP[1][1] = b[1];
   DP[1][2] = c[1];
   for(int i=2;i<=N;i++){
        DP[i][0] = a[i] + max(DP[i-1][1],DP[i-1][2]);
        DP[i][1] = b[i] + max(DP[i-1][2],DP[i-1][0]);
        DP[i][2] = c[i] + max(DP[i-1][0],DP[i-1][1]);
   }
   printf("%d",max(DP[N][0],max(DP[N][1],DP[N][2])));
}


Measured memory_bytes: 2560
x1, y1, x2, y2 = list(map(int, input().split()))
x3 = x2 - y2 + y1
y3 = y2 + x2 - x1
x4 = x1 + y1 - y2
y4 = y1 - x1 + x2

print(x3, y3, x4, y4)

Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}

int main(){
	int a,b;scanf("%d%d",&a,&b);
	printf("%d\n",(a+b)%24);
}

Measured memory_bytes: 128
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String[] name = {"light fly","fly","bantam","feather","light","light welter"
                    ,"welter","light middle","middle","light heavy","heavy"};
    double[] border = {48.0,51.0,54.0,57.0,60.0,64.0,69.0,75.0,81.0,91.0};
    start:
    while(sc.hasNext()) {
      double w = sc.nextDouble();
      for (int i = 0; i < 10; i++) {
        if (w <= border[i]) {
          System.out.println(name[i]);
          continue start;
        }
      }
      System.out.println(name[10]);
    }
  }
}

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

#define FOR(i, s, e)   for(int i = (s); i < (e); i++)
#define FOR64(i, s, e) for(ll  i = (s); i < (e); i++)
#define ALL(x)         (x).begin(), (x).end()
#define SORT(b, e)     sort((b), (e))
#define REV(b, e)      reverse((b), (e))
#define VSORT(v)       sort((v).begin(), (v).end())
#define VREV(v)        reverse((v).begin(), (v).end())
#define pb(a)          push_back(a)
#define INF            999999999

typedef long long ll;

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

	vector<int> P(M+1);
	vector<int> Y(M+1);

	map<int, vector<int>> m;

	FOR(i, 1, M+1){
		cin >> P[i] >> Y[i];
		m[P[i]].pb(Y[i]);
	}

	for(auto &e : m){
		VSORT(e.second);
	}

	FOR(i, 1, M+1){
		auto &e = m[P[i]];
		auto it = lower_bound(ALL(e), Y[i]);
		printf("%06d%06d\n", P[i], it - e.begin() + 1);
	}

	return 0;
}



Measured memory_bytes: 13184
#include<bits/stdc++.h>
using namespace std;
int M = 1000000007;

int main() {
    int n, d;
    cin >> n >> d;
    int p = 0;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        p ^= (a - 1) % (d + 1);
    }
    cout << (p == 0 ? "Second\n" : "First\n");
    return 0;
}



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

int main() {
	int c=0;
	string S;
	char p;
	cin >> S;

	p = S.at(0);
	rep(i,S.size()-1) {
		if(S.at(i+1) != p)
			c++;
		p = S.at(i+1);
	}

	cout << c << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;

struct POINT{
	int x;
	int y;
};

int dx[] = {-1, 0, 1,  0};
int dy[] = { 0, 1, 0, -1};

int main(void) {
	int N;
	while (cin >> N, N) {
		POINT minp = {0, 0};
		POINT maxp = {0, 0};

		vector<POINT> box(N);
		box[0].x = 0; box[0].y = 0;
		for (int i = 1; i < N; i++) {
			int n, d;
			cin >> n >> d;
			box[i].x = box[n].x + dx[d];
			box[i].y = box[n].y + dy[d];

			minp.x = min(minp.x, box[i].x);
			minp.y = min(minp.y, box[i].y);
			maxp.x = max(maxp.x, box[i].x);
			maxp.y = max(maxp.y, box[i].y);
		}

		//cerr << "--- ";
		cout << (maxp.x - minp.x + 1) << " " << (maxp.y - minp.y + 1) << endl;
	}

	return 0;
}

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();
            var ss = "";
            var tt = "";
            for (char c = 'a'; c <= 'z'; c++)
            {
                for (int i = 0; i < s.Length; i++)
                {
                    if (s[i] == c) ss += c;
                }
            }
            for (char c = 'z'; c >= 'a'; c--)
            {
                for (int i = 0; i < t.Length; i++)
                {
                    if (t[i] == c) tt += c;
                }
            }

            var min = s.Length < t.Length ? s.Length : t.Length;

            for (int i = 0; i < min; i++)
            {
                if (ss[i] < tt[i])
                {
                    Console.WriteLine("Yes");
                    return;
                }else if (ss[i] > tt[i])
                {
                    Console.WriteLine("No");
                    return;
                }
            }

            Console.WriteLine(t.Length > s.Length ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, Npow, divisor, modinv, bitSearch, bitList, dfs, bfs//
//dijkstra, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z;
ll MOD = 1000000007; ll INF = 1LL << 60; ll ans = 0; ll z = 0, o = 1;
vl flag, color, G, C; vll path, path2; vll Ans;
//***********//
//使用時のpath[i][j]はN*N行列形式
void warshall_floyd(int n) {
	for (int k = 0; k < n; k++) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				path[i][j] = min(path[i][j], path[i][k] + path[k][j]);
			}
		}
	}
}
void warshall_floyd2(int n) {
	for (int k = 0; k < n; k++) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				path2[i][j] = min(path2[i][j], path2[i][k] + path2[k][j]);
			}
		}
	}
}
int main() {
	cin >> N >> M >> L;
	path.resize(N);
	path2.resize(N);
	G.resize(N);
	C.resize(N);
	Ans.resize(N);
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			path[i].push_back(INF);
			path2[i].push_back(INF);
		}
	}
	for (i = 0; i < M; i++) {
		ll a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		path[a][b] = c;
		path[b][a] = c;
	}
	ll Q;
	cin >> Q;
	warshall_floyd(N);
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			if (path[i][j] <= L) {
				path2[i][j] = 1;
			}
		}
	}
	warshall_floyd2(N);
	vl Ans(Q);
	for (i = 0; i < Q; i++) {
		ll s, t;
		cin >> s >> t;
		s--; t--;
		if (path2[s][t] >= INF) Ans[i] = 0;
		else Ans[i] = path2[s][t];
	}
	for (i = 0; i < Q; i++) {
		cout << Ans[i]-1 << endl;
	}
}


Measured memory_bytes: 3712
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << "[line : " << __LINE__ <<"]"<< pp(x)
#define dg2(x,y) debug() << "[line : " << __LINE__ <<"]"<< pp(x) pp(y)
#define dg3(x,y,z) debug() << "[line : " << __LINE__ <<"]"<< pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << "[line : " << __LINE__ <<"]"<< pp(w) pp(x) pp(y) pp(z)
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x , y) memset(x , y , sizeof x);
#define sz(x) (int)x.size()
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
const int xx = 2e5;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int R, C, M;
  cin >> R >> C >> M;

  vector<int> rsum(R, 0);
  vector<int>csum(C, 0);
  vector<pair<int,int>>P;
  for(int i = 0; i < M; i++){
    int h , w;
    cin >> h >> w;
    h--,w--;
    rsum[h]++;
    csum[w]++;
    P.emplace_back(h,w);
  } 
  int Rmax = *max_element(all(rsum));
  int Cmax = *max_element(all(csum));
  int t1 = 0 , t2 = 0;
  for(int i = 0;i < R; i++) {
    if(rsum[i] == Rmax) t1++;
  }
  for(int i = 0; i < C; i++) {
    if(csum[i] == Cmax) t2++;
  }
  int t = t1 * t2;
  int ans = Rmax + Cmax;
  for(auto i : P) {
    if(rsum[i.first] == Rmax && csum[i.second] == Cmax) {
      t--;
    }
  }
  if(t == 0) ans--;
  cout << ans << '\n';
}

Measured memory_bytes: 16312
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))
n,m,q = I2()
r = []
a = [0]*q
b = [0]*q
c = [0]*q
d = [0]*q
ans = []
import copy
def dfs(A):
    if len(A) == n+1:
        now = 0
        for i in range(q):
            if A[b[i]]-A[a[i]] == c[i]:now += d[i]
        ans.append(now)
        return
    A.append(A[-1])
    while (A[-1] <= m):
        dfs(copy.copy(A))
        A[-1] += 1
if __name__ == "__main__":
    for i in range(q):
        a[i],b[i],c[i],d[i] = I2()
    dfs([1])
    print(max(ans))

Measured memory_bytes: 12728
#include<stdio.h>
#include<limits.h>
#include <stdlib.h>
#include<string.h>
#include<stdbool.h>

int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	int queueA[n][m];
	int queueB[m];

	//queueA
	for(int i=0;i<n;i++){
		char ANums[n];//数字は一桁なので要素数n
		scanf("\n%[^\n]",ANums);
		//文字列から数字を取り出す
		int digitcount=0;
		for(int j=0;j<m;j++){
			//printf("i=%d\n",j);
			//次の数値に
			while(ANums[digitcount]==' '){
				digitcount++;
			}
			//数値を取り出す
			queueA[i][j]=atoi(&ANums[digitcount]);

			//ラストでなければ次の空白に
			if(j!=m-1){
				while(ANums[digitcount]!=' '){
					digitcount++;
				}
			}
		}

	}
	/*
	printf("\n@@@@@\n");
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			printf("%d ",queueA[i][j]);
		}
		puts("");
	}
	printf("\n@@@@@\n");
	*/

	//queueB
	for(int i=0;i<m;i++){
		scanf("%d",&queueB[i]);
	}

	//計算
	for(int i=0;i<n;i++){
		int sum=0;
		for(int count=0;count<m;count++){
			sum+=queueA[i][count]*queueB[count];
		}
		printf("%d\n",sum);
	}



	return 0;
}



Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);cout.tie(NULL);
  #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
  #endif
      long long q(1);//cin>>q;
  while(q--){
    long long x,d,k,tot(0);string s,p;cin>>x>>k>>d;
      if(x>=0){
        if(k>x/d){
          k-=(x/d);
          x-=d*(x/d);
          if(k & 1){
            cout<<abs(x-d);
          }
          else{
            cout<<abs(x);
          }
        }
        else{
          cout<<x-k*d;
        }
      }
      else{
        if(k>((-1)*(x)/d)){
          k+=(x/d);
          x-=d*(x/d);
          if(k & 1){
            cout<<abs(x+d);
          }
          else
            cout<<abs(x);
        }
        else{
          cout<<abs(x+k*d);
        }
      }
  }
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define N 1003
int n,A[N][N],D[N][N],ans;
int P[N][N],b,fo,H[N],La[N];
int Now[N],now[N],cnt,tot,a;
int main() {
	scanf("%d",&n),cnt=n;
	for(int i=1; i<=n; i++) {
		Now[i]=i;
		now[i]=1;
		for(int j=1; j<n; j++) {
			scanf("%d",&A[i][j]);
			P[i][A[i][j]]=j;
		}
	}
	ans=0,fo=1;
	while(cnt&&fo) {
		fo=0,ans++,tot=0;
		for(int i=1; i<=cnt; ++i) {
			b=Now[i];
			if(La[b]==ans) {
				if(now[b]^n)Now[++tot]=b;
				continue;
			}
			a=A[b][now[b]];
			if(A[a][now[a]]==b&&La[a]!=ans) {
				now[a]++,now[b]++,fo=1,La[b]=La[a]=ans;
			}
			if(now[b]^n)Now[++tot]=b;
		}
		cnt=tot;
	}
	if(!fo)printf("-1");
	else printf("%d\n",ans);
	return 0;
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define INF 999999999
#define MOD 1000000007
#define sp ' '


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i];}cerr << endl;}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};


typedef pair<pint, pint> T;
bool citycomp(T lhs, T rhs){
    return lhs.first.first <= rhs.first.first;
}

typedef pair<pint, pint> T;
bool yearcomp(T lhs, T rhs){
    return lhs.second.first <= rhs.second.first;
}


int main(){

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

    int n, m;
    cin >> n >> m;

    vector<pair<pint, pint>> city;
    // < < city_i, ID > , < year, prefecture > >
    rep(i, m){
        int p, y, id = 0;
        cin >> p >> y;
        city.push_back(make_pair(make_pair(i+1, id), make_pair(y, p)));
    }

    sort(city.begin(), city.end(), yearcomp);

    map<int, int> mp;
    for(auto& c : city){
        mp[c.second.second]++;
        c.first.second = mp[c.second.second];
    }

    sort(city.begin(), city.end(), citycomp);

    for(auto c : city){
        cout << setw(6) << setfill('0') << c.second.second << setw(6) << setfill('0') << c.first.second << endl;
    }
    return 0;
}


Measured memory_bytes: 7792
#include <bits/stdc++.h>
#define INF (1<<18)
#define INFLL (1ll<<54)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int n;
ll st[2*INF-1];

void init( int n_ ){
	n = 1;
	while( n < n_ ) n = 2*n;
	for( int i = 0; i < 2*n; ++i ) st[i] = INFLL;
}

void update( int k, ll a ){
	k += n-1; st[k] = a;
	while( k ){
		k = (k-1)/2;
		st[k] = min( st[2*k+1], st[2*k+2] );
	}
}

ll query( int a, int b, int k, int l, int r ){
	if( b <= l || r <= a ){
		return INFLL;
	} else if( a <= l && r <= b) {
		return st[k];
	} else {
		return min(
			query( a, b, 2*k+1, l, (l+r)/2 ),
			query( a, b, 2*k+2, (l+r)/2, r )
		);
	}
}

struct absn{
	int l;
	int r;
	ll cost;
};

int main(){
	int dn; cin >> dn;
	init(dn);
	int m; cin >> m;
	vector<absn> s(m);
	for( int i = 0; i < m; ++i ){
		cin >> s[i].l >> s[i].r >> s[i].cost;
		--s[i].l; --s[i].r;
	}
	sort( s.begin(), s.end(), 
		[]( const absn& x, const absn& y ){
			return ( x.r == y.r ) ? ( x.l < y.l ) : ( x.r < y.r );
		}
	);
	update( 0, 0 );
	for( int i = 0; i < m; ++i ){
		update( s[i].r, min( query(s[i].r, s[i].r+1, 0, 0, n), query( s[i].l , s[i].r, 0, 0, n )+s[i].cost ) );
	}
	ll ans = query(dn-1, dn, 0, 0, n);
	cout << ( ans == INFLL ? -1 : ans ) << endl;
}

Measured memory_bytes: 5888
#include<stdio.h>
int main(void)
{
  int X;
  long long A,B;
  while(scanf("%d",&X)!=0)
  {
    for(A=0;!0;A++)for(B=0;B<A;B++)
    {
      if(A*A*A*A*A-B*B*B*B*B==X)return printf("%lld %lld\n",A,B),0;
      else if(A*A*A*A*A+B*B*B*B*B==X)return printf("%lld %lld\n",A,-B),0;
    }
  }
}

Measured memory_bytes: 1732
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
const int INF=1e9;

int main(){
    int n;cin>>n;
    int l[2*n];
    for(int i=0;i<2*n;i++) cin>>l[i];
    sort(l,l+2*n,greater<int>());
    int ans=0;
    for(int i=1;i<2*n;i+=2){
        ans+=l[i];
    }
    cout<<ans<<endl;
    return 0;
}

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

int cnt,m;
vector<int> G;

void insertionSort(vector<int>& a, int n, int g) {
	for(int i=g; i<n; ++i) {
		int j,v=a[i];
		for(j=i-g; j>=0 && a[j]>v;j-=g) {
			swap(a[j+g],a[j]);
			++cnt;
		}
		a[j+g]=v;
	}
}

void shellSort(vector<int>& a,int n) {
	cnt = 0;
	m=0;
	int d=n;
	G.resize(n);
	while(1) {
		d=2*d/3;
		if(d<2) {
			G[m]=d;
			++m;
			break;
		}
		G[m]=d;
		++m;
	}
	for(int i=0; i<m; ++i) {
		insertionSort(a, n, G[i]);
	}
}

int main() {
	int n;
	vector<int> a;
	scanf("%d",&n);
	a.resize(n);
	for(int i=0; i<n; ++i) {
		scanf("%d",&a[i]);
	}
	shellSort(a,n);
	printf("%d\n",m);
	for(int i=0; i<m-1; ++i) {
		printf("%d ",G[i]);
	}
	printf("%d\n%d\n",G[m-1],cnt);
	for(int i=0;i<n;++i) {
		printf("%d\n",a[i]);
	}
	return 0;
}

Measured memory_bytes: 10036
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a;
  int b=0,c=0;
  cin>>a;
  b=a.size();
  for(int i=0;i<b;i++){
    if(a[i]==a[b-1]){
      c+=0;
    }
    else{
      c++;
    }
    b-=1;
  }
  cout<<c<<'\n';
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rsort(x) sort(x.rbegin(), x.rend())
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define fio(x) ios::sync_with_stdio(x), cin.tie(x), cout.tie(x);
#define znit(x) memset(x, 0, sizeof(x))
#define mnit(x) memset(x, -1, sizeof(x))
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<db, db> pdd;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int inf = 0x3f3f3f3f;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db EPS = 1e-7;

const ll mod = 1e9 + 7;
const ll mod2 = 1e9 + 9;
ll mypow(ll x, ll y, ll p){ll ret = 1;while(y){if(y & 1) ret = (ret * x) % p;x = (x * x) % p; y /= 2;}return ret;}
ll inv(ll x, ll p){return mypow(x, p - 2, p);}
ll gcd(ll x, ll y){return y ? gcd(y, x % y) : x;}

const int MAX = 2e5 + 3;

int N, ans;

int main(){
	cin >> N;
	for(int i = 1; i <= N; i += 2){
		set<int> st;
		for(int j = 1; j * j <= i; j++){
			if(i % j == 0){
				st.insert(j);
				st.insert(i / j);
			}
		}
		if(st.size() == 8)	ans++;
	}
	printf("%d\n",ans);
	return 0;
}

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

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

    if(N[0]=='7'){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(N[1]=='7'){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(N[2]=='7'){
        cout<<"Yes"<<endl;
        return 0;
    }

    cout<<"No"<<endl;
    return 0;
}

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

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

    int n;
    cin>>n;
    int a[n+1],b[n+1];
    vector<int> ans;
    memset(b,0,sizeof(b));
    for(int i = 1 ; i <= n ; i++){
        cin>>a[i];
    }
    int cnt = 0;
    for(int i = n ; i>0 ; i--){
        int s = 0;
        for(int j = i ; j <= n ; j+=i){
            s += b[j];
        }
        if(s%2 != a[i]){
            b[i] = 1;
            ans.push_back(i);
        }
    }
    cout<<ans.size()<<'\n';
    for(auto i : ans){
        cout<<i<<' ';
    }
    
}

Measured memory_bytes: 3192
using System;
using System.Collections.Generic;

namespace ITP1_6_D{
    class Program{
        static void Main(string[] args){
            string[] nm = new string[2];
            nm = Console.ReadLine().Split(' ');
            int n = int.Parse(nm[0]);
            int m = int.Parse(nm[1]);
            int[][] nxm = new int[n][];
            for(int i=0; i<n; i++){
                nxm[i] = new int[m];
                string[] sa = Console.ReadLine().Split(' ');
                int[] arrm = new int[m];
                for(int j=0; j<m; j++){
                    arrm[j] = int.Parse(sa[j]);
                }
                nxm[i] = arrm;
            }
            int[] b = new int[m];
            for(int k=0; k<m; k++){
                b[k] = int.Parse(Console.ReadLine());
            }
            
            int[] c = new int[n];
            for(int cn=0; cn<n; cn++){
                for(int cm=0; cm<m; cm++){
                    c[cn] += b[cm]*nxm[cn][cm];
                }
                Console.WriteLine(c[cn]);
            }
        }
    }
}


Measured memory_bytes: 16028
import java.util.*;
public class Main {
    public static void main(String[] args) throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
        while (true){
        int total =scan.nextInt();
        if(total==0 )break;
        int sum=0;
        for(int i=0;i<9;i++)sum+=scan.nextInt();
        System.out.println(total-sum);
        }

  }
  }

Measured memory_bytes: 12000
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, m = map(int, readline().split())
sc = [list(map(int, readline().split())) for _ in range(m)]

if n == 1:
    l = [i for i in range(10)]
elif n == 2:
    l = [i for i in range(10, 100)]
else:
    l = [i for i in range(100, 1000)]

for s, c in sc:
    l = [x for x in l if str(x)[s - 1] == str(c)]

if len(l) >= 1:
    print(min(l))
else:
    print('-1')

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, a[301], dp[301][300*300+1000];
ll mod = 998244353;

ll kumi3(ll n){
	ll r = 1;
	for(ll i = 1; i <= n; i++){r *= 3; r %= mod;}
	return r;
}

int main(){
	cin >> n;
	ll suma = 0;
	for(ll i = 1; i <= n; i++){cin >> a[i]; suma += a[i];}
	
	memset(dp, 0, sizeof(dp));
	dp[0][0] = 1;
	for(ll i = 1; i <= n; i++){
		for(ll j = 300*i; j >= 0; j--){
			dp[i][j+a[i]] += dp[i-1][j];
			dp[i][j+a[i]] %= mod;
			dp[i][j] += 2*dp[i-1][j];
			dp[i][j] %= mod;
		}
	}
	
	
	ll notans = 0;
	for(ll j = (suma+1)/2; j <= suma; j++){
		notans += dp[n][j];
		notans %= mod;
	}
	
	if(suma%2 == 0){
		memset(dp, 0, sizeof(dp));
		dp[0][0] = 1;
		for(ll i = 1; i <= n; i++){
			for(ll j = 300*i; j >= 0; j--){
				dp[i][j+a[i]] += dp[i-1][j];
				dp[i][j+a[i]] %= mod;
				dp[i][j] += dp[i-1][j];
				dp[i][j] %= mod;
			}
		}
		notans -= dp[n][suma/2];
	}

	cout << (mod+kumi3(n)-(3*notans)%mod)%mod << endl;
	return 0;
}

Measured memory_bytes: 214272
s = [i for i in input()]
t = [i for i in input()]
flg = 0

for i in range(len(s)):
    if s != t:
        s.append(s[0])
        s.remove(s[0])
    else:
        flg = 1
        break

if flg == 0:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 3060
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<list>
#include<queue>
#include<numeric>
#include<map>
#include<string>

using namespace std;

long long int a[100005];
int main() {
    long long int n;
    queue<long long int> q;

    scanf("%lld", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
        q.push(a[i]);
    }

    long long int am = q.front();

    while (!q.empty()) {
        long long int b = q.front();
        q.pop();

        if (b % am != 0) {
            q.push(b % am);
            am = b % am;
            for (int i = 0; i < n; i++) {
                if (a[i] % am != 0) {
                    q.push(a[i] % am);
                }
            }
        }
    }

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

    return 0;
}


Measured memory_bytes: 16948
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pa = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
const ll MOD = 1e9 + 7;
const ll INF = 1e14;
const long double EPS = 1e-11;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r)-1; i >= (l); i--)

void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N;
    cin >> N;
    vl A(N), B(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];

    vl mi, pl;
    rep(i, N) {
        ll d = A[i] - B[i];
        if (d > 0)
            pl.eb(d);
        else if (d < 0)
            mi.eb(-d);
    }
    if (mi.size() == 0) {
        cout << 0 << endl;
        return 0;
    } else if (pl.size() == 0) {
        cout << -1 << endl;
        return 0;
    }

    ll sum = accumulate(all(mi), 0LL);
    ll ans = mi.size();

    sort(all(pl), greater<ll>());
    rep(i, (int)pl.size()) {
        if (sum <= 0) break;
        ans++;
        sum -= pl[i];
    }
    if (sum > 0) ans = -1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2936
n, q = map(int, input().split())
s = input()
"""ナイーブ
for i in range(q):
    l, r = map(int, input().split())
    print(s[l-1:r].count("AC"))
"""
# 前処理＋全探索
# 区間なので累積和を疑う
t = [0]*n
count = 0
for i in range(n-1):
    t[i] = count
    if s[i] + s[i+1] == "AC":
        count += 1
    t[i+1] = count
#print(t)
for i in range(q):
    l, r = map(int, input().split())
    ans = t[r-1] - t[l-1]
    print(ans)

Measured memory_bytes: 51800
#include <iostream>
using namespace std;
int main(){
	int h, m, s, S;

	cin >> S ;

	h = S / 3600;
	S %= 3600;
	m = S / 60;
	s = S % 60;

	cout << h << ":" << m << ":" << s << endl;


 	return 0;

}

Measured memory_bytes: 3096
N = int(input())
A = list(map(int, input().split()))
A.sort()
a = max(A)
import math
import bisect
mid = a / 2
left = bisect.bisect_left(A, mid)
min_diff = 1<<50
for diff in [-1, 0]:
    at = left + diff
    diff_abs = abs(A[at]-mid)
    if diff_abs < min_diff:
        min_diff = diff_abs
        b = A[at]

print("%d %d" % (a, b))

Measured memory_bytes: 62704
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

int main(){
	int n; cin >> n;
	vector<int> l(n);
	rep(i,n) cin >> l[i];
	int ans = 0;
	for(int i=0; i<n-2; i++){
		for(int j=i+1; j<n-1; j++){
			for(int k=j+1; k<n; k++){
				if(l[i] + l[j] > l[k] && abs(l[i]-l[j]) < l[k] && l[i] != l[j] && l[j] != l[k] && l[k] != l[i]){
					
					ans++;
				}
			}
		}
	}
	cout << ans << endl;
}

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

int main() {
  string S;
  cin >> S;
  
  if(S[2] == S[3] && S[4]==S[5]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ve vector
#define chmin(x,y) x = min(x,y)

int main(){
    int n,k;
    cin >> n >> k;
    ve<int> a(n);
    int s = 0;
    rep(i,n){
        cin >> a[i];
        s += a[i];
    }
    set<int> fac;
    for (int i = 1; i*i <= s; i++) {
        if(s%i == 0){
            fac.insert(i);
            fac.insert(s/i);
        }
    }
    int ans = 1;
    
    for(int x: fac){
        int memo = 2e9;
        ve<int> m(n);
        rep(j,n){
            m[j] = a[j] % x;
        }
        sort(m.begin(), m.end());
        ve<int> sl(n+1),sr(n+1);
        sl[0] = 0; sr[0] = 0;
        rep(j,n) sl[j+1] = sl[j] + m[j];
        rep(j,n) sr[j+1] = sr[j] + (x-m[n-1-j]);
        rep(j,n+1) {
            if(sl[j] == sr[n-j]){
                memo = sl[j];
                break;
            }
        }
        if(memo <= k){
            ans = max(ans,x);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//--<for debugging>
#define whatis(x) cout << #x << " is " << x<<" ";
#define whatisl(x) cout << #x << " is " << x<<"\n";
#define parr(array,end)for(ll loop=0;loop<end;loop++)cout<<array[loop]<<" ";cout<<"\n";
#define lline cout<<"\n";
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"\n";}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"___";}
    
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a <<" , ";
    err(++it, args...);
}
//--</for debugging> 
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define testcase ll tt; cin >> tt; while(tt--)
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define vars ll h,i,j,k,d,l,p,q,r,x,y,a,b,c,v,var,n,m,z,s,ans,ind1,ind2,flag,limit1,limit2,limit3,mod;
#define vll vector<ll>
#define pll pair<ll,ll>
#define sll set<ll>
#define pint pair<int,int>
const ll INF=1e9+7;
const ll MOD=1e9+7;
int main()
{
    boost vars
    cin>>c>>r>>n;
    a=c;b=0;p=r;q=0;
    for(i=0;i<n;i++)
    {
        cin>>x>>y>>v;
        if(v==1&&x>b)b=x;
        if(v==2&&x<a)a=x;
        if(v==3&&y>q)q=y;
        if(v==4&&y<p)p=y;
    }
    //errorl(a,b,p,q,n);
    cout<<max(0ll,a-b)*max(0ll,p-q);
    /*if(a<b||p<q)cout<<0;
    else
    {
        cout<<a-b+1
    }*/
    
}

Measured memory_bytes: 256